Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add CI tests #19

Merged
merged 10 commits into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules/
cypress/videos
cypress/screenshots
**/cypress/videos
11 changes: 5 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
How to [code a plugin](https://github.com/netlify/build/blob/master/docs/creating-a-plugin.md)

## Testing and releasing a new version
## Testing

If helps to install [Netlify CLI](https://github.com/netlify/cli) to test the plugin locally
End-to-end tests are in folder [tests](tests) and they use this [plugin locally](https://github.com/netlify/build/blob/master/README.md#using-a-local-plugin) and build each subfolder using Netlify CLI on CircleCI. You can find the test recordings at [Cypress Dashboard](https://dashboard.cypress.io/projects/ixroqc/)

```shell
npm install netlify-cli -g
netlify build
```
## Releasing a new version

Before releasing check that each CircleCI job has actually run the tests correctly. We don't have a way to check if Cypress _executed all tests_, other than looking at the CircleCI terminal output.

Try using `beta` branch to release new pre-release versions of the plugin by following [the semantic release guide](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/pre-releases.md). You can fork and test out new versions published to NPM using the [netlify-plugin-cypress-example](https://github.com/cypress-io/netlify-plugin-cypress-example) repository. Hope the `master` branch merged into `beta` does not bring features and fixes *already released*. Thus I suggest using `beta` branch for new features.

Expand Down
69 changes: 69 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: 2.1
orbs:
node: circleci/node@1.1.6
cypress: cypress-io/cypress@1
jobs:
build:
executor:
Expand All @@ -23,14 +24,82 @@ jobs:
- run: npm ci
- run: npx semantic-release

'basic test':
executor: cypress/base-12-14-0
steps:
# all dependencies were installed in previous job
- attach_workspace:
at: ~/
- run:
name: Netlify Build 🏗
command: npx netlify build
working_directory: tests/basic
environment:
DEBUG: netlify-plugin-cypress

'recommended test':
executor: cypress/base-12-14-0
steps:
# all dependencies were installed in previous job
- attach_workspace:
at: ~/
- run:
name: Netlify Build 🏗
command: npx netlify build
working_directory: tests/recommended
environment:
DEBUG: netlify-plugin-cypress

'recording test':
executor: cypress/base-12-14-0
steps:
# all dependencies were installed in previous job
- attach_workspace:
at: ~/
- run:
name: Netlify Build 🏗
command: npx netlify build
working_directory: tests/recording
environment:
DEBUG: netlify-plugin-cypress

'test-twice':
executor: cypress/base-12-14-0
steps:
# all dependencies were installed in previous job
- attach_workspace:
at: ~/
- run:
name: Netlify Build 🏗
command: npx netlify build
working_directory: tests/test-twice
environment:
DEBUG: netlify-plugin-cypress
workflows:
version: 2
test_and_release:
jobs:
- build
- cypress/install
- 'basic test':
requires:
- cypress/install
- 'recommended test':
requires:
- cypress/install
- 'recording test':
requires:
- cypress/install
- 'test-twice':
requires:
- cypress/install
- release:
requires:
- build
- 'basic test'
- 'recommended test'
- 'recording test'
- 'test-twice'
filters:
branches:
only:
Expand Down
Loading