Skip to content

Commit

Permalink
Add Windows to GitHub Actions workflow
Browse files Browse the repository at this point in the history
Co-Authored-By: marko-bekhta <marko.prykladna@gmail.com>
  • Loading branch information
yrodiere and marko-bekhta committed Sep 19, 2023
1 parent e78126f commit 01068ee
Showing 1 changed file with 33 additions and 13 deletions.
46 changes: 33 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# 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.
# 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.

Expand Down Expand Up @@ -36,25 +38,43 @@ env:
MAVEN_ARGS: "-e -B --settings .github/mvn-settings.xml --fail-at-end"
jobs:
build:
name: Linux - JDK 17
runs-on: ubuntu-latest
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@v4
- name: Set up Java 17
- name: Set up Java ${{ matrix.os.java.version }}
uses: actions/setup-java@v1
with:
java-version: 17
- 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
java-version: ${{ matrix.os.java.version }}
# https://github.com/actions/cache/blob/main/examples.md#java---maven
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
# refresh cache every week to avoid unlimited growth
key: ${{ steps.m2-cache-key.outputs.key }}
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up Maven
run: ./mvnw -v
- name: Docker cleanup
Expand Down

0 comments on commit 01068ee

Please sign in to comment.