-
Notifications
You must be signed in to change notification settings - Fork 3
172 lines (154 loc) · 5.81 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Wave-cli builds
on:
push:
branches:
- '*'
- '!refs/tags/.*'
tags-ignore:
- '*'
pull_request:
types: [opened, reopened, synchronize]
branches:
- '*'
- '!refs/tags/.*'
tags-ignore:
- '*'
jobs:
build:
name: Wave on ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest-large, macos-latest-xlarge, windows-latest]
include:
- os: ubuntu-latest
fatjar: true
musl: true
- os: macos-latest-large
codesign: true
- os: macos-latest-xlarge
codesign: true
steps:
- name: Environment
run: env | sort
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
if: ${{ matrix.musl }}
with:
java-version: '21'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
native-image-musl: 'true'
- uses: graalvm/setup-graalvm@v1
if: ${{ !matrix.musl }}
with:
java-version: '21'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Run tests
run: |
./gradlew test
- name: Build fat JAR
if: ${{ matrix.fatjar }}
run: ./gradlew shadowJar
- name: Upload fat JAR artifact
if: ${{ matrix.fatjar }}
uses: actions/upload-artifact@v4
with:
name: wave-jar
path: ./app/build/libs/wave.jar
- name: Build static native
if: ${{ matrix.musl }}
run: ./gradlew app:nativeCompile
env:
PLATFORM: linux-x86_64
- name: Build native
if: ${{ !matrix.musl }}
run: ./gradlew app:nativeCompile
- name: Codesign binary
if: ${{ matrix.codesign && contains(github.event.head_commit.message, '[release]') && github.event.ref=='refs/heads/master'}}
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_CERTIFICATE_NAME: ${{ secrets.MACOS_CERTIFICATE_NAME }}
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.MACOS_CI_KEYCHAIN_PWD }}
run: |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain
/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime ./app/build/native/nativeCompile/wave -v
- name: Notarize binary
if: ${{ matrix.codesign && contains(github.event.head_commit.message, '[release]') && github.event.ref=='refs/heads/master'}}
env:
MACOS_AC_API_CERT: ${{ secrets.MACOS_AC_API_CERT }}
MACOS_AC_API_ISSUER_ID: ${{ secrets.MACOS_AC_API_ISSUER_ID }}
MACOS_AC_API_KEY_ID: ${{ secrets.MACOS_AC_API_KEY_ID }}
run: |
echo $MACOS_AC_API_CERT | base64 --decode > AuthKey.p8
xcrun notarytool store-credentials "notarytool-profile" -k AuthKey.p8 -d "$MACOS_AC_API_KEY_ID" -i "$MACOS_AC_API_ISSUER_ID"
ditto -c -k --keepParent "./app/build/native/nativeCompile/wave" "notarization.zip"
xcrun notarytool submit "notarization.zip" --keychain-profile "notarytool-profile" --wait
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
name: nativeCompile-${{ matrix.os }}
path: ./app/build/native/nativeCompile
- name: Publish tests report
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-reports-jdk-${{ matrix.java_version }}
path: |
**/build/reports/tests/test
release:
name: Release
if: "contains(github.event.head_commit.message, '[release]') && github.event.ref=='refs/heads/master'"
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all build artifacts
uses: actions/download-artifact@v4
- name: Setup Java for JReleaser
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'adopt'
- name: Version
id: version
run: |
VERSION=$(cat ./VERSION)
echo "VERSION=$VERSION"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Enable Homebrew for final release
run: |
VERSION=${{ steps.version.outputs.VERSION }}
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Homebrew release enabled."
echo "JRELEASER_PACKAGERS_BREW_ACTIVE=ALWAYS" >> $GITHUB_ENV
else
echo "Homebrew release disabled (pre-release detected)."
echo "JRELEASER_PACKAGERS_BREW_ACTIVE=NEVER" >> $GITHUB_ENV
fi
- name: Run JReleaser
uses: jreleaser/release-action@v2
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }}
JRELEASER_PROJECT_VERSION: ${{ steps.version.outputs.VERSION }}
JRELEASER_PACKAGERS_BREW_ACTIVE: ${{ env.JRELEASER_PACKAGERS_BREW_ACTIVE }}
- name: JReleaser release output
if: always()
uses: actions/upload-artifact@v4
with:
name: jreleaser-release
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
...