-
Notifications
You must be signed in to change notification settings - Fork 4
72 lines (59 loc) · 2.57 KB
/
CI.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
name: Java CI with Gradle
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
strategy:
matrix:
java-version: [ '17', '18', '19', '20', '21', '22', '23' ]
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
# Strip -ea off of java-version for build-time use
- name: Strip java-version postfix
id: strip
env:
JAVA_VERSION: ${{ matrix.java-version }}
run: |
echo "java-version=${JAVA_VERSION%-ea}" >> $GITHUB_OUTPUT
# Gradle 8.X no longer uses a default repository for toolchains.
# Ref: https://docs.gradle.org/current/userguide/upgrading_version_7.html#using_automatic_toolchain_downloading_without_having_a_repository_configured
# Always preload toolchain JDK
- name: Preload JDK ${{ matrix.java-version }}
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: ${{ matrix.java-version }}
distribution: 'oracle'
# This is the JDK gradle will use since gradle does not always support the -ea version
- name: Set up JDK 17
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: '17'
distribution: 'oracle'
cache: gradle
- name: Toolchain debug
run: |
./gradlew -q javaToolchains
- name: Build application
run: |
./gradlew io.openliberty.java.internal_fat_${{ steps.strip.outputs.java-version }}:build
- name: Verify application
run: |
./.github/workflows/scripts/verifyArtifact.sh ${{ steps.strip.outputs.java-version }}
- name: Repackage application
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
./.github/workflows/scripts/repackageApplication.sh io.openliberty.java.internal_fat_${{ steps.strip.outputs.java-version }}/build/libs/io.openliberty.java.internal_fat_${{ steps.strip.outputs.java-version }}.war .jar
- name: Upload application
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: io.openliberty.java.internal_fat_${{ steps.strip.outputs.java-version }}
path: io.openliberty.java.internal_fat_${{ steps.strip.outputs.java-version }}/build/libs/io.openliberty.java.internal_fat_${{ steps.strip.outputs.java-version }}.jar
if-no-files-found: error