-
Notifications
You must be signed in to change notification settings - Fork 447
126 lines (113 loc) · 4.4 KB
/
verify-push.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: verify-push
on:
push:
branches-ignore:
- 'master' # no need to run after merging to master
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
timeout-minutes: 45
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/drt-extensions
- 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/freightreceiver
- contribs/parking
- contribs/matrixbasedptrouter
- contribs/accessibility
- contribs/integration
- contribs/multimodal
- contribs/protobuf
- contribs/shared_mobility
- contribs/socnetsim
- contribs/sumo
- contribs/pseudosimulation
- contribs/railsim
- contribs/roadpricing
- contribs/analysis
- contribs/hybridsim
- contribs/informed-mode-choice
- contribs/otfvis
- contribs/osm
- contribs/application
- contribs/simwrapper
- contribs/sbb-extensions
- contribs/simulatedannealing
- contribs/small-scale-traffic-generation
- benchmark
steps:
- name: Checkout git repo
uses: actions/checkout@v4
- 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@v3
if: ${{matrix.module == 'matsim'}}
with:
filters: |
outside-contribs:
- '!contribs/**'
- name: Setup Java
if: ${{matrix.module != 'matsim' || steps.detect-changes.outputs.outside-contribs == 'true'}}
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'zulu'
cache: 'maven'
- 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