fix/resting-heart-rate-offset #324
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: Main test | |
| # Run in master and dev branches and in all pull requests to those branches | |
| on: | |
| push: | |
| branches: [ master, dev ] | |
| pull_request: | |
| branches: [ master, dev ] | |
| env: | |
| REGISTRY: ghcr.io | |
| REPOSITORY: ${{ github.repository }} | |
| IMAGES: >- | |
| [{ | |
| 'name': 'kafka-connect-fitbit-source', | |
| 'build_file': 'kafka-connect-fitbit-source/Dockerfile', | |
| 'authors': 'Pim van Nierop <[email protected]>, Pauline Conde <[email protected]>', | |
| 'description': 'RADAR-base Fitbit connector application' | |
| },{ | |
| 'name': 'kafka-connect-oura-source', | |
| 'build_file': 'kafka-connect-oura-source/Dockerfile', | |
| 'authors': 'Pim van Nierop <[email protected]>, Pauline Conde <[email protected]>', | |
| 'description': 'RADAR-base Oura connector application' | |
| }] | |
| jobs: | |
| # Build and test the code | |
| kotlin: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Compile code | |
| run: ./gradlew assemble | |
| # Gradle check | |
| - name: Check | |
| run: ./gradlew check | |
| prepare-matrix: | |
| name: Prepare Matrix Output | |
| permissions: {} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| images: ${{ steps.step1.outputs.matrix }} | |
| steps: | |
| - name: Create Matrix Variable | |
| id: step1 | |
| run: echo "matrix=${{ env.IMAGES }}" >> $GITHUB_OUTPUT | |
| # Build and push tagged release backend docker image | |
| docker: | |
| needs: prepare-matrix | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| image: ${{ fromJson(needs.prepare-matrix.outputs.images ) }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| # Setup docker build environment | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Cache layers | |
| id: cache-buildx | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/.buildx-cache | |
| key: ${{ runner.os }}-buildx-s3-${{ hashFiles(matrix.image.build_file, '**/*.gradle', 'gradle.properties', '.dockerignore', '*/src/main/**', 'docker/**') }} | |
| restore-keys: | | |
| ${{ runner.os }}-buildx-s3- | |
| ${{ runner.os }}-buildx- | |
| - name: Cache parameters | |
| id: cache-parameters | |
| run: | | |
| if [ "${{ steps.cache-buildx.outputs.cache-hit }}" = "true" ]; then | |
| echo "cache-to=" >> $GITHUB_OUTPUT | |
| echo "load-cache-from=type=local,src=/tmp/.buildx-cache" >> $GITHUB_OUTPUT | |
| else | |
| echo "cache-to=type=local,dest=/tmp/.buildx-cache-new,mode=max" >> $GITHUB_OUTPUT | |
| echo "load-cache-from=type=local,src=/tmp/.buildx-cache-new" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Login to Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Lowercase image name | |
| run: | | |
| echo "DOCKER_IMAGE=${REGISTRY}/${REPOSITORY,,}/${{ matrix.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 and optionally push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ${{ matrix.image.build_file }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=local,src=/tmp/.buildx-cache | |
| cache-to: ${{ steps.cache-parameters.outputs.cache-to }} | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.docker_meta.outputs.tags }} | |
| labels: | | |
| ${{ steps.docker_meta.outputs.labels }} | |
| - name: Build docker using cache and load | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ${{ matrix.image.build_file }} | |
| cache-from: ${{ steps.cache-parameters.outputs.load-cache-from }} | |
| load: true | |
| tags: ${{ steps.docker_meta.outputs.tags }} | |
| # 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 |