Merge branch 'ui-dataset-citations' of https://github.com/pathoplexus… #2630
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: backend | |
on: | |
push: | |
env: | |
DOCKER_IMAGE_NAME: ghcr.io/pathoplexus/backend | |
defaults: | |
run: | |
working-directory: ./backend | |
concurrency: | |
group: ci-${{ github.ref }}-backend | |
cancel-in-progress: true | |
jobs: | |
Tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 20 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '20' | |
distribution: 'adopt' | |
- name: Execute Tests | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: test | |
build-root-directory: ./backend | |
- name: Check Format And Lint | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: ktlintCheck | |
build-root-directory: ./backend | |
dockerImage: | |
name: Build Backend Docker Image | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
checks: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 20 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '20' | |
distribution: 'adopt' | |
- 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 != 'refs/heads/main' }} | |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | |
- name: Build Docker Image For Branch | |
uses: gradle/gradle-build-action@v2 | |
env: | |
USER: ${{ github.actor }} | |
TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
with: | |
arguments: bootBuildImage --imageName=${{ steps.dockerMetadata.outputs.tags }} | |
build-root-directory: ./backend | |
- name: Push Docker Image For Branch | |
run: docker push ${{ steps.dockerMetadata.outputs.tags }} | |