-
-
Notifications
You must be signed in to change notification settings - Fork 1
115 lines (102 loc) · 2.84 KB
/
test-pr.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Perform Tests
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
jobs:
collection-packages:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.ls.outputs.packages }}
steps:
- uses: actions/checkout@v4
- name: Gather package directories
id: ls
run: echo "packages=[$(ls -d packages/* | sed 's/[^[:alnum:]]/\\&/g' | sed 's/.*/"&",/' | tr -d '\n' | sed '$s/,$//')]" >> $GITHUB_OUTPUT
Lint:
runs-on: ubuntu-latest
needs: [collection-packages]
strategy:
matrix:
package: ${{ fromJSON(needs.collection-packages.outputs.packages) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: latest
standalone: true
run_install: true
- name: Lint
run: pnpm run -C ${{ matrix.package }} lint:check
- name: Type Check
run: pnpm run -C ${{ matrix.package }} lint:types
continue-on-error: true # AlpineTS is still not fully typed
Test:
runs-on: ubuntu-latest
needs: [collection-packages]
strategy:
matrix:
package: ${{ fromJSON(needs.collection-packages.outputs.packages) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: latest
standalone: true
run_install: true
- name: Test
run: pnpm run -C ${{ matrix.package }} test --run --reporter=verbose
Build:
runs-on: ubuntu-latest
needs: [collection-packages]
strategy:
matrix:
package: ${{ fromJSON(needs.collection-packages.outputs.packages) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: latest
standalone: true
run_install: true
- name: Build Package
run: pnpm run -C ${{ matrix.package }} -r build
check-success:
runs-on: ubuntu-latest
needs: [Lint, Test, Build]
if: success()
outputs:
was_successful: ${{ steps.check-success.outputs.was_successful }}
steps:
- name: Check if all jobs were successful
id: check-success
run: |
echo "was_successful=true" >> $GITHUB_OUTPUT
was-successful:
runs-on: ubuntu-latest
needs: [check-success]
if: always()
steps:
- name: Was Successful
run: |
passed="${{ needs.check-success.outputs.was_successful }}"
if [[ $passed == "true" ]]; then
echo "All checks passed"
exit 0
else
echo "Check(s) failed"
exit 1
fi