forked from HSLdevcom/OpenTripPlanner
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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 |