-
-
Notifications
You must be signed in to change notification settings - Fork 44
92 lines (78 loc) · 2.93 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Build
env:
GRAALCE_JDK_VERSION: '17.0.9'
# concatenation of env variables isn't currently supported
# so need to specify version explicitly
GRAALVM_HOME: /opt/hostedtoolcache/Java_graalce_jdk/17.0.9/x64
on:
push:
branches:
- master
pull_request:
jobs:
libs:
name: test and build libs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# we need both because graal plugin in cli-bot requires jdk version >= 11
# more details in CONTRIBUTING
- name: Set up JDK 8 and 17
uses: actions/setup-java@v4
with:
java-version: |
8
17
distribution: 'temurin'
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v2
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
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
with:
fetch-depth: 0
# 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"
echo "$latest_jdk_download_url"
curl -Ls "$latest_jdk_download_url" -o java_package.tar.gz
echo "java_version=$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.java_version }}
architecture: x64
mvn-toolchain-vendor: GraalVM
mvn-toolchain-id: graalce-${{ env.GRAALCE_JDK_VERSION }}
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v2
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Compile native image
run: ./gradlew nativeCompile -x test -x integrationTest
- name: Test native image
run: |
_app_path=$(find ./cli-bot/build/native/nativeCompile/ -type f -name faker-bot\* -not -name \*.txt)
mv "$_app_path" $RUNNER_TEMP/faker-bot
# run several iterations to test various pathways when generating data
for i in {0..10}; do
${{ runner.temp }}/faker-bot list --verbose >/dev/null || false
${{ runner.temp }}/faker-bot lookup a --verbose >/dev/null || false
done