Skip to content

Commit 5e3c802

Browse files
timphandevclaude
andcommitted
ci: run the consumers in a workflow of their own
Move the job that runs pnpm consumers from compat.yml to consumers.yml, which runs on every change to the packages, to consumers, to the declarations that api/consumers keeps, or to scripts/consumers. compat no longer runs on changes to the consumers alone, and a change to the kept declarations, which compat did not watch, now runs them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 47184c2 commit 5e3c802

3 files changed

Lines changed: 117 additions & 51 deletions

File tree

‎.github/workflows/compat.yml‎

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ on:
66
paths:
77
- packages/*/src/**
88
- packages/*/bench/**
9-
- consumers/**
10-
- scripts/consumers/**
119
- scripts/sources/**
1210
- packages/*/package.json
1311
- packages/*/tsdown.config.ts
@@ -21,8 +19,6 @@ on:
2119
paths:
2220
- packages/*/src/**
2321
- packages/*/bench/**
24-
- consumers/**
25-
- scripts/consumers/**
2622
- scripts/sources/**
2723
- packages/*/package.json
2824
- packages/*/tsdown.config.ts
@@ -47,8 +43,6 @@ jobs:
4743
outputs:
4844
node: ${{ steps.versions.outputs.node }}
4945
versions: ${{ steps.versions.outputs.versions }}
50-
typescript: ${{ steps.versions.outputs.typescript }}
51-
react-native: ${{ steps.versions.outputs.react-native }}
5246
steps:
5347
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
5448
with:
@@ -70,9 +64,6 @@ jobs:
7064
run: |
7165
echo "versions=$(jq -c . compat/versions.json)" >> "$GITHUB_OUTPUT"
7266
echo "node=$(jq -c '[.node] + .nodeRequire + ["lts/*"]' compat/versions.json)" >> "$GITHUB_OUTPUT"
73-
echo "typescript=$(jq -r .devDependencies.typescript package.json)" >> "$GITHUB_OUTPUT"
74-
oldest="$(jq -r '.peerDependencies["react-native"] | ltrimstr(">=")' packages/native-recipe/package.json)"
75-
echo "react-native=$(jq -c --arg oldest "$oldest" '[$oldest, .dependencies["react-native"]]' consumers/native-recipe/app/package.json)" >> "$GITHUB_OUTPUT"
7667
7768
node:
7869
name: Node.js ${{ matrix.node }}
@@ -184,37 +175,3 @@ jobs:
184175
env:
185176
TYPESCRIPT: ${{ fromJSON(needs.pack.outputs.versions).typescript }}
186177
run: pnpm sources --typescript "$TYPESCRIPT"
187-
188-
typescript:
189-
name: TypeScript ${{ matrix.typescript }}, React Native ${{ matrix.react-native }}
190-
needs: pack
191-
runs-on: ubuntu-latest
192-
strategy:
193-
fail-fast: false
194-
matrix:
195-
typescript:
196-
- ${{ fromJSON(needs.pack.outputs.versions).typescript }}
197-
- ${{ needs.pack.outputs.typescript }}
198-
react-native: ${{ fromJSON(needs.pack.outputs.react-native) }}
199-
steps:
200-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
201-
with:
202-
persist-credentials: false
203-
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
204-
with:
205-
name: packages
206-
path: ${{ runner.temp }}/packages
207-
- uses: pnpm/setup@fbda4c85fc2e1e08721cd8763afea8f48d60f024 # v3.0.0
208-
with:
209-
install: false
210-
# Installs the packed packages in each app of consumers, outside the
211-
# repository, as an app installs them from npm, and compiles it.
212-
- name: Compile the apps that install the packages
213-
env:
214-
TYPESCRIPT: ${{ matrix.typescript }}
215-
REACT_NATIVE: ${{ matrix.react-native }}
216-
run: >-
217-
node scripts/consumers/main.ts
218-
--packages "$RUNNER_TEMP/packages"
219-
--typescript "$TYPESCRIPT"
220-
--react-native "$REACT_NATIVE"

‎.github/workflows/consumers.yml‎

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Consumers
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- packages/*/src/**
8+
- packages/*/package.json
9+
- packages/*/tsdown.config.ts
10+
- packages/*/tsconfig*.json
11+
- consumers/**
12+
- api/consumers/**
13+
- scripts/consumers/**
14+
- compat/versions.json
15+
- .github/workflows/consumers.yml
16+
- package.json
17+
- pnpm-lock.yaml
18+
- pnpm-workspace.yaml
19+
- tsconfig.base.json
20+
pull_request:
21+
paths:
22+
- packages/*/src/**
23+
- packages/*/package.json
24+
- packages/*/tsdown.config.ts
25+
- packages/*/tsconfig*.json
26+
- consumers/**
27+
- api/consumers/**
28+
- scripts/consumers/**
29+
- compat/versions.json
30+
- .github/workflows/consumers.yml
31+
- package.json
32+
- pnpm-lock.yaml
33+
- pnpm-workspace.yaml
34+
- tsconfig.base.json
35+
36+
permissions:
37+
contents: read
38+
39+
concurrency:
40+
group: ${{ github.workflow }}-${{ github.ref }}
41+
cancel-in-progress: true
42+
43+
jobs:
44+
pack:
45+
name: Pack the packages
46+
runs-on: ubuntu-latest
47+
outputs:
48+
typescript: ${{ steps.versions.outputs.typescript }}
49+
react-native: ${{ steps.versions.outputs.react-native }}
50+
steps:
51+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
52+
with:
53+
persist-credentials: false
54+
- uses: pnpm/setup@fbda4c85fc2e1e08721cd8763afea8f48d60f024 # v3.0.0
55+
with:
56+
cache: true
57+
require-lockfile: true
58+
- run: pnpm build
59+
# pnpm pack turns workspace:^ dependencies into version ranges.
60+
- run: pnpm --filter "./packages/*" pack --pack-destination "$RUNNER_TEMP/packages"
61+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
62+
with:
63+
name: packages
64+
path: ${{ runner.temp }}/packages
65+
if-no-files-found: error
66+
# The oldest and the newest TypeScript and React Native to compile
67+
# the apps with.
68+
- name: Read the versions to check
69+
id: versions
70+
run: |
71+
echo "typescript=$(jq -c --arg newest "$(jq -r .devDependencies.typescript package.json)" '[.typescript, $newest]' compat/versions.json)" >> "$GITHUB_OUTPUT"
72+
oldest="$(jq -r '.peerDependencies["react-native"] | ltrimstr(">=")' packages/native-recipe/package.json)"
73+
echo "react-native=$(jq -c --arg oldest "$oldest" '[$oldest, .dependencies["react-native"]]' consumers/native-recipe/app/package.json)" >> "$GITHUB_OUTPUT"
74+
75+
compile:
76+
name: TypeScript ${{ matrix.typescript }}, React Native ${{ matrix.react-native }}
77+
needs: pack
78+
runs-on: ubuntu-latest
79+
strategy:
80+
fail-fast: false
81+
matrix:
82+
typescript: ${{ fromJSON(needs.pack.outputs.typescript) }}
83+
react-native: ${{ fromJSON(needs.pack.outputs.react-native) }}
84+
steps:
85+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
86+
with:
87+
persist-credentials: false
88+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
89+
with:
90+
name: packages
91+
path: ${{ runner.temp }}/packages
92+
- uses: pnpm/setup@fbda4c85fc2e1e08721cd8763afea8f48d60f024 # v3.0.0
93+
with:
94+
install: false
95+
# Installs the packed packages in each app of consumers, outside the
96+
# repository, as an app installs them from npm, compiles it, and,
97+
# with the TypeScript and React Native of the repository, compares
98+
# its declarations with those that api/consumers keeps.
99+
- name: Compile the apps that install the packages
100+
env:
101+
TYPESCRIPT: ${{ matrix.typescript }}
102+
REACT_NATIVE: ${{ matrix.react-native }}
103+
run: >-
104+
node scripts/consumers/main.ts
105+
--packages "$RUNNER_TEMP/packages"
106+
--typescript "$TYPESCRIPT"
107+
--react-native "$REACT_NATIVE"

‎AGENTS.md‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,20 @@ it before working in that folder.
110110
`compat/versions.json` holds the oldest Node.js, Bun, Deno, and
111111
TypeScript that the packages support, and the docs read their
112112
requirements from it. `smoke.mjs` imports each package and `smoke.cjs`
113-
requires it. The apps of `consumers` are compiled with the packed
114-
packages, with the React Native that the apps of
115-
`@lynstack/native-recipe` list and the oldest that its peer dependency
116-
allows. The sources of each package are compiled with the oldest
113+
requires it. The sources of each package are compiled with the oldest
117114
TypeScript.
118115
To support an older or newer minimum, change `versions.json`; never
119116
write those versions by hand in the docs.
120117
- `.github/workflows` holds a CI and a release workflow for each package,
121118
named after it, `ci.yml`, which checks what the packages share and the
122119
docs, `compat.yml`, which runs `compat` on the oldest and the newest of
123-
each runtime and TypeScript, and `docs.yml`, which builds the docs and
124-
deploys them to GitHub Pages on every push to `main` that changes them.
120+
each runtime and TypeScript, `consumers.yml`, which runs
121+
`pnpm consumers` with the oldest and the newest TypeScript, and with
122+
the React Native that the apps of `@lynstack/native-recipe` list and
123+
the oldest that its peer dependency allows, whenever the packages, the
124+
consumers, or the declarations they keep change, and `docs.yml`, which builds
125+
the docs and deploys them to GitHub Pages on every push to `main` that
126+
changes them.
125127

126128
## Commands
127129

@@ -173,8 +175,8 @@ package with its apps, run
173175
`--typescript <version>` or `--react-native <version>` to compile with
174176
those, and `--update` to write the declarations of the apps to `api`.
175177
Run it after a change to a public type, or to the dependencies between
176-
the packages, and commit `api` with the change; CI runs it on the
177-
oldest and newest TypeScript and React Native, and the release
178+
the packages, and commit `api` with the change; `consumers.yml` runs
179+
it on the oldest and newest TypeScript and React Native, and the release
178180
workflow of each package runs it before publishing.
179181
- `pnpm sources --typescript <version>` builds the packages and compiles
180182
the sources of each, tests and benchmarks included, with that

0 commit comments

Comments
 (0)