Update Dockerfile #1305
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: 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 |