Repository navigation
109 lines (93 loc) · 2.94 KB
/
Copy pathtest.yml
File metadata and controls
109 lines (93 loc) · 2.94 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
name: Tests
on:
pull_request:
branches: [dev]
permissions:
contents: read
concurrency:
group: tests-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
test:
name: unit tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
# compose.yml's build context is the checkout's parent, so the checkout
# has to live in a directory named `firefly`, same as build_publish.yml.
- uses: actions/checkout@v5
with:
path: firefly
- uses: docker/setup-buildx-action@v3
# buildx so the layers land in the Actions cache
- name: Build test image
uses: docker/build-push-action@v6
with:
context: .
file: firefly/docker/Dockerfile
target: base
tags: ipac/firefly-test-js:latest
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: JavaScript tests (jest)
id: js-tests
working-directory: firefly
run: docker compose run --rm test-js
- name: Upload reports
if: '!cancelled()'
uses: actions/upload-artifact@v7
with:
name: test-reports
path: firefly/build/dist/reports/firefly/
if-no-files-found: warn
retention-days: 14
- name: Summarize
if: '!cancelled()'
env:
COVERAGE: firefly/build/dist/reports/firefly/coverage-summary.json
run: |
{
echo "## Test results"
echo
echo "| suite | result |"
echo "| --- | --- |"
echo "| JavaScript (jest) | ${{ steps.js-tests.outcome }} |"
# Written by the json-summary reporter in __jest__/jest.base.config.js.
# Absent when the test step dies before jest writes its report.
if [ -f "$COVERAGE" ]; then
echo
echo "### Coverage"
echo
echo "| metric | covered | percent |"
echo "| --- | --- | --- |"
jq -r '.total as $t
| ["statements","branches","functions","lines"][]
| "| \(.) | \($t[.].covered)/\($t[.].total) | \($t[.].pct)% |"' "$COVERAGE"
else
echo
echo "_No coverage report was produced._"
fi
} >> "$GITHUB_STEP_SUMMARY"
eslint:
name: eslint
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
with:
path: firefly
- uses: docker/setup-buildx-action@v3
- name: Build test image
uses: docker/build-push-action@v6
with:
context: .
file: firefly/docker/Dockerfile
target: base
tags: ipac/firefly-test-js:latest
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: ESLint
working-directory: firefly
run: docker compose run --rm lint-js