-
Notifications
You must be signed in to change notification settings - Fork 4
105 lines (92 loc) · 3.12 KB
/
continuous-integration.yml
File metadata and controls
105 lines (92 loc) · 3.12 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
name: Continuous Integration
on:
push:
branches: [staging, master]
pull_request:
merge_group:
workflow_call:
inputs:
sha:
description: The commit SHA to run the workflow on
required: false
type: string
secrets:
codecov_token:
description: Codecov token
required: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
ref: ${{ inputs.sha }}
- name: Build test image
uses: guidojw/actions/build-docker-image@93f79307970f9904f178fa99c97bf02f5bc955c9 # v2.0.0
with:
file: Dockerfile
target: base
name: app
lint:
name: Lint
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
ref: ${{ inputs.sha }}
- name: Add problem matchers
run: |
echo '::add-matcher::.github/problem-matchers/actionlint.json'
echo '::add-matcher::.github/problem-matchers/ember-template-lint.json'
echo '::add-matcher::.github/problem-matchers/eslint-stylish.json'
- name: Download actionlint
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.9
- name: Load test image
uses: guidojw/actions/load-docker-image@93f79307970f9904f178fa99c97bf02f5bc955c9 # v2.0.0
with:
name: app
- name: Lint
run: |
EXIT_STATUS=0
./actionlint -ignore 'SC2153:' -ignore 'property "sha" is not defined in object type {}' || \
EXIT_STATUS=$?
docker run app yarn lint:hbs || EXIT_STATUS=$?
docker run app yarn lint:js || EXIT_STATUS=$?
docker run app /bin/bash -c 'yarn lint:scss -f github | sed "s|$(pwd)/||g" ; exit ${PIPESTATUS[0]}' || \
EXIT_STATUS=$?
exit $EXIT_STATUS
test:
name: Test
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
ref: ${{ inputs.sha }}
- name: Load test image
uses: guidojw/actions/load-docker-image@93f79307970f9904f178fa99c97bf02f5bc955c9 # v2.0.0
with:
name: app
- name: Test
run: |
mkdir coverage
docker run -e CI=true -e COVERAGE=true -v "$(pwd)"'/coverage:/opt/app/coverage' app yarn test:ember
- name: Upload coverage report to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage report artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: coverage
path: coverage/
if-no-files-found: error