Skip to content

Commit

Permalink
feat: auto-detect JAVA_HOME of java versions when running in GitHub…
Browse files Browse the repository at this point in the history
… Actions ☕️
  • Loading branch information
oldratlee committed Dec 6, 2023
1 parent 8e81911 commit 4461d6f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 22 deletions.
22 changes: 8 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,45 @@ jobs:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners
runs-on: ubuntu-latest
timeout-minutes: 10
name: test by multiply java versions
name: CI by multiply java versions

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: setup Java 8
- name: Setup Java 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: zulu
# only first java setup need enable cache
cache: maven
- name: setup Java 11
- name: Setup Java 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: microsoft
- name: setup Java 17
- name: Setup Java 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: microsoft
- name: setup Java 19
- name: Setup Java 19
uses: actions/setup-java@v4
with:
java-version: 19
distribution: temurin
- name: setup Java 21
- name: Setup Java 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: zulu

- name: run integration test
- name: Run integration test
run: scripts/integration_test && demos/scripts/integration_test
env:
JAVA8_HOME: ${{ env.JAVA_HOME_8_X64 }}
JAVA11_HOME: ${{ env.JAVA_HOME_11_X64 }}
JAVA17_HOME: ${{ env.JAVA_HOME_17_X64 }}
JAVA19_HOME: ${{ env.JAVA_HOME_19_X64 }}
JAVA21_HOME: ${{ env.JAVA_HOME_21_X64 }}

- name: remove self maven install files
- name: Remove self maven install files
run: rm -rf $HOME/.m2/repository/io/foldright/cffu*

- name: Upload coverage reports to Codecov
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/fast_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-github-hosted-runners
runs-on: ${{ matrix.os }}
timeout-minutes: 5
name: fast test on OS ${{ matrix.os }}
name: fast CI on OS ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
Expand All @@ -18,29 +18,29 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: setup Java 19
- name: Setup Java 19
uses: actions/setup-java@v4
with:
java-version: 19
distribution: temurin
# only first java setup need enable cache
cache: maven
- name: build and test with Java 19
- name: Build and test with Java 19
run: ./mvnw -V --no-transfer-progress clean install

- name: setup Java 8
- name: Setup Java 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: zulu
- name: test with Java 8
- name: Test with Java 8
run: ./mvnw -V --no-transfer-progress surefire:test

- name: 'remove self maven install files(OS: *nix)'
- name: 'Remove self maven install files(OS: *nix)'
run: rm -rf $HOME/.m2/repository/io/foldright/cffu*
# https://docs.github.com/en/actions/learn-github-actions/expressions
# https://docs.github.com/en/actions/learn-github-actions/variables#detecting-the-operating-system
if: runner.os != 'Windows'
- name: 'remove self maven install files(OS: Windows)'
- name: 'Remove self maven install files(OS: Windows)'
run: Remove-Item -Recurse -Force $home/.m2/repository/io/foldright/cffu*
if: runner.os == 'Windows'
2 changes: 1 addition & 1 deletion scripts/bash-buddy
Submodule bash-buddy updated 1 files
+29 −0 lib/java_utils.sh

0 comments on commit 4461d6f

Please sign in to comment.