-
Notifications
You must be signed in to change notification settings - Fork 2
62 lines (53 loc) · 1.61 KB
/
build-and-test.yml
File metadata and controls
62 lines (53 loc) · 1.61 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
name: Build and Test
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Build and test
permissions:
contents: read
actions: write
checks: write
statuses: write
steps:
- uses: actions/checkout@v4
- name: Setup node 24
uses: actions/setup-node@v3
with:
node-version: 24.14.1
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Lint
run: npm run lint
- name: Test
run: npm run test
- name: Create test report
uses: phoenix-actions/test-reporting@v12
if: success() || failure() # run this step even if previous step failed
with:
name: Tests # Name of the check run which will be created
path: test-results/jest-*.xml # Path to test results
reporter: jest-junit # Format of test results
output-to: step-summary
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff
# If index.js was different from expected, upload the expected version as an artifact
- name: Upload dist as artifact if differences detected
uses: actions/upload-artifact@v4
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/