-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (87 loc) · 2.6 KB
/
Copy pathci.yml
File metadata and controls
94 lines (87 loc) · 2.6 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
name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
schedule:
# Run the cross-check monthly so we catch upstream changes (Nager.Date data fixes,
# new Feiertagsgesetz amendments) without anyone having to remember.
# 04:17 UTC on the 4th of every month.
- cron: '17 4 4 * *'
workflow_dispatch:
jobs:
validate:
name: Validate extension
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Validate JSON files
shell: bash
run: |
fail=0
while IFS= read -r f; do
if ! node -e "JSON.parse(require('fs').readFileSync('$f','utf8'))"; then
echo "::error file=$f::Invalid JSON"
fail=1
fi
done < <(find . -path ./node_modules -prune -o -name '*.json' -print)
exit $fail
- name: Syntax-check JavaScript
shell: bash
run: |
fail=0
while IFS= read -r f; do
if ! node --check "$f"; then
echo "::error file=$f::Syntax error"
fail=1
fi
done < <(find lib popup content scripts -type f \( -name '*.js' -o -name '*.mjs' \))
exit $fail
test:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Run Node test runner
run: npm test
cross-check:
name: Cross-check vs Nager.Date
runs-on: ubuntu-latest
# Allow this job to fail without failing the whole build on schedule —
# an upstream API hiccup shouldn't block PRs.
continue-on-error: ${{ github.event_name == 'schedule' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Compare current + next year against Nager.Date
run: npm run cross-check
package:
name: Package extension zip
runs-on: ubuntu-latest
needs: [validate, test]
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
steps:
- uses: actions/checkout@v4
- name: Create zip
run: |
zip -r TimrAutoInserter.zip \
manifest.json \
_locales \
popup \
content \
lib \
README.md \
LICENSE
- uses: actions/upload-artifact@v4
with:
name: TimrAutoInserter
path: TimrAutoInserter.zip