-
Notifications
You must be signed in to change notification settings - Fork 80
209 lines (205 loc) · 6.76 KB
/
build_and_test.yaml
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: Build, Lint and Test
on:
pull_request: {}
workflow_dispatch:
inputs:
runner:
description: Which runner to use
type: choice
default: 'ubuntu-22.04'
required: true
options:
- 'ubuntu-22.04'
- 'large-ubuntu-22.04-xxl'
schedule:
- cron: '37 13,1 * * *'
env:
DOCKER_REGISTRY: ghcr.io
EVEREST_CI_VERSION: v1.3.1
jobs:
lint:
name: Lint
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
steps:
- name: Checkout everest-core
uses: actions/[email protected]
with:
path: source
- name: Run clang-format
uses: everest/everest-ci/github-actions/[email protected]
with:
source-dir: source
extensions: hpp,cpp
exclude: cache
# Since env variables can't be passed to reusable workflows, we need to pass them as outputs
setup-env:
# This job is currently disabled to allow running ci on PRs from forks
if: false
name: Setup Environment
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
outputs:
docker_registry: ${{ env.DOCKER_REGISTRY }}
everest_ci_version: ${{ env.EVEREST_CI_VERSION }}
steps:
- id: check
run: |
echo "Setting up environment"
build-and-push-build-kit:
# This job is currently disabled to allow running ci on PRs from forks
if: false
name: Build and Push Build Kit
uses: everest/everest-ci/.github/workflows/[email protected]
needs: setup-env
secrets:
SA_GITHUB_PAT: ${{ secrets.SA_GITHUB_PAT }}
SA_GITHUB_USERNAME: ${{ secrets.SA_GITHUB_USERNAME }}
with:
image_name: ${{ github.event.repository.name }}/build-kit-everest-core
directory: .ci/build-kit/docker
docker_registry: ${{ needs.setup-env.outputs.docker_registry }}
github_ref_before: ${{ github.event.before }}
github_ref_after: ${{ github.event.after }}
platforms: linux/amd64
depends_on_paths: |
.ci/build-kit
.github/workflows/build_and_test.yaml
build_args: |
BASE_IMAGE_TAG=${{ needs.setup-env.outputs.everest_ci_version }}
build:
name: Build and Unit Tests
# needs: build-and-push-build-kit
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
env:
# Currently the build-kit-base image is used to allow running ci on PRs from forks
# BUILD_KIT_IMAGE: ${{ needs.build-and-push-build-kit.outputs.one_image_tag_long }}
BUILD_KIT_IMAGE: ghcr.io/everest/everest-ci/build-kit-base:v1.3.1
steps:
- name: Format branch name for cache key
run: |
BRANCH_NAME_FOR_CACHE="${GITHUB_REF_NAME//-/_}"
echo "branch_name_for_cache=${BRANCH_NAME_FOR_CACHE}" >> "$GITHUB_ENV"
- name: Setup cache
uses: actions/cache@v3
with:
path: cache
key: compile-${{ env.branch_name_for_cache }}-${{ github.sha }}
restore-keys: |
compile-${{ env.branch_name_for_cache }}-
compile-
- name: Checkout everest-core
uses: actions/[email protected]
with:
path: source
- name: Setup run scripts
run: |
mkdir scripts
rsync -a source/.ci/build-kit/scripts/ scripts
- name: Pull build-kit image
run: |
docker pull --quiet ${{ env.BUILD_KIT_IMAGE }}
docker image tag ${{ env.BUILD_KIT_IMAGE }} build-kit
- name: Compile
run: |
docker run \
--volume "$(pwd):/ext" \
--name compile-container \
build-kit run-script compile
- name: Commit compile-container
run: |
docker commit compile-container build-image
- name: Run unit tests
run: |
docker run \
--volume "$(pwd):/ext" \
--name unit-tests-container \
build-image run-script run_unit_tests
- name: Create dist
run: |
docker run \
--volume "$(pwd):/ext" \
--name install-container \
build-image run-script install
- name: Tar dist dir and keep permissions
run: |
tar -czf dist.tar.gz dist
- name: Upload dist artifact
uses: actions/[email protected]
with:
path: dist.tar.gz
name: dist
- name: Upload wheels artifact
uses: actions/[email protected]
with:
path: dist-wheels
name: wheels
- name: Archive unit test results
if: always()
uses: actions/[email protected]
with:
name: ctest-report
path: ${{ github.workspace }}/ctest-report
integration-tests:
name: Integration Tests
needs:
- build
# - build-and-push-build-kit
env:
# Currently the build-kit-base image is used to allow running ci on PRs from forks
# BUILD_KIT_IMAGE: ${{ needs.build-and-push-build-kit.outputs.one_image_tag_long }}
BUILD_KIT_IMAGE: ghcr.io/everest/everest-ci/build-kit-base:v1.3.1
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
steps:
- name: Download dist dir
uses: actions/[email protected]
with:
name: dist
- name: Extract dist.tar.gz
run: |
tar -xzf ${{ github.workspace }}/dist.tar.gz -C ${{ github.workspace }}
- name: Download wheels
uses: actions/[email protected]
with:
name: wheels
path: wheels
- name: Checkout everest-core
uses: actions/[email protected]
with:
path: source
- name: Setup run scripts
run: |
mkdir scripts
rsync -a source/.ci/build-kit/scripts/ scripts
- name: Pull build-kit image
run: |
docker pull --quiet ${{ env.BUILD_KIT_IMAGE }}
docker image tag ${{ env.BUILD_KIT_IMAGE }} build-kit
- name: Create integration-image
run: |
docker run \
--volume "$(pwd):/ext" \
--name prepare-container \
build-kit run-script prepare_integration_tests
docker commit prepare-container integration-image
- name: Run integration tests
run: |
pushd source/.ci/e2e
docker compose run \
e2e-test-server \
run-script run_integration_tests
- name: Upload result & report as artifact
if: always()
uses: actions/[email protected]
with:
path: |
${{ github.workspace }}/result.xml
${{ github.workspace }}/report.html
name: pytest-results
- name: Render result
if: always()
uses: pmeier/[email protected]
with:
path: ${{ github.workspace }}/result.xml
summary: True
display-options: fEX
fail-on-empty: True
title: Test results