Skip to content

Commit de21da7

Browse files
authored
Port CI changes from Express5 repo (#4)
* ci: factor out Node setup (apollo-server-integrations/apollo-server-integration-express5#3) * ci: changeset check, make changeset more like apollo-server CI (apollo-server-integrations/apollo-server-integration-express5#4)
1 parent 03534bb commit de21da7

File tree

5 files changed

+52
-41
lines changed

5 files changed

+52
-41
lines changed

.changeset/blue-jeans-buy.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.github/actions/node/action.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: 'Get ready for Node'
2+
description: 'Sets up Node using Mise and installs'
3+
inputs:
4+
node-version-override:
5+
description: 'Override Node version'
6+
required: false
7+
runs:
8+
using: "composite"
9+
steps:
10+
- if: ${{ inputs.node-version-override }}
11+
uses: jdx/mise-action@v2
12+
with:
13+
mise_toml: |
14+
[tools]
15+
node = "${{ inputs.node-version-override }}"
16+
- if: ${{ ! inputs.node-version-override }}
17+
uses: jdx/mise-action@v2
18+
- uses: actions/setup-node@v4
19+
with:
20+
cache: 'npm'
21+
- run: npm ci
22+
shell: bash

.github/workflows/ci.yml

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,9 @@ jobs:
1212
name: Build and test with Node ${{ matrix.node }}
1313
steps:
1414
- uses: actions/checkout@v4
15-
- uses: jdx/mise-action@v2
15+
- uses: ./.github/actions/node
1616
with:
17-
mise_toml: |
18-
[tools]
19-
node = "${{ matrix.node }}"
20-
- uses: actions/setup-node@v4
21-
with:
22-
cache: 'npm'
23-
- run: npm ci
17+
node-version-override: ${{ matrix.node }}
2418
- run: npm test
2519

2620
# This runs against an old alpha of GraphQL v17; hopefully Apollo Server v5
@@ -30,11 +24,7 @@ jobs:
3024
name: Test against GraphQL 17 alpha with incremental delivery
3125
steps:
3226
- uses: actions/checkout@v4
33-
- uses: jdx/mise-action@v2
34-
- uses: actions/setup-node@v4
35-
with:
36-
cache: 'npm'
37-
- run: npm ci
27+
- uses: ./.github/actions/node
3828
- run: npm i --legacy-peer-deps graphql@17.0.0-alpha.2
3929
- run: npm test
4030
env:
@@ -45,33 +35,37 @@ jobs:
4535
name: Prettier
4636
steps:
4737
- uses: actions/checkout@v4
48-
- uses: jdx/mise-action@v2
49-
- uses: actions/setup-node@v4
50-
with:
51-
cache: 'npm'
52-
- run: npm ci
38+
- uses: ./.github/actions/node
5339
- run: npm run prettier-check
5440

5541
lint:
5642
runs-on: ubuntu-latest
5743
name: Lint
5844
steps:
5945
- uses: actions/checkout@v4
60-
- uses: jdx/mise-action@v2
61-
- uses: actions/setup-node@v4
62-
with:
63-
cache: 'npm'
64-
- run: npm ci
46+
- uses: ./.github/actions/node
6547
- run: npm run lint
6648

6749
spell-check:
6850
runs-on: ubuntu-latest
6951
name: Spell Check
7052
steps:
7153
- uses: actions/checkout@v4
72-
- uses: jdx/mise-action@v2
73-
- uses: actions/setup-node@v4
74-
with:
75-
cache: 'npm'
76-
- run: npm ci
54+
- uses: ./.github/actions/node
7755
- run: npm run spell-check
56+
57+
# Ensure that any PR that changes packages has a changeset on it (perhaps an
58+
# empty one created with `changeset --empty`). We run the Changesets job
59+
# itself on all branches so that we can require it to pass, gbut we don't run
60+
# the actual check on the "Version Packages" PRs themselves.
61+
changeset:
62+
runs-on: ubuntu-latest
63+
name: Changesets
64+
steps:
65+
- uses: actions/checkout@v4
66+
with:
67+
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
68+
fetch-depth: 0
69+
- uses: ./.github/actions/node
70+
- run: npm run changeset-check
71+
if: ${{ ! startsWith(github.head_ref, 'changeset-release/') }}

.github/workflows/release-pr.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,12 @@ jobs:
1616
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
1717
fetch-depth: 0
1818

19-
- name: Install Node with Mise
20-
uses: jdx/mise-action@v2
21-
22-
- name: Setup Node.js 16.x
23-
uses: actions/setup-node@v4
24-
with:
25-
cache: 'npm'
26-
27-
- name: Install Dependencies
28-
run: npm ci
29-
19+
- uses: ./.github/actions/node
3020
- name: Create Release Pull Request / NPM Publish
3121
uses: changesets/action@v1
3222
with:
33-
publish: npm run publish-changeset
23+
publish: npm run changeset-publish
24+
version: npm run changeset-version
3425
env:
3526
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3627
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
"prepack": "npm run build",
2424
"prettier-check": "prettier --check .",
2525
"prettier-fix": "prettier --write .",
26-
"publish-changeset": "changeset publish",
26+
"changeset-publish": "npm run compile && changeset publish",
27+
"changeset-check": "changeset status --verbose --since=origin/main",
28+
"changeset-version": "changeset version && npm i",
2729
"spell-check": "cspell lint '**' --no-progress || (echo 'Add any real words to cspell-dict.txt.'; exit 1)",
2830
"test": "jest",
2931
"test:ci": "jest --coverage --ci --maxWorkers=2 --reporters=default --reporters=jest-junit",

0 commit comments

Comments
 (0)