-
Notifications
You must be signed in to change notification settings - Fork 7
123 lines (119 loc) · 3.38 KB
/
build.yml
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
name: Build
on:
push:
branches:
- main
pull_request:
workflow_dispatch: # allows to be run manually
workflow_call: # when called from another workflow
inputs:
checkout_ref:
required: true
type: string
outputs:
production_artifact_name:
value: ${{ jobs.build.outputs.production_artifact_name }}
env:
PREPARED_NODE_MODULES_ARTIFACT_NAME: node_modules
PRODUCTION_ARTIFACT_NAME: dist
DEVELOPMENT_ARTIFACT_NAME: dist-development
permissions:
contents: read
jobs:
prepare_cache:
name: Prepare cache
# to populate the cache for the following jobs that have this one in 'needs'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.checkout_ref }}
- name: Prepare the project
uses: ./.github/actions/prepare
with:
save-cache: true
build_dev:
name: Build development version
needs: prepare_cache
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.checkout_ref }}
- name: Prepare the project
uses: ./.github/actions/prepare
- name: Build add-on (development version)
run: make build_in_container
env:
MODE: development
- name: Save built add-on (development version)
uses: actions/upload-artifact@v4
with:
name: ${{ env.DEVELOPMENT_ARTIFACT_NAME }}
path: dist
retention-days: 30
build:
name: Build production version
needs: prepare_cache
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.checkout_ref }}
- name: Prepare the project
uses: ./.github/actions/prepare
- name: Build add-on
run: make build_in_container
- name: Save built add-on
uses: actions/upload-artifact@v4
with:
name: ${{ env.PRODUCTION_ARTIFACT_NAME }}
path: dist
retention-days: 30
outputs:
production_artifact_name: ${{ env.PRODUCTION_ARTIFACT_NAME }}
test:
name: Run tests
needs: prepare_cache
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.checkout_ref }}
- name: Prepare the project
uses: ./.github/actions/prepare
- name: Run tests
run: make test_in_container
- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v4
generated_code_consistency:
name: Verify generated code is consistent
needs: prepare_cache
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.checkout_ref }}
- name: Prepare the project
uses: ./.github/actions/prepare
- name: Generate GraphQL code
run: make graphql_generate
- name: Check changes in generated code
run: |
git status
git diff
UNCOMMITTED_CHANGES="$(git status --porcelain)"
if [ -n "${UNCOMMITTED_CHANGES}" ]; then
echo 'Found uncommitted changes' >&2
exit 1
fi