-
Notifications
You must be signed in to change notification settings - Fork 7
164 lines (140 loc) · 4.74 KB
/
lapis2.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
name: LAPIS v2
on: [ push ]
env:
DOCKER_IMAGE_NAME: ghcr.io/genspectrum/lapis-v2
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: Execute Tests
uses: gradle/gradle-build-action@v3
with:
arguments: test
build-root-directory: lapis2
- name: Check Format And Lint
uses: gradle/gradle-build-action@v3
with:
arguments: ktlintCheck
build-root-directory: lapis2
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
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: ./lapis2
tags: ${{ steps.dockerMetadata.outputs.tags }}
cache-from: type=gha,scope=lapis2-${{ github.ref }}
cache-to: type=gha,mode=max,scope=lapis2-${{ github.ref }}
platforms: ${{ github.ref == 'refs/heads/main' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
push: true
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: Build OpenAPI Spec
uses: gradle/gradle-build-action@v3
with:
arguments: generateOpenApiDocs
build-root-directory: lapis2
- name: Build OpenAPI Spec Protected
uses: gradle/gradle-build-action@v3
with:
arguments: generateOpenApiDocs -PopennessLevel=protected
build-root-directory: lapis2
- name: Cache .npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('siloLapisTests/**/package-lock.json') }}
- name: Prepare Tests
run: npm ci
working-directory: siloLapisTests
- name: Generate Lapis Client
run: npm run generateLapisClient
working-directory: siloLapisTests
- name: Generate Lapis Client Protected
run: npm run generateLapisClientProtected
working-directory: siloLapisTests
- name: Check Format
run: npm run check-format
working-directory: siloLapisTests
- 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 lapis2/docker-compose.yml pull
docker compose -f lapis2/docker-compose.yml up -d --wait
cd siloLapisTests && npm run test
env:
SILO_TAG: latest
LAPIS_TAG: ${{ steps.lapisBranchTag.outputs.lapisTag }}
- name: Store Logs
if: ${{ always() }}
run: |
cd lapis2
mkdir p e2e-logs
docker compose logs silo > e2e-logs/silo.log
docker compose logs lapisOpen > e2e-logs/lapisOpen.log
docker compose logs lapisProtected > e2e-logs/lapisProtected.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: lapis2/e2e-logs