try adding a version #441
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
- name: Build and push 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: 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: 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 |