-
Notifications
You must be signed in to change notification settings - Fork 17
255 lines (220 loc) · 7.29 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
name: build
permissions:
contents: write
actions: read
on:
pull_request:
branches:
- master
push:
tags:
- 'v*'
jobs:
build-windows:
runs-on: windows-2022
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: 1.13.2
- name: Build SQLite3 static library
run: "scripts/sqlite3-static.ps1"
- name: Install shards dependencies
run: shards install --production
- name: Build coverage reporter CLI
run: crystal build src\cli.cr -o dist\coveralls --release --static --no-debug --progress
- name: Prepare distribution archive
run: |
cd dist
$vsbase = vswhere.exe -products * -property installationPath -latest
if (-not $vsbase) {
Write-Error "Visual Studio installation not found"
exit 1
}
$dumpbinPath = Join-Path $vsbase "VC\Tools\MSVC\*\bin\HostX64\x64\dumpbin.exe"
$resolvedDumpbin = Get-Item $dumpbinPath | Select-Object -First 1
if (-not $resolvedDumpbin) {
Write-Error "dumpbin.exe not found"
exit 1
}
& $resolvedDumpbin /dependents coveralls.exe
tar -acf coveralls-windows.zip coveralls.exe
- name: Upload exe
uses: actions/upload-artifact@v4
with:
name: coveralls-windows.exe
path: dist/coveralls.exe
if-no-files-found: error
- name: Upload zip
uses: actions/upload-artifact@v4
with:
name: coveralls-windows.zip
path: dist/coveralls-windows.zip
if-no-files-found: error
build-linux:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
# # Debug step to verify event context
# - name: Print event context for build-linux
# run: |
# echo "${{ toJson(github.event) }}"
- name: Checkout code
uses: actions/checkout@v4
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: 1.13.2
- name: Install shards dependencies
run: shards install --production
- name: Build cross-compilation container
run: make build-xbuild-container
- name: Build cross-compiled linux binaries
run: make compile-and-strip-all
- name: Package linux binaries
run: make package
# Debug step to verify what files are in the dist/ directory
- name: List files in dist/ directory
run: ls -la dist/
- name: Upload linux binaries
uses: actions/upload-artifact@v4
with:
name: coveralls-linux-binaries
path: dist/*
if-no-files-found: error
- name: Create Trigger File
run: echo "test-binaries-trigger" > test-binaries-trigger.txt
- name: Upload Trigger Artifact
uses: actions/upload-artifact@v4
with:
name: test-binaries-trigger
path: test-binaries-trigger.txt
# - name: Upload coveralls-linux
# uses: actions/upload-artifact@v4
# with:
# name: coveralls-linux
# path: dist/coveralls-linux
#
# - name: Upload coveralls-linux.tar.gz
# uses: actions/upload-artifact@v4
# with:
# name: coveralls-linux.tar.gz
# path: dist/coveralls-linux.tar.gz
#
- name: Upload coveralls-linux-x86_64
uses: actions/upload-artifact@v4
with:
name: coveralls-linux-x86_64
path: dist/coveralls-linux-x86_64
#
# - name: Upload coveralls-linux-x86_64.tar.gz
# uses: actions/upload-artifact@v4
# with:
# name: coveralls-linux-x86_64.tar.gz
# path: dist/coveralls-linux-x86_64.tar.gz
#
- name: Upload coveralls-linux-aarch64
uses: actions/upload-artifact@v4
with:
name: coveralls-linux-aarch64
path: dist/coveralls-linux-aarch64
#
# - name: Upload coveralls-linux-aarch64.tar.gz
# uses: actions/upload-artifact@v4
# with:
# name: coveralls-linux-aarch64.tar.gz
# path: dist/coveralls-linux-aarch64.tar.gz
# Debug step to verify what files are in the dist/ directory
- name: List files in dist/ directory
run: ls -la dist/
test-linux-x86_64:
runs-on: ubuntu-latest
needs: build-linux
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download x86_64 binary
uses: actions/download-artifact@v4
with:
name: coveralls-linux-x86_64
path: ./binaries/
- name: Test x86_64 binary
run: ./binaries/coveralls-linux-x86_64 --version
test-linux-aarch64:
runs-on: ubuntu-latest
needs: build-linux
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download aarch64 binary
uses: actions/download-artifact@v4
with:
name: coveralls-linux-aarch64
path: ./binaries/
- name: Test aarch64 binary in QEMU
run: |
sudo apt-get update
sudo apt-get install -y qemu-user
qemu-aarch64 ./binaries/coveralls-linux-aarch64 --version
release:
runs-on: ubuntu-latest
needs: [build-windows, build-linux]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
continue-on-error: true
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --force --tags
- name: Download binaries
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: Prepare files for release
run: |
mkdir release/
find artifacts/ -type f -exec cp \{} release/ \;
cd release/
mv coveralls coveralls-linux
mv coveralls.exe coveralls-windows.exe
sha256sum * > coveralls-checksums.txt
- name: Create Github release
env:
TAG: ${{ github.ref }}
GH_TOKEN: ${{ github.token }}
run: >
cd release/;
gh release create ${TAG}
'coveralls-linux-x86_64#coveralls-linux'
'coveralls-linux-x86_64.tar.gz#coveralls-linux.tar.gz'
'coveralls-linux-x86_64#coveralls-linux-x86_64' \
'coveralls-linux-x86_64.tar.gz#coveralls-linux-x86_64.tar.gz' \
'coveralls-linux-aarch64#coveralls-linux-aarch64' \
'coveralls-linux-aarch64.tar.gz#coveralls-linux-aarch64.tar.gz' \
'coveralls-windows.exe#coveralls-windows.exe'
'coveralls-windows.zip#coveralls-windows.zip'
'coveralls-checksums.txt#coveralls-checksums.txt'
--generate-notes
homebrew:
runs-on: ubuntu-latest
needs: [release]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
continue-on-error: true
steps:
- name: Update Homebrew formula
uses: dawidd6/action-homebrew-bump-formula@v3
with:
tap: coverallsapp/coveralls
formula: coveralls
token: ${{ secrets.HOMEBREW_TOKEN }}