Temporarilly remove OH Evaluator as it's patched locally #10
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
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 | |
container-image: | |
if: github.repository_owner == 'mfdz' && github.event_name == 'push' && (github.ref == 'refs/heads/aachen') | |
runs-on: ubuntu-latest | |
needs: | |
- build-linux | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: temurin | |
cache: maven | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Build container image with Jib, push to Dockerhub | |
env: | |
CONTAINER_REPO: docker.io/mfdz/opentripplanner | |
CONTAINER_REGISTRY_USER: ${{ secrets.DOCKER_USER }} | |
CONTAINER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_AUTH }} | |
run: | | |
# we give the container two tags | |
# - "aachen-latest" | |
# - a string like "aachen-2.3_2022-12-12T21-38" | |
version_with_snapshot=`mvn -q help:evaluate -Dexpression=project.version -q -DforceStdout` | |
version=${version_with_snapshot/-SNAPSHOT/} | |
image_version=${version} | |
## if the Maven version contains SNAPSHOT, then add date to tag | |
if [[ $version_with_snapshot == *"SNAPSHOT"* ]]; then | |
image_date=`date +%Y-%m-%dT%H-%M` | |
image_version="${version}_${image_date}" | |
echo "Maven version ${version_with_snapshot} contains SNAPSHOT, adding date to container image tag" | |
fi | |
mvn --batch-mode -P prettierSkip compile com.google.cloud.tools:jib-maven-plugin:build -Djib.to.tags=aachen-latest,aachen-$image_version |