-
Notifications
You must be signed in to change notification settings - Fork 1
211 lines (185 loc) · 7.51 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: Build and Upload JARs
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
release_name: snapshot-linux
- os: windows-2019
release_name: snapshot-windows
- os: macos-14
release_name: snapshot-macos
- os: macos-12
release_name: snapshot-macos-intel
env:
SCALA_VERSION: '3.5.0-RC7'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Pick and display a JDK version and distribution
id: pick-jdk
run: |
JDK_VERSION=8
if [[ "$RUNNER_OS" == "macOS" && "$RUNNER_ARCH" == "ARM64" ]]; then
JDK_VERSION=11
fi
JDK_DISTRIBUTION=temurin
echo "JDK_VERSION=$JDK_VERSION" >> $GITHUB_ENV
echo "JDK_DISTRIBUTION=$JDK_DISTRIBUTION" >> $GITHUB_ENV
shell: bash
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: ${{ env.JDK_DISTRIBUTION }}
java-version: ${{ env.JDK_VERSION }}
cache: sbt
- uses: sbt/setup-sbt@v1
- name: Cache SBT (Unix)
if: runner.os != 'Windows'
uses: actions/cache@v4
with:
path: |
~/.ivy2/cache
~/.sbt
~/.coursier
~/.cache/coursier
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}
restore-keys: |
${{ runner.os }}-sbt-
- name: Cache SBT for Windows
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: |
C:\Users\runneradmin\.ivy2\cache
C:\Users\runneradmin\.sbt
C:\Users\runneradmin\.coursier
C:\Users\runneradmin\AppData\Local\Coursier\cache
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}
restore-keys: |
${{ runner.os }}-sbt-
- name: SBT Clean
working-directory: chester-in-scala
run: sbt clean
shell: bash
# for some reason clean calls stImport and stImport usually fails at first run
continue-on-error: true
# maybe test will fail on the first try because of stImport, the typescript to scala thing.
- name: Run Tests
working-directory: chester-in-scala
run: sbt test || sbt test
shell: bash
- name: Build Common JAR with SBT
working-directory: chester-in-scala
run: sbt common/assembly
shell: bash
- name: Build CLI JAR with SBT
working-directory: chester-in-scala
run: sbt cli/assembly
shell: bash
- name: Build LSP JAR with SBT
working-directory: chester-in-scala
run: sbt lsp/assembly
shell: bash
- name: Build Native Image for CLI
working-directory: chester-in-scala
run: sbt cli/nativeImage
shell: bash
- name: Build CLI Native Executable
working-directory: chester-in-scala
run: sbt cliNative/nativeLink
shell: bash
- name: Rename CLI Native Executable
working-directory: chester-in-scala
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
mv cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-cli-out.exe cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out.exe || mv cli/native/target/scala-${{ env.SCALA_VERSION }}/native/chester.cli.Main.exe cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out.exe
else
mv cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-cli-out cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out || mv cli/native/target/scala-${{ env.SCALA_VERSION }}/native/chester.cli.Main cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out
fi
shell: bash
- name: Test Native Image for CLI integrity
working-directory: chester-in-scala
run: ./target/chester integrity
shell: bash
- name: Build Native Image for LSP
working-directory: chester-in-scala
run: sbt lsp/nativeImage
shell: bash
- name: Generate JS Artifacts
working-directory: chester-in-scala
run: |
sbt cliJS/fullLinkJS
mv cli/js/target/scala-${{ env.SCALA_VERSION }}/chester-cli-opt/main.js cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js
shell: bash
- name: List files for debugging
run: find chester-in-scala -type f -name "*.jar" -or -name "chester" -or -name "chester-lsp" -or -name "chester-out" -or -name "*.exe"
shell: bash
continue-on-error: true
- name: Upload Unix Artifacts
if: runner.os != 'Windows'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.release_name }}
path: |
chester-in-scala/common/jvm/target/scala-${{ env.SCALA_VERSION }}/common.jar
chester-in-scala/cli/jvm/target/scala-${{ env.SCALA_VERSION }}/chester.jar
chester-in-scala/lsp/jvm/target/scala-${{ env.SCALA_VERSION }}/chester-lsp.jar
chester-in-scala/cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js
chester-in-scala/target/chester
chester-in-scala/target/chester-lsp
chester-in-scala/cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out
- name: Upload Windows Artifacts
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.release_name }}
path: |
chester-in-scala/common/jvm/target/scala-${{ env.SCALA_VERSION }}/common.jar
chester-in-scala/cli/jvm/target/scala-${{ env.SCALA_VERSION }}/chester.jar
chester-in-scala/lsp/jvm/target/scala-${{ env.SCALA_VERSION }}/chester-lsp.jar
chester-in-scala/cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js
chester-in-scala/target/chester.exe
chester-in-scala/target/chester-lsp.exe
chester-in-scala/cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out.exe
- name: Create or Update GitHub Release for Unix
if: runner.os != 'Windows'
uses: ncipollo/release-action@v1
with:
tag: ${{ matrix.release_name }}
name: ${{ matrix.release_name }}
allowUpdates: true
prerelease: true
artifacts: |
chester-in-scala/common/jvm/target/scala-${{ env.SCALA_VERSION }}/common.jar,
chester-in-scala/cli/jvm/target/scala-${{ env.SCALA_VERSION }}/chester.jar,
chester-in-scala/lsp/jvm/target/scala-${{ env.SCALA_VERSION }}/chester-lsp.jar,
chester-in-scala/cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js,
chester-in-scala/target/chester,
chester-in-scala/target/chester-lsp,
chester-in-scala/cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out
- name: Create or Update GitHub Release for Windows
if: runner.os == 'Windows'
uses: ncipollo/release-action@v1
with:
tag: ${{ matrix.release_name }}
name: ${{ matrix.release_name }}
allowUpdates: true
prerelease: true
artifacts: |
chester-in-scala/common/jvm/target/scala-${{ env.SCALA_VERSION }}/common.jar,
chester-in-scala/cli/jvm/target/scala-${{ env.SCALA_VERSION }}/chester.jar,
chester-in-scala/lsp/jvm/target/scala-${{ env.SCALA_VERSION }}/chester-lsp.jar,
chester-in-scala/cli/js/target/scala-${{ env.SCALA_VERSION }}/chester.js,
chester-in-scala/target/chester.exe,
chester-in-scala/target/chester-lsp.exe,
chester-in-scala/cli/native/target/scala-${{ env.SCALA_VERSION }}/chester-out.exe