-
-
Notifications
You must be signed in to change notification settings - Fork 5
186 lines (160 loc) · 6.22 KB
/
release.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Create a release of lmgrep
on:
push:
tags:
- 'v*'
jobs:
create-gh-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.RELEASE_VERSION }}
name: Release ${{ env.RELEASE_VERSION }}
body: |
See [CHANGELOG.md](https://github.com/dainiusjocas/lucene-grep/blob/main/CHANGELOG.md) for details.
If you are using macOS Catalina and later you may need to remove the quarantine attribute from the bits before you can use them. To do this, run the following:
```
sudo xattr -r -d com.apple.quarantine lmgrep
```
draft: true
compile-native-image-and-release-artifacts:
needs: create-gh-release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
include:
- os: ubuntu-latest
platform: linux
gu-binary: gu
arch: 'amd64'
- os: macos-latest
platform: macos
gu-binary: gu
arch: 'amd64'
steps:
- uses: actions/checkout@master
- name: Set env with the release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Setup Graalvm
id: setup-graalvm
uses: DeLaGuardo/setup-graalvm@master
with:
# GraalVM version, no pattern syntax available atm
graalvm: '21.3.0'
# Java version, optional, defaults to 'java8'. Available options are 'java8' and 'java11'.
java: 'java17'
# Architecture flag, optional, defaults to 'amd64'. Available options are 'amd64' and 'aarch64'. Later is available only for linux runners.
arch: ${{ matrix.arch }}
- name: Install native-image component
run: |
${{ matrix.gu-binary }} install native-image
- name: Install clojure tools-deps
uses: DeLaGuardo/setup-clojure@master
with:
tools-deps: 1.10.3.1058
- name: Compile uberjar
run: |
echo $RELEASE_VERSION > resources/LMGREP_VERSION
clojure -Spom
clojure -X:uberjar :jar target/lmgrep-uber.jar :main-class lmgrep.core
cp target/lmgrep-uber.jar target/lmgrep-${RELEASE_VERSION}-standalone.jar
- name: Upload uberjar to the release when on linux
if: ${{ matrix.platform == 'linux' }}
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.RELEASE_VERSION }}
name: Release ${{ env.RELEASE_VERSION }}
draft: true
files: |
target/lmgrep-*-standalone.jar
- name: Compile native image
run: |
LMGREP_STATIC=false bash script/compile
zip lmgrep-${RELEASE_VERSION}-${{ matrix.platform }}-${{ matrix.arch }}.zip lmgrep
- name: Setup MUSL and add relevant env variables on linux
if: ${{ matrix.platform == 'linux' }}
run: |
bash script/setup-musl
echo "TOOLCHAIN_DIR=$(pwd)/.musl/x86_64-linux-musl-native" >> $GITHUB_ENV
echo "PATH=$PATH:${TOOLCHAIN_DIR}/bin" >> $GITHUB_ENV
- name: Compile static native-image on linux
if: ${{ matrix.platform == 'linux' }}
run: |
PATH=$PATH:${TOOLCHAIN_DIR}/bin LMGREP_STATIC=true LMGREP_MUSL=true bash script/compile
zip lmgrep-${RELEASE_VERSION}-${{ matrix.platform }}-${{ matrix.arch }}-static.zip lmgrep
- name: Upload binaries to the release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.RELEASE_VERSION }}
name: Release ${{ env.RELEASE_VERSION }}
draft: true
files: |
lmgrep-*-${{ matrix.platform }}-${{ matrix.arch }}.zip
lmgrep-*-${{ matrix.platform }}-${{ matrix.arch }}-static.zip
compile-windows-native-image:
needs: create-gh-release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest ]
include:
- os: windows-latest
platform: windows
arch: 'amd64'
steps:
- uses: actions/checkout@master
with:
fetch-depth: '0'
- name: Set env
run: |
echo ("RELEASE_VERSION=" + $env:GITHUB_REF.replace('refs/tags/', '')) >> $env:GITHUB_ENV
- name: Prepare java
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'
- name: Install clojure tools-deps
uses: DeLaGuardo/setup-clojure@master
with:
tools-deps: 1.10.3.1058
cli: 1.10.3.1058
- name: Compile uberjar on windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
clojure -Spom
echo $env:RELEASE_VERSION > resources/LMGREP_VERSION
clojure -X:uberjar :jar target/lmgrep-uber.jar :main-class lmgrep.core
shell: powershell
- uses: ilammy/msvc-dev-cmd@v1.10.0
- uses: microsoft/setup-msbuild@v1
- name: Set env
shell: powershell
run: |
echo ("LMGREP_VERSION=" + $(cat resources/LMGREP_VERSION)) >> $env:GITHUB_ENV
- uses: ayltai/setup-graalvm@v1
with:
java-version: 17
graalvm-version: 21.3.0
native-image: true
- name: Build native image
run: |
native-image -jar "target/lmgrep-uber.jar" -H:+AddAllCharsets -H:IncludeResources=LMGREP_VERSION -H:Name=lmgrep -H:+ReportExceptionStackTraces --initialize-at-build-time --verbose --no-fallback -H:ReflectionConfigurationFiles=graalvm/lucene-reflect-config.json -J-Xmx8g
shell: powershell
- name: Zip executable
shell: powershell
run: |
tar.exe -a -c -f lmgrep-$($env:RELEASE_VERSION)-${{ matrix.platform }}-${{ matrix.arch }}.zip lmgrep.exe
- name: Upload windows binaries to the release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.RELEASE_VERSION }}
name: Release ${{ env.RELEASE_VERSION }}
draft: true
files: |
lmgrep-*-${{ matrix.platform }}-${{ matrix.arch }}.zip