-
Notifications
You must be signed in to change notification settings - Fork 3
153 lines (144 loc) · 4.4 KB
/
ci.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
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
name: LAPIS-SILO
on:
push:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
DOCKER_IMAGE_NAME: ghcr.io/GenSpectrum/LAPIS-SILO
DOCKER_TEST_IMAGE_NAME: silo/unittests
jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
strategy:
matrix:
path:
- check: 'src'
- check: 'include'
exclude: '(PerfEvent.hpp)'
steps:
- uses: actions/checkout@v4
- name: Run clang-format style check
uses: jidicula/[email protected]
with:
clang-format-version: '16'
check-path: ${{ matrix.path['check'] }}
exclude-regex: ${{ matrix.path['exclude'] }}
linter:
name: Build And Run linter
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build linter image
uses: docker/build-push-action@v5
with:
context: .
push: false
target: linter
tags: ${{ env.DOCKER_TEST_IMAGE_NAME }}
cache-from: type=gha,scope=${{ github.ref_name }}-linter-image-cache
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-linter-image-cache
file: Dockerfile_linter
dockerImage:
name: Build And Run Unit Tests
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build unit test image
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
target: builder
tags: ${{ env.DOCKER_TEST_IMAGE_NAME }}
cache-from: type=gha,scope=${{ github.ref_name }}-image-cache
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-image-cache
-
name: Run tests
uses: addnab/docker-run-action@v3
with:
image: ${{ env.DOCKER_TEST_IMAGE_NAME }}
run: ./silo_test
-
name: Docker metadata
id: dockerMetadata
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_IMAGE_NAME }}
tags: |
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
-
name: Build and push production image
if: ${{ github.event_name == 'push' }}
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.dockerMetadata.outputs.tags }}
endToEndTests:
name: Run End To End Tests
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
steps:
-
uses: actions/checkout@v4
-
name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: 18.x
-
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
-
name: npm install
run: cd endToEndTests && npm ci
-
name: Check Format
run: cd endToEndTests && npm run check-format
-
name: Docker Metadata
id: dockerMetadata
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_IMAGE_NAME }}
tags: type=ref,event=branch
-
name: Wait for Docker Image
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: Build And Run Unit Tests
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Start Docker Container and preprocess data
run: docker compose -f docker-compose-for-tests-preprocessing.yml up
env:
SILO_IMAGE: ${{ steps.dockerMetadata.outputs.tags }}
- name: Start Docker Container and run api
run: docker compose -f docker-compose-for-tests-api.yml up -d --wait
env:
SILO_IMAGE: ${{ steps.dockerMetadata.outputs.tags }}
-
name: Run Tests
run: cd endToEndTests && SILO_URL=localhost:8080 npm run test