refine test a bit more, with a get raptor helper method #12
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: verify-push | |
on: | |
push: | |
branches-ignore: | |
- '14.x' # no need to run after merging to 14.x | |
tags-ignore: | |
- '*' # do not run on pushing tags (see deploy-on-release-created) | |
pull_request: | |
jobs: | |
build: | |
# run if push or pull_requests from fork | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
module: | |
- matsim | |
# sorted from longest to shortest (to minimise the overall test stage duration) | |
# (used in travis; not respected in GitHub Action workflows) | |
- contribs/vsp | |
- contribs/common | |
- contribs/taxi | |
- contribs/minibus | |
- contribs/signals | |
- contribs/bicycle | |
- contribs/cadytsIntegration | |
- contribs/drt | |
- contribs/discrete_mode_choice | |
- contribs/carsharing | |
- contribs/commercialTrafficApplications | |
- contribs/av | |
- contribs/locationchoice | |
- contribs/ev | |
- contribs/dvrp | |
- contribs/emissions | |
- contribs/decongestion | |
- contribs/noise | |
- contribs/accidents | |
- contribs/freight | |
- contribs/parking | |
- contribs/matrixbasedptrouter | |
- contribs/accessibility | |
- contribs/integration | |
- contribs/multimodal | |
- contribs/protobuf | |
- contribs/shared_mobility | |
- contribs/socnetsim | |
- contribs/sumo | |
- contribs/pseudosimulation | |
- contribs/roadpricing | |
- contribs/analysis | |
- contribs/eventsBasedPTRouter | |
- contribs/hybridsim | |
- contribs/otfvis | |
- contribs/osm | |
- contribs/application | |
- contribs/sbb-extensions | |
- benchmark | |
steps: | |
- name: Checkout git repo | |
uses: actions/checkout@v2 | |
- name: Detect changes against master | |
# we only want to build matsim (module) if changes are not limited to contribs | |
id: detect-changes | |
uses: dorny/paths-filter@v2 | |
if: ${{matrix.module == 'matsim'}} | |
with: | |
filters: | | |
outside-contribs: | |
- '!contribs/**' | |
- name: Cache local Maven repository | |
uses: actions/cache@v2 | |
if: ${{matrix.module != 'matsim' || steps.detect-changes.outputs.outside-contribs == 'true'}} | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Setup Java | |
if: ${{matrix.module != 'matsim' || steps.detect-changes.outputs.outside-contribs == 'true'}} | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
- name: Build module (with dependencies) | |
if: ${{matrix.module != 'matsim' || steps.detect-changes.outputs.outside-contribs == 'true'}} | |
run: mvn install --batch-mode --also-make --projects ${{matrix.module}} -DskipTests -Dsource.skip | |
- name: Test module | |
if: ${{matrix.module != 'matsim' || steps.detect-changes.outputs.outside-contribs == 'true'}} | |
run: mvn verify --batch-mode -Dmaven.test.redirectTestOutputToFile -Dmatsim.preferLocalDtds=true --fail-at-end -Dsource.skip | |
working-directory: ${{matrix.module}} | |
env: | |
MAVEN_OPTS: -Xmx2g | |
verify-all-jobs-successful: | |
# always() - to ensure this job is executed (regardless of the status of the previous job) | |
# run if push or pull_requests from fork | |
if: always() && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) | |
needs: build | |
runs-on: ubuntu-latest | |
# When running this workflow for internal PRs "verify-all-jobs-successful" is marked as skipped, | |
# which GitHub takes as a green flag and will allow merging before "verify-all-jobs-successful" | |
# is completed for the push event. | |
# One way to avoid this is to create a job from a matrix on the fly. They will be created for | |
# push events and PR events from forks (but not for PR events coming from internal forks), | |
# so we can safely add a check "verify-all-jobs-successful (push-or-external-PR)" | |
strategy: | |
matrix: | |
name: [ "push-or-external-PR" ] | |
steps: | |
- name: check if the whole job matrix is successful | |
if: needs.build.result != 'success' | |
run: exit 1 # fail if "build" was not successful |