forked from opentripplanner/OpenTripPlanner
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (81 loc) · 3.24 KB
/
cibuild.yml
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
name: OTP CI Build
# On [push, pull_request] causes double-builds when creating PRs.
# But triggering on push only will miss pull requests from outside authors.
# The push event's ref is the name of the pushed branch;
# The pull_request event's branch name is the merge target branch.
on:
push:
branches:
- master
- dev-1.x
- dev-2.x
pull_request:
branches:
- master
- dev-1.x
- dev-2.x
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
steps:
# Starting in v2.2 checkout action fetches all tags when fetch-depth=0, for auto-versioning.
- uses: actions/[email protected]
with:
fetch-depth: 0
# Java setup step completes very fast, no need to run in a preconfigured docker container
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
# on windows there are frequent failures caused by page files being too small
# https://github.com/actions/virtual-environments/issues/785
- name: Configure Windows Pagefile
if: matrix.os == 'windows-latest'
uses: al-cheb/[email protected]
- name: Prepare coverage agent, build and test
run: mvn --batch-mode --update-snapshots jacoco:prepare-agent verify jacoco:report -P prettierCheck
- name: Send coverage data to codecov.io
if: github.repository_owner == 'opentripplanner' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v2
with:
files: target/site/jacoco/jacoco.xml
- name: Deploy to Github Package Registry
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev-1.x' || github.ref == 'refs/heads/dev-2.x') && matrix.os == 'ubuntu-latest'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn --batch-mode deploy --settings maven-settings.xml -DskipTests -DGITHUB_REPOSITORY=$GITHUB_REPOSITORY -P prettierCheck
container-image:
if: github.repository_owner == 'opentripplanner' && github.event_name == 'push' && github.ref == 'refs/heads/dev-2.x'
runs-on: ubuntu-latest
needs: build
env:
CONTAINER_REPO: docker.io/opentripplanner/opentripplanner
CONTAINER_REGISTRY_USER: otpbot
CONTAINER_REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build container image with Jib, push to Dockerhub
run: mvn --batch-mode compile com.google.cloud.tools:jib-maven-plugin:build -Djib.to.tags=latest,${{ github.sha }}