Skip to content

Commit

Permalink
build image for branch aachen
Browse files Browse the repository at this point in the history
  • Loading branch information
hbruch committed Jul 27, 2024
1 parent e9d28f5 commit c211696
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/mfdzbuild.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c211696

Please sign in to comment.