Skip to content

Commit e407b57

Browse files
authored
Unify CI tests (#1004)
This does a few things to simplify testing and CI: * `npm test` locally will now include format checking, which previously it did not. This means if you run `npm test` locally you can be fairly sure that CI will pass. * Broke out CI jobs to run all test sub-steps in parallel. This should make it a little easier to understand why a PR failed CI. * Remove the dedicated prettier workflow (in favor of the one in test/CI) * Updates prettier and action versions
1 parent 193fba3 commit e407b57

File tree

4 files changed

+41
-38
lines changed

4 files changed

+41
-38
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,45 @@
11
name: CI
2+
23
on:
34
push:
45
branches:
56
- main
67
pull_request:
7-
branches:
8-
- main
8+
99
jobs:
10-
test:
10+
test-spelling:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-node@v1
15-
with:
16-
node-version: "16.x"
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
15+
- run: npm ci
16+
- run: npm run test:spelling
17+
test-format:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: actions/setup-node@v3
1722
- run: npm ci
18-
- run: npm test
23+
- run: npm run test:format
24+
test-build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v3
28+
- uses: actions/setup-node@v3
29+
- run: npm ci
30+
- run: npm run test:build
1931
publish:
2032
if: github.ref == 'refs/heads/main'
21-
needs: test
33+
needs:
34+
- test-spelling
35+
- test-format
36+
- test-build
2237
runs-on: ubuntu-latest
2338
steps:
24-
- uses: actions/checkout@v2
39+
- uses: actions/checkout@v3
2540
with:
2641
fetch-depth: 0
27-
- uses: actions/setup-node@v1
28-
with:
29-
node-version: "16.x"
42+
- uses: actions/setup-node@v3
3043
- run: npm ci
3144
- run: npm run build
3245
- uses: peaceiris/actions-gh-pages@v3

.github/workflows/prettier.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

package-lock.json

Lines changed: 10 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
"url": "http://github.com/graphql/graphql-spec.git"
1414
},
1515
"scripts": {
16-
"test": "npm run test:build && npm run test:spellcheck",
17-
"test:build": "spec-md --metadata spec/metadata.json spec/GraphQL.md > /dev/null",
18-
"test:spellcheck": "cspell \"spec/**/*.md\" README.md",
16+
"test": "npm run test:spelling && npm run test:format && npm run test:build",
17+
"test:spelling": "cspell \"spec/**/*.md\" README.md",
1918
"format": "prettier --write \"**/*.{md,yml,yaml,json}\"",
20-
"format:check": "prettier --check \"**/*.{md,yml,yaml,json}\"",
19+
"test:format": "prettier --check \"**/*.{md,yml,yaml,json}\"",
2120
"build": "./build.sh",
21+
"test:build": "spec-md --metadata spec/metadata.json spec/GraphQL.md > /dev/null",
2222
"watch": "nodemon -e json,md --exec \"npm run build\""
2323
},
2424
"devDependencies": {
2525
"cspell": "5.9.1",
2626
"nodemon": "2.0.12",
27-
"prettier": "^2.3.0",
27+
"prettier": "2.8.1",
2828
"spec-md": "3.0.2"
2929
},
3030
"prettier": {

0 commit comments

Comments
 (0)