Restore GitHub Actions workflow and build on Windows #1
Workflow file for this run
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 build on Windows | |
# and check that both the Linux and Windows workflows still work | |
# and can be used in GitHub forks. | |
# See https://docs.github.com/en/actions | |
# for more information about GitHub actions. | |
name: Hibernate Search GitHub Actions Build | |
on: | |
push: | |
branches: | |
- '!3.*' | |
- '!4.*' | |
- '!5.*' | |
- '!dependabot/maven/**' | |
- '**' | |
tags: | |
- '**' | |
pull_request: | |
branches: | |
- '!3.*' | |
- '!4.*' | |
- '!5.*' | |
# Ignore dependabot PRs that are not just about build dependencies; | |
# we'll reject such dependant PRs and send a PR ourselves. | |
- 'dependabot/maven/build-dependencies-**' | |
- '!dependabot/maven/**' | |
- '**' | |
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: | |
MAVEN_ARGS: "-e -B --settings .github/mvn-settings.xml --fail-at-end" | |
jobs: | |
build: | |
name: ${{matrix.os.name}} | |
runs-on: ${{ matrix.os.runs-on }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- { | |
name: "Linux JDK 17", | |
runs-on: 'ubuntu-latest', | |
java: { | |
version: 17 | |
} | |
} | |
- { | |
name: "Windows JDK 17", | |
runs-on: 'windows-latest', | |
java: { | |
version: 17 | |
} | |
} | |
steps: | |
- name: Support longpaths on Windows | |
if: "startsWith(matrix.os.runs-on, 'windows')" | |
run: git config --global core.longpaths true | |
- uses: actions/checkout@v2 | |
- name: Set up Java ${{ matrix.os.java.version }} | |
uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.os.java.version }} | |
- name: Generate .m2 cache key | |
id: m2-cache-key | |
run: | | |
echo "key=m2-cache-$(/bin/date -u "+%Y-%U")" >> $GITHUB_OUTPUT | |
- name: Cache Maven local repository | |
id: cache-maven | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
# refresh cache every week to avoid unlimited growth | |
key: ${{ steps.m2-cache-key.outputs.key }} | |
- name: Set up Maven | |
run: ./mvnw -v | |
- name: Docker cleanup | |
run: ./ci/docker-cleanup.sh | |
- name: Building code and running unit tests and basic checks | |
run: ./mvnw $MAVEN_ARGS install -Pjqassistant -Pdist -Pci-sources-check -DskipITs | |
- name: Running integration tests in the default environment | |
run: | | |
./mvnw $MAVEN_ARGS verify \ | |
-DskipSurefireTests -Pskip-checks -Pci-rebuild \ | |
${{ github.event.pull_request.base.ref && format('-Dincremental -Dgib.referenceBranch={0}', github.event.pull_request.base.ref) || '' }} | |
- 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 | |
- name: Upload build reports (if build failed) | |
uses: actions/upload-artifact@v3 | |
if: ${{ failure() || cancelled() }} | |
with: | |
name: ${{ format('build-reports-{0}', github.job) }} | |
path: | | |
./**/*-reports/ | |
retention-days: 2 |