release-3.0.3 #209
This file contains hidden or 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
# Continuous integration, including test and integration test | |
name: CI | |
# Run in main and dev branches and in all pull requests to those branches | |
on: | |
push: | |
branches: [ main, dev ] | |
pull_request: | |
branches: [ main, dev ] | |
env: | |
REGISTRY: ghcr.io | |
REPOSITORY: ${{ github.repository }} | |
IMAGE_NAME: radar-output-restructure | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
# Compile the code | |
- name: Compile code | |
run: ./gradlew assemble | |
# Gradle check | |
- name: Check | |
run: ./gradlew check | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: integration-test-logs | |
path: build/container-logs/ | |
retention-days: 7 | |
# Check that the docker image builds correctly | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup docker build environment | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ hashFiles('Dockerfile', '**/*.gradle.kts', 'gradle.properties', 'src/main/**') }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Login to Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Lowercase image name | |
run: | | |
echo "DOCKER_IMAGE=${REGISTRY}/${REPOSITORY,,}/${IMAGE_NAME}" >>${GITHUB_ENV} | |
# Add Docker labels and tags | |
- name: Docker meta | |
id: docker_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.DOCKER_IMAGE }} | |
- name: Build docker image and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
load: true | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
# Use runtime labels from docker_meta as well as fixed labels | |
labels: | | |
${{ steps.docker_meta.outputs.labels }} | |
maintainer=Pim van Nierop <[email protected]> | |
org.opencontainers.image.authors=Pim van Nierop <[email protected]> | |
org.opencontainers.image.vendor=RADAR-base | |
org.opencontainers.image.licenses=Apache-2.0 | |
- name: Inspect image | |
run: | | |
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} | |
docker run --rm ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} --help | |
# If the image was pushed, we need to pull it again to inspect it | |
- name: Push image | |
if: ${{ github.event_name != 'pull_request' }} | |
run: docker push ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |