Skip to content

Commit

Permalink
Fix gh workflows
Browse files Browse the repository at this point in the history
Use temurin distribution in actions/setup-java as recommended by the
action docs.

Split build.yml jobs into two since native image requires a custom java
setup step.

Update actions versions
  • Loading branch information
serpro69 committed Mar 10, 2024
1 parent 7e1da53 commit 9f99070
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 22 deletions.
67 changes: 55 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,79 @@
name: Build

env:
GRAALCE_JDK_VERSION: "17.0.9"

on:
push:
branches:
- master
pull_request:

jobs:
build:
libs:
name: test and build libs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v2
uses: actions/checkout@v4

- name: Set up JDK 8 and 17 # we need both because graal plugin in cli-bot requires jdk version >= 11
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'adopt'
java-version: |
8
17
distribution: 'temurin'

- name: Gradle Wrapper Validation
uses: gradle/[email protected]

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew clean test integrationTest build nativeCompile
run: ./gradlew clean test integrationTest build shadowJar

cli:
name: build and test native image
runs-on: ubuntu-latest
needs: libs
steps:
- name: Checkout
uses: actions/checkout@v4

# loosely based on https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#installing-java-from-local-file
- name: Fetch latest graalce JDK
id: fetch_latest_jdk
run: |
jdk_version="{{ env.GRAALCE_JDK_VERSION }}"
echo $jdk_version
cd $RUNNER_TEMP
latest_jdk_download_url="https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${jdk_version}/graalvm-community-jdk-${jdk_version}_linux-x64_bin.tar.gz"
curl -Ls "$latest_jdk_download_url" -o java_package.tar.gz
echo "$jdk_version" >> "$GITHUB_OUTPUT"
- name: Set up GraalCE JDK
uses: actions/setup-java@v4
with:
distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz
java-version: ${{ steps.fetch_latest_jdk.outputs.jdk_version }}
architecture: x64

- name: Gradle Wrapper Validation
uses: gradle/[email protected]

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Compile native image
run: ./gradlew nativeCompile
- name: Test native image
run: |
# run several iterations to test various pathways when generating data
for i in {0..10}; do
./cli-bot/build/native/nativeCompile/faker-bot list --verbose >/dev/null || false
./cli-bot/build/native/nativeCompile/faker-bot lookup a --verbose >/dev/null || false
./cli-bot/build/native/nativeCompile/faker-bot list --verbose >/dev/null || false
./cli-bot/build/native/nativeCompile/faker-bot lookup a --verbose >/dev/null || false
done
8 changes: 3 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'adopt'
distribution: 'temurin'
- name: Deploy Docs
run: make deploy-docs
env:
Expand Down
29 changes: 24 additions & 5 deletions .github/workflows/publish_snapshot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Publish Snapshot

env:
GRAALCE_JDK_VERSION: "17.0.9"

on:
push:
branches:
Expand Down Expand Up @@ -28,14 +31,30 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
# loosely based on https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#installing-java-from-local-file
- name: Fetch latest graalce JDK
id: fetch_latest_jdk
run: |
jdk_version="{{ env.GRAALCE_JDK_VERSION }}"
cd $RUNNER_TEMP
latest_jdk_download_url="https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-${jdk_version}/graalvm-community-jdk-${jdk_version}_linux-x64_bin.tar.gz"
curl -Ls "$latest_jdk_download_url" -o java_package.tar.gz
echo "$jdk_version" >> "$GITHUB_OUTPUT"
- name: Set up GraalCE JDK
uses: actions/setup-java@v4
with:
fetch-depth: 0
distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz
java-version: ${{ steps.fetch_latest_jdk.outputs.jdk_version }}
architecture: x64
- name: Set up JDK 8
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'adopt'
java-version: |
8
17
distribution: 'temurin'
- name: Gradle Wrapper Validation
uses: gradle/[email protected]
- name: Grant execute permission to scripts
Expand Down

0 comments on commit 9f99070

Please sign in to comment.