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
# The main CI of Hibernate Search is https://ci.hibernate.org/job/hibernate-search/. | |
# However, Hibernate Search builds run on GitHub actions regularly | |
# to check that it still works and can be used in GitHub forks. | |
# See https://docs.github.com/en/free-pro-team@latest/actions | |
# for more information about GitHub actions. | |
name: Hibernate Search simple build | |
on: | |
push: | |
branches-ignore: | |
- '5.*' | |
- '4.*' | |
- '3.*' | |
tags: '*' | |
pull_request: | |
branches-ignore: | |
- '5.*' | |
- '4.*' | |
- '3.*' | |
concurrency: | |
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}" | |
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'hibernate/hibernate-search' }} | |
env: | |
# Timeouts during download a a real issue on GitHub Actions, because the default timeout is 15 *minutes*, | |
# so even if Maven retries 3 times, a few timeouts can quickly take the build past the 6 hour limit. | |
# We use two strategies to try to avoid timeout issues: | |
# 1. Custom Maven settings that use a Maven Central mirror instead of Maven Central itself; | |
# the mirror seems more reliable than Maven Central itself and leads to fewer timeouts. | |
# 2. Maven Wagon options that are supposed to work around a problem on GitHub Actions' hosting platform, Azure. | |
# To be honest this doesn't seem to work (at least not completely), but it doesn't hurt either. | |
# See https://github.com/actions/virtual-environments/issues/1499#issuecomment-689467080 | |
# See https://github.com/actions/virtual-environments/issues/1499#issuecomment-718396233 | |
# See https://github.com/apache/pulsar/blob/60ef5e983e5e8956bd0b602b5741bd6255c6258a/.github/workflows/ci-unit.yaml#L30 | |
# See https://github.com/apache/pulsar/commit/9405e6bfcba250f014faae6ba0490a8045cb4674 | |
MAVEN_ARGS: "-e -B --settings .github/mvn-settings.xml -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.count=3" | |
jobs: | |
build: | |
name: Build and test on Java 11 | |
runs-on: ubuntu-latest | |
# Ignore dependabot PRs; we'll batch dependency upgrades manually in a single PR before we test them. | |
if: github.actor != 'dependabot[bot]' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Java 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Get year/month for cache key | |
id: get-date | |
run: | | |
echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")" | |
shell: bash | |
- name: Cache Maven local repository | |
uses: actions/cache@v2 | |
id: cache-maven | |
with: | |
path: ~/.m2/repository | |
# refresh cache every month to avoid unlimited growth | |
key: maven-localrepo-${{ steps.get-date.outputs.yearmonth }} | |
- name: Set up Maven | |
run: ./mvnw -v | |
- name: Docker cleanup | |
run: ./ci/docker-cleanup.sh | |
- name: Build and test | |
run: ./mvnw $MAVEN_ARGS install -Pdist -Pcoverage -Pjqassistant | |
- name: Upload test reports (if Maven failed) | |
uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: test-reports-java11 | |
path: './**/*-reports/' | |
- name: Docker cleanup | |
if: always() | |
run: ./ci/docker-cleanup.sh | |
- name: Omit produced artifacts from build cache | |
run: rm -r ~/.m2/repository/org/hibernate/search |