Skip to content

refactor: address PR feedback #106

refactor: address PR feedback

refactor: address PR feedback #106

Workflow file for this run

name: Java CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v1
- name: Inject slug/short variables # so that we can reference $GITHUB_HEAD_REF_SLUG for branch name
uses: rlespinasse/[email protected]
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
# Install node 20.11.0 (LTS) for running maven-semantic-release.
- name: Use Node.js 20.X
uses: actions/setup-node@v1
with:
node-version: 20.11.0
- name: Install maven-semantic-release
# FIXME: Enable cache for node packages (add package.json?)
run: |
node --version
yarn global add @conveyal/maven-semantic-release semantic-release
# Add yarn path to GITHUB_PATH so that global package is executable.
echo "$(yarn global bin)" >> $GITHUB_PATH
- name: Setup Maven Cache
uses: actions/cache@v2
id: cache
with:
path: ~/.m2
key: maven-local-repo
- name: Build with Maven
run: mvn --no-transfer-progress package
- name: Clear contents of the target directory
# Avoids issues where maven-semantic-release attempts to upload
# multiple versions/builds (and fails due to the pre-existence of the version on maven central).
run: rm -rf target/*
# run maven-semantic-release to potentially create a new release of gtfs-lib.
#
# If maven-semantic-release finishes successfully and the current branch is master, upload coverage reports for the
# commits that maven-semantic-release generated. Since the above codecov run is associated with the commit that
# initiated the Travis build, the report will not be associated with the commits that maven-semantic-release performed
# (if it ended up creating a release and the two commits that were a part of that workflow). Therefore, if on master
# codecov needs to be ran two more times to create codecov reports for the commits made by maven-semantic-release.
# See https://github.com/conveyal/gtfs-lib/issues/193.
#
# The git commands get the commit hash of the HEAD commit and the commit just before HEAD.
# Install node 14+ for running maven-semantic-release.
- name: Use Node.js 20.X
uses: actions/setup-node@v1
with:
node-version: 20.11.0
- name: Run maven-semantic-release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
node --version
semantic-release --prepare @conveyal/maven-semantic-release --publish @semantic-release/github,@conveyal/maven-semantic-release --verify-conditions @semantic-release/github,@conveyal/maven-semantic-release --verify-release @conveyal/maven-semantic-release --use-conveyal-workflow --dev-branch=dev --skip-maven-deploy