Repository navigation
88 lines (72 loc) · 2.8 KB
/
Copy pathci.yml
File metadata and controls
88 lines (72 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
permissions:
contents: read
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v7
- name: Set up pnpm and Node.js, install dependencies
uses: pnpm/setup@a0881977cd8ea73b1ed212236c99ca10dcc80cf4 # v3.1.1
with:
node-version-file: .nvmrc
cache: true
require-lockfile: true
- name: Lint
run: pnpm lint
- name: Check formatting
run: pnpm format:check
- name: Build
run: pnpm build
# The build regenerates the SDK from the committed schema, so any diff means a generated file
# was edited by hand or not regenerated after a schema or generator change.
- name: Check generated files are up to date
run: |
if [ -n "$(git status --porcelain)" ]; then
git status --short
echo "::error::Generated files are out of date. Run pnpm build and commit the result."
exit 1
fi
- name: Typecheck
run: pnpm typecheck
- name: Test
run: pnpm test
package:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v7
- name: Set up pnpm and Node.js, install dependencies
uses: pnpm/setup@a0881977cd8ea73b1ed212236c99ca10dcc80cf4 # v3.1.1
with:
node-version-file: .nvmrc
cache: true
require-lockfile: true
- name: Build
run: pnpm build
# Raw size, not compressed: an unminified build can be twice the size and gzip the same.
- name: Check the built JS stays within its size limits
run: pnpm exec size-limit
- name: Check exports and types resolve in every module mode
run: |
for pkg in graphql ui-components webhooks; do
pnpm exec attw --pack "packages/$pkg"
pnpm exec publint "packages/$pkg"
done
- name: Install the packed packages and load them
run: |
mkdir -p "$RUNNER_TEMP/packs"
pnpm -r --filter "./packages/*" --filter "!@team-plain/graphql-codegen-plugin" \
exec pnpm pack --pack-destination "$RUNNER_TEMP/packs"
mkdir "$RUNNER_TEMP/consumer" && cd "$RUNNER_TEMP/consumer"
npm init -y > /dev/null
npm install --no-audit --no-fund "$RUNNER_TEMP"/packs/*.tgz
export PACKAGES='["@team-plain/graphql","@team-plain/ui-components","@team-plain/webhooks"]'
node -e 'for (const p of JSON.parse(process.env.PACKAGES)) if (!Object.keys(require(p)).length) throw new Error(p)'
node --input-type=module -e 'for (const p of JSON.parse(process.env.PACKAGES)) if (!Object.keys(await import(p)).length) throw new Error(p)'