-
Notifications
You must be signed in to change notification settings - Fork 75
54 lines (54 loc) · 2.1 KB
/
gradle.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
name: Java CI
# On [push, pull_request] causes double-builds when creating PRs.
# But triggering on push only will miss pull requests from outside authors.
on:
# Should catch merged pull requests, pushes to Conveyal PR branches, and tags.
# The push event's ref reveals the branch name for S3 upload, unlike pull_request which sees the merge target.
push
# Try to catch PRs from outside authors, which don't need to be uploaded to S3.
# pull_request:
# branches:
# - dev
# - master
jobs:
build:
runs-on: ubuntu-latest
# Start a separate docker container that we can contact over TCP (for tests)
# Apparently there's something tricky going on with the port binding though
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idservices
services:
mongodb:
image: mongo:latest
ports:
- 27017:27017
# You can specify a docker container on which to run steps, rather than on the metal of runs-on above.
# container:
# image: mherwig/docker-alpine-java-mongo:latest
# env:
# BUILD_TARGET:staging
steps:
# Starting in v2.2 checkout action fetches all tags when fetch-depth=0, for auto-versioning.
- uses: actions/checkout@v3
with:
fetch-depth: 0
# Java setup step completes very fast, no need to run in a preconfigured docker container.
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 21
cache: gradle
- name: Show version string
run: gradle -q printVersion | head -n1
- name: Build and test
run: gradle build
# Check that build product is able to start up as a backend server before handing it to end-to-end testing
- name: Ensure backend runnable
run: |
cp analysis.properties.template analysis.properties
gradle testRunnable -x test
- name: Publish to GH Packages
# Supply access token to build.gradle (used in publishing.repositories.maven.credentials)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gradle publish