From c2116966f8ec0028011a419f259679f6617fd4e0 Mon Sep 17 00:00:00 2001 From: Holger Bruch Date: Sat, 27 Jul 2024 15:38:52 +0200 Subject: [PATCH] build image for branch aachen --- .github/workflows/mfdzbuild.yml | 66 +++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/mfdzbuild.yml diff --git a/.github/workflows/mfdzbuild.yml b/.github/workflows/mfdzbuild.yml new file mode 100644 index 00000000000..89243d5504d --- /dev/null +++ b/.github/workflows/mfdzbuild.yml @@ -0,0 +1,66 @@ +name: MFDZ OTP CI Build +on: + push: + branches: + - aachen +jobs: + build-linux: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + # Starting in v2.2 checkout action fetches all tags when fetch-depth=0, for auto-versioning. + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # nodejs is needed because the dynamic download of it via the prettier maven plugin often + # times out + # Example: https://github.com/opentripplanner/OpenTripPlanner/actions/runs/4490450225/jobs/7897533439 + - uses: actions/setup-node@v4 + with: + node-version: 18 + + # Java setup step completes very fast, no need to run in a preconfigured docker container + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: temurin + cache: maven + + - name: Prepare coverage agent, build and test + # these are split into two steps because otherwise maven keeps long-running HTTP connections + # to Maven Central open which then hang during the package phase because the Azure (Github Actions) + # NAT drops them + # https://github.com/actions/runner-images/issues/1499 + # we set nodePath and npmPath to skip downloading the node binary, which frequently times out + run: | + mvn --batch-mode jacoco:prepare-agent test jacoco:report -P prettierCheck -Dprettier.nodePath=node -Dprettier.npmPath=npm + mvn --batch-mode package -Dmaven.test.skip -P prettierSkip + + - name: set up Docker buildx + uses: docker/setup-buildx-action@v3 + + - name: log into the GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + + - name: set date-based tag + run: | + echo "DATE_TAG=$(date +%Y-%m-%dT%H-%M)" >> $GITHUB_ENV + + - name: build and push Docker image + if: github.event_name == 'push' && (github.ref == 'refs/heads/aachen') + uses: docker/build-push-action@v6 + with: + push: true + tags: | + ghcr.io/${{ github.repository }}:${{ github.ref }} + ghcr.io/${{ github.repository }}:${{ github.ref }}-${{ env.DATE_TAG }} + platforms: linux/amd64,linux/arm64 + # https://docs.docker.com/build/ci/github-actions/cache/#cache-backend-api + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file