-
Notifications
You must be signed in to change notification settings - Fork 7
185 lines (157 loc) · 5.77 KB
/
lapis.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
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
name: LAPIS
on: [ push ]
env:
DOCKER_IMAGE_NAME: ghcr.io/genspectrum/lapis
jobs:
Tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'adopt'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Execute Tests
working-directory: lapis
run: ./gradlew test
- name: Check Format And Lint
working-directory: lapis
run: ./gradlew ktlintCheck
dockerImage:
name: Build Docker Image
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: Docker metadata
id: dockerMetadata
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_IMAGE_NAME }}
tags: |
type=ref,event=branch,enable=${{ github.ref != format('refs/heads/{0}', 'main') }}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
- name: Build application image
uses: docker/build-push-action@v6
with:
context: ./lapis
tags: ${{ steps.dockerMetadata.outputs.tags }}
cache-from: type=gha,scope=lapis-${{ github.ref }}
cache-to: type=gha,mode=max,scope=lapis-${{ github.ref }}
platforms: ${{ github.ref == 'refs/heads/main' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
push: false
- name: Build and push versioned image
uses: docker/build-push-action@v6
with:
context: ./lapis
file: ./lapis/Dockerfile_versionSupplier
tags: ${{ steps.dockerMetadata.outputs.tags }}
platforms: ${{ github.ref == 'refs/heads/main' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
push: true
build-args: |
BASE_IMAGE=${{ steps.dockerMetadata.outputs.tags }}
VERSION=${{ github.sha }}
endToEndTests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'adopt'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build OpenAPI Spec
working-directory: lapis
run: ./gradlew generateOpenApiDocs
- name: Build OpenAPI Spec Protected
working-directory: lapis
run: ./gradlew generateOpenApiDocs -PopennessLevel=protected
- name: Build OpenAPI Spec Multi segmented
working-directory: lapis
run: ./gradlew generateOpenApiDocs -Psegmented=true
- name: Cache .npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('lapis-e2e/**/package-lock.json') }}
- name: Prepare Tests
run: npm ci
working-directory: lapis-e2e
- name: Generate Lapis Client
run: npm run generateLapisClient
working-directory: lapis-e2e
- name: Generate Lapis Client Protected
run: npm run generateLapisClientProtected
working-directory: lapis-e2e
- name: Generate Lapis Client Multi Segmented
run: npm run generateLapisClientMultiSegmented
working-directory: lapis-e2e
- name: Check Format
run: npm run check-format
working-directory: lapis-e2e
- name: Docker metadata
id: dockerMetadata
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_IMAGE_NAME }}
tags: |
type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
- name: Get LAPIS Branch Tag
id: lapisBranchTag
env:
TAG: ${{ steps.dockerMetadata.outputs.tags }}
run: echo "lapisTag=${TAG##*:}" >> $GITHUB_OUTPUT
- name: Wait for Docker Image
uses: lewagon/wait-on-check-action@v1.3.4
with:
ref: ${{ github.ref }}
check-name: Build Docker Image
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Start SILO and LAPIS and Run Tests
run: |
docker compose -f lapis/docker-compose.yml pull
docker compose -f lapis/docker-compose.yml up -d --wait
cd lapis-e2e && npm run test
env:
SILO_TAG: latest
LAPIS_TAG: ${{ steps.lapisBranchTag.outputs.lapisTag }}
- name: Store Logs
if: ${{ always() }}
run: |
cd lapis
mkdir p e2e-logs
docker compose logs silo > e2e-logs/silo.log
docker compose logs siloPreprocessing > e2e-logs/siloPreprocessing.log
docker compose logs siloMultisegmented > e2e-logs/siloMultisegmented.log
docker compose logs siloPreprocessingMultisegmented > e2e-logs/siloPreprocessingMultisegmented.log
docker compose logs lapisOpen > e2e-logs/lapisOpen.log
docker compose logs lapisProtected > e2e-logs/lapisProtected.log
docker compose logs lapisMultiSegmented > e2e-logs/lapisMultiSegmented.log
env:
SILO_TAG: latest
LAPIS_TAG: ${{ steps.lapisBranchTag.outputs.lapisTag }}
- name: Upload logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: logs
path: lapis/e2e-logs