-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (66 loc) · 2.21 KB
/
ci.yml
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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, synchronize]
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test
timeout-minutes: 15
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [18.x]
runs-on: ${{ matrix.os }}
env:
NX_REJECT_UNKNOWN_LOCAL_CACHE: '0'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v3
with:
path: .nx
key: nx-${{ runner.os }}-${{ github.sha }}
restore-keys: |
nx-${{ runner.os }}-
- uses: pnpm/action-setup@v3
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- uses: nrwl/nx-set-shas@v4
# This line is needed for nx affected to work when CI is running on a PR
- name: Fetch NX base
run: |
git fetch --all
- name: Install deps
run: |
pnpm i --frozen-lockfile
pnpm playwright install chromium
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: Replace with tarball
run: |
pnpm --filter "./packages/*" exec pnpm pack
tmp=$(mktemp)
find packages -name 'package.json' | while read file
do
name=$(cat $file | jq --raw-output .name)
version=$(cat $file | jq --raw-output .version)
path="$(pwd)/$(echo $file | sed -E 's/package.json$//g')$(echo $name | sed -E 's/@//g' | sed -E 's/\//-/g')-$version.tgz"
echo "$(cat package.json | jq ".pnpm.overrides[\"$name\"] = \"$path\"")" > "$tmp"
mv "$tmp" package.json
done
echo "$(cat package.json | jq ".pnpm.peerDependencyRules.ignoreMissing = [\"*\"]")" > "$tmp" && mv "$tmp" package.json
pnpm i --no-frozen-lockfile
- if: ${{ github.event_name == 'pull_request' }}
name: On pull request
run: pnpm nx affected -t build,lint:type,test
- if: ${{ github.event_name == 'push' }}
name: On push
run: pnpm nx run-many -t build,lint:type,test