-
Notifications
You must be signed in to change notification settings - Fork 21
171 lines (155 loc) · 5.44 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
name: Build
on:
push:
tags: [ 'v*' ]
branches: [ 'master' ]
pull_request:
branches: [ 'master' ]
jobs:
build:
timeout-minutes: 15
# need to be newer than `ubuntu-20.04` because of scalafmt native binary
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: bleep-build/bleep-setup-action@0.0.1
- uses: coursier/cache-action@v6
with:
extraFiles: bleep.yaml
- name: Scalafmt Check
run: bleep fmt --check
- name: Run tests
env:
CI: true
run: |
bleep dist bleep-cli@jvm3 dist
dist/bin/bleep-cli config compile-server stop-all
dist/bin/bleep-cli test
build-native-image:
name: Native image build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
file_name: bleep
artifact_name: bleep-x86_64-pc-linux
- os: macos-latest
file_name: bleep
artifact_name: bleep-x86_64-apple-darwin
- os: windows-latest
file_name: bleep.exe
artifact_name: bleep-x86_64-pc-win32
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: bleep-build/bleep-setup-action@0.0.1
- uses: coursier/cache-action@v6
with:
extraFiles: bleep.yaml
- name: Build native image (non-windows)
# stop compile server after build since the new version may use a newer version of bloop
run: |
bleep dist bleep-cli@jvm3 dist
bleep config compile-server stop-all
dist/bin/bleep-cli native-image ${{ matrix.file_name }}
if: runner.os != 'Windows'
- name: Test binary after build (non-windows)
env:
CI: true
run: |
./${{ matrix.file_name }} --dev test --no-color jvm3
./${{ matrix.file_name }} selftest
if: runner.os != 'Windows'
# as is normal, everything involving windows is terrible.
# - powershell doesn't work, for one: https://github.com/dirs-dev/directories-jvm/issues/49
# - with `shell: cmd` only one command can be run at a time, so this is split into three
# - some windows development stuff needs to be available, that's what setup-graalvm accomplishes below. todo: figure out how bleep can download it itself
- name: Build native image 1 (windows)
run: bleep config compile-server auto-shutdown-enable
shell: cmd
if: runner.os == 'Windows'
- name: Build native image 2 (windows)
uses: graalvm/setup-graalvm@v1
if: runner.os == 'Windows'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: '22.3.1'
java-version: '17'
components: 'native-image'
- name: Build native image 3 (windows)
run: bleep native-image ${{ matrix.file_name }}
shell: cmd
if: runner.os == 'Windows'
- name: Test binary after build 1 (windows)
shell: cmd
env:
CI: true
# todo: fix tests on windows
run: .\${{ matrix.file_name }} --dev compile --no-color jvm3
if: runner.os == 'Windows'
- name: Test binary after build 2 (windows)
shell: cmd
env:
CI: true
# todo: fix tests on windows
run: .\${{ matrix.file_name }} selftest
if: runner.os == 'Windows'
- name: Temporarily save package
uses: actions/upload-artifact@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ matrix.artifact_name }}
path: ${{ matrix.file_name }}
retention-days: 1
release:
timeout-minutes: 15
runs-on: ubuntu-20.04
needs: [ build, build-native-image ]
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
repo-token: ${{ secrets.GITHUB_TOKEN }}
- id: get_version
uses: battila7/get-version-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Download artifacts
uses: actions/download-artifact@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
path: artifacts
- name: Display structure of downloaded files
run: find artifacts
- name: Release
run: |
chmod +x ./artifacts/bleep-x86_64-pc-linux/bleep
./artifacts/bleep-x86_64-pc-linux/bleep --dev publish
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
- name: Prepare files
run: |
export VERSION=${{ steps.get_version.outputs.version-without-v }}
bash .github/prepare-release.sh
- name: Upload-to-release
uses: softprops/action-gh-release@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
name: "${{ steps.get_version.outputs.version-without-v }}"
prerelease: true
generate_release_notes: true
files: |
work/release/*