-
-
Notifications
You must be signed in to change notification settings - Fork 30
140 lines (128 loc) · 3.83 KB
/
check.yml
File metadata and controls
140 lines (128 loc) · 3.83 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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: 🚦 PR Checks
on:
pull_request:
branches: [main]
permissions:
contents: read
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
lib: ${{ steps.filter.outputs.lib }}
web: ${{ steps.filter.outputs.web }}
data: ${{ steps.filter.outputs.data }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
lib:
- 'lib/**'
- 'Makefile'
web:
- 'web/**'
data:
- 'independent-programs.yml'
- 'platform-programs.yml'
- 'lib/schema.json'
lib-checks:
needs: detect-changes
if: needs.detect-changes.outputs.lib == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install -r lib/requirements.txt
- run: make validate
web-lint:
needs: detect-changes
if: needs.detect-changes.outputs.web == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: web/package-lock.json
- run: npm ci
- run: npm run lint
web-typecheck:
needs: detect-changes
if: needs.detect-changes.outputs.web == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: web/package-lock.json
- run: npm ci
- run: npm run type-check
web-format:
needs: detect-changes
if: needs.detect-changes.outputs.web == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: web/package-lock.json
- run: npm ci
- run: npm run format:check
data-validation:
needs: detect-changes
if: needs.detect-changes.outputs.data == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install -r lib/requirements.txt
- run: make validate
summary:
needs: [lib-checks, web-lint, web-typecheck, web-format, data-validation]
if: always()
runs-on: ubuntu-latest
steps:
- name: Check results
run: |
failed=0
echo "## PR Check Results" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "| Job | Status |" >> "$GITHUB_STEP_SUMMARY"
echo "|-----|--------|" >> "$GITHUB_STEP_SUMMARY"
for job in lib-checks web-lint web-typecheck web-format data-validation; do
case "$job" in
lib-checks) result="${{ needs.lib-checks.result }}" ;;
web-lint) result="${{ needs.web-lint.result }}" ;;
web-typecheck) result="${{ needs.web-typecheck.result }}" ;;
web-format) result="${{ needs.web-format.result }}" ;;
data-validation) result="${{ needs.data-validation.result }}" ;;
esac
if [ "$result" = "failure" ]; then
echo "| $job | failed |" >> "$GITHUB_STEP_SUMMARY"
failed=1
elif [ "$result" = "skipped" ]; then
echo "| $job | skipped |" >> "$GITHUB_STEP_SUMMARY"
else
echo "| $job | passed |" >> "$GITHUB_STEP_SUMMARY"
fi
done
exit "$failed"