Skip to content

Add support for Sentry monitoring #253

Add support for Sentry monitoring

Add support for Sentry monitoring #253

Workflow file for this run

# Continuous integration, including test and integration test
name: CI
# Run in master and dev branches and in all pull requests to those branches
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
env:
DOCKER_IMAGE: radarbase/radar-gateway
jobs:
# Build and test the code
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
# Compile the code
- name: Compile code
run: ./gradlew assemble
# Gradle check
- name: Check
run: ./gradlew check
# Check that the docker image builds correctly
docker:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Add Docker labels and tags
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ${{ env.DOCKER_IMAGE }}
# Setup docker build environment
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
id: cache-buildx
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: Cache parameters
id: cache-parameters
run: |
if [ "${{ steps.cache-buildx.outputs.cache-hit }}" = "true" ]; then
echo "cache-to=" >> $GITHUB_OUTPUT
else
echo "cache-to=type=local,dest=/tmp/.buildx-cache-new,mode=max" >> $GITHUB_OUTPUT
fi
- name: Build docker
uses: docker/build-push-action@v3
with:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: ${{ steps.cache-parameters.outputs.cache-to }}
load: true
context: .
tags: ${{ steps.docker_meta.outputs.tags }}
# Use runtime labels from docker_meta as well as fixed labels
labels: |
${{ steps.docker_meta.outputs.labels }}
maintainer=Bastiaan de Graaf <bastiaan@thehyve.nl>
org.opencontainers.image.authors=Bastiaan de Graaf <bastiaan@thehyve.nl>
org.opencontainers.image.vendor=RADAR-base
org.opencontainers.image.licenses=Apache-2.0
- name: Inspect docker image
run: docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
- name: Check docker image
run: docker run --rm ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} curl --help
# Push the image on the dev and master branches
- name: Push image
if: ${{ github.event_name != 'pull_request' }}
run: docker push ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move docker build cache
if: steps.cache-buildx.outputs.cache-hit != 'true'
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
# Gradle check
- name: Integration test
run: |
echo "RADAR_GATEWAY_TAG=${{ steps.docker_meta.outputs.version }}" >> radar-gateway/src/integrationTest/docker/.env
./gradlew composeUp -PdockerComposeBuild=false
sleep 15
./gradlew integrationTest -PdockerComposeBuild=false
- uses: actions/upload-artifact@v3
if: always()
with:
name: integration-test-logs
path: build/container-logs/
retention-days: 7