-
Notifications
You must be signed in to change notification settings - Fork 0
276 lines (242 loc) · 9.71 KB
/
publish-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
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
name: Release binaries
on:
push:
tags:
- "v*"
jobs:
compile-gui:
# Compile the GUI on Windows & Linux, and write the GUI binaries to actions/cache
name: Compile GUI
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Fetch cached compiled GUI
id: restore-compiled-gui
uses: actions/cache/restore@v4
with:
# enableCrossOsArchive always needs to be set on cached items in Windows jobs
# see cache documentation: https://github.com/actions/cache#inputs
enableCrossOsArchive: true
path: gui/dist/cloudfuseGUI_${{ runner.os }}
key: ${{ runner.os }}-compiled-gui-${{ hashFiles('gui/*.ui', 'gui/*.py') }}
- name: Install Python
if: ${{ ! steps.restore-compiled-gui.outputs.cache-hit }}
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install pip dependencies
if: ${{ ! steps.restore-compiled-gui.outputs.cache-hit }}
run: pip3 install -r gui/requirements.txt
shell: bash
- name: Install libxcb-cursor0
if: ${{ ! steps.restore-compiled-gui.outputs.cache-hit && matrix.os == 'ubuntu-latest' }}
run: |-
sudo apt-get update
sudo apt-get install libxcb-cursor0 -y
- name: Compile GUI
if: ${{ ! steps.restore-compiled-gui.outputs.cache-hit }}
shell: bash
run: |
cd gui
./create_gui.sh
mv dist/cloudfuseGUI dist/cloudfuseGUI_${{ runner.os }}
- name: Cache compiled GUI
if: ${{ ! steps.restore-compiled-gui.outputs.cache-hit }}
uses: actions/cache/save@v4
with:
enableCrossOsArchive: true
path: gui/dist/cloudfuseGUI_${{ runner.os }}
key: ${{ runner.os }}-compiled-gui-${{ hashFiles('gui/*.ui', 'gui/*.py') }}
create-installer:
# Run Inno Setup to create the Windows app installer, then write it to actions/cache
name: Create Windows Installer
needs: compile-gui
runs-on: windows-latest
env:
go: "1.23.2"
cgo: "0"
winfsp: winfsp-2.0.23075.msi
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.go }}
check-latest: true
cache: false
- name: Set CGO
shell: bash
run: |
if [[ "${{ env.cgo }}" != "" ]]; then echo 'CGO_ENABLED=${{ env.cgo }}' >> $GITHUB_ENV ; fi
- name: Build
shell: bash
run: |
commitDate=$(TZ=UTC0 git log -1 --format=%cd --date=format-local:%Y-%m-%dT%H:%M:%SZ)
ldflags="-s -w -X github.com/Seagate/cloudfuse/common.GitCommit=${{ github.sha }} -X github.com/Seagate/cloudfuse/common.CommitDate=$commitDate"
go build -trimpath -ldflags ''"$ldflags"'' -o cloudfuse.exe
go build -trimpath -ldflags ''"$ldflags"'' -o cfusemon.exe ./tools/health-monitor/
go build -trimpath -ldflags ''"$ldflags"'' -o windows-startup.exe ./tools/windows-startup/
touch -m -d $commitDate cloudfuse.exe
touch -m -d $commitDate cfusemon.exe
touch -m -d $commitDate windows-startup.exe
# Get the WinFSP installer (from cache or download)
- name: Get cached WinFSP installer
id: restore-winfsp-installer
uses: actions/cache/restore@v4
with:
path: ${{ env.winfsp }}
key: ${{ env.winfsp }}
- name: Download WinFSP installer
if: ${{ ! steps.restore-winfsp-installer.outputs.cache-hit }}
shell: bash
run: |
curl -LOf https://github.com/winfsp/winfsp/releases/download/v2.0/${{ env.winfsp }}
- name: Cache WinFSP installer
if: ${{ ! steps.restore-winfsp-installer.outputs.cache-hit }}
uses: actions/cache/save@v4
with:
path: ${{ env.winfsp }}
key: ${{ env.winfsp }}
- name: Fetch cached compiled GUI
uses: actions/cache/restore@v4
with:
enableCrossOsArchive: true
path: gui/dist/cloudfuseGUI_${{ runner.os }}
key: ${{ runner.os }}-compiled-gui-${{ hashFiles('gui/*.ui', 'gui/*.py') }}
fail-on-cache-miss: true
# don't continue if we fail get the compiled GUI for the Windows installer
continue-on-error: false
- name: Set Version
id: get_version
shell: bash
run: echo "VERSION=${REF_NAME#v}" >> $GITHUB_OUTPUT
env:
REF_NAME: ${{ github.ref_name }}
- name: Run Inno Setup
# Build the installer and save it to actions/cache
working-directory: ./build
shell: bash
# Inno Setup is pre-installed on GitHub's windows-latest image
# see documentation: https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md
run: |
"C:/Program Files (x86)/Inno Setup 6/iscc.exe" windows_installer_build.iss
- name: Rename installer
run: |
mv build/Output/cloudfuse.exe build/Output/cloudfuse_${VERSION}_windows_amd64.exe
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Run Inno Setup for No Gui
working-directory: ./build
shell: bash
# Inno Setup is pre-installed on GitHub's windows-latest image
# see documentation: https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md
run: |
"C:/Program Files (x86)/Inno Setup 6/iscc.exe" windows_installer_build_no_gui.iss
- name: Rename installer No Gui
run: |
mv build/Output/cloudfuse.exe build/Output/cloudfuse_no_gui_${VERSION}_windows_amd64.exe
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Cache windows installer
uses: actions/cache/save@v4
with:
enableCrossOsArchive: true
path: build/Output/cloudfuse_${{ steps.get_version.outputs.VERSION }}_windows_amd64.exe
key: windows-cloudfuse-installer-${{ github.sha }}
- name: Cache windows installer No GUi
uses: actions/cache/save@v4
with:
enableCrossOsArchive: true
path: build/Output/cloudfuse_no_gui_${{ steps.get_version.outputs.VERSION }}_windows_amd64.exe
key: windows-cloudfuse-no-gui-installer-${{ github.sha }}
release:
# Use GoReleaser to package and publish Linux releases along with the Windows installer
name: Release Binaries
needs: create-installer
runs-on: ubuntu-latest
env:
go: "1.23.2"
zig: 0.13.0
steps:
# libfuse-dev is required to build our command-line program
- name: Install Libfuse
run: |
sudo apt-get install -y libfuse-dev
# enable GoReleaser to build for ARM64
- name: Install ARM64 compilers
run: |
sudo apt-get install -y gcc-aarch64-linux-gnu
# Get code and Go ready
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Install Zig
run: |
curl -L https://ziglang.org/download/${{ env.zig }}/zig-linux-x86_64-${{ env.zig }}.tar.xz -o zig.tar.xz
mkdir -p $HOME/.local/bin
tar -xf zig.tar.xz -C $HOME/.local/bin
echo "$HOME/.local/bin/zig-linux-x86_64-${{ env.zig }}" >> $GITHUB_PATH
rm zig.tar.xz
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.go }}
check-latest: true
cache: false
- name: Set Version
id: get_version
run: echo "VERSION=${REF_NAME#v}" >> $GITHUB_OUTPUT
env:
REF_NAME: ${{ github.ref_name }}
# Get cached intermediate build products
- name: Restore cached Windows installer
uses: actions/cache/restore@v4
with:
enableCrossOsArchive: true
path: build/Output/cloudfuse_${{ steps.get_version.outputs.VERSION }}_windows_amd64.exe
key: windows-cloudfuse-installer-${{ github.sha }}
fail-on-cache-miss: true
# Get cached intermediate build products
- name: Restore cached Windows installer No Gui
uses: actions/cache/restore@v4
with:
enableCrossOsArchive: true
path: build/Output/cloudfuse_no_gui_${{ steps.get_version.outputs.VERSION }}_windows_amd64.exe
key: windows-cloudfuse-no-gui-installer-${{ github.sha }}
fail-on-cache-miss: true
- name: Restore Linux compiled GUI
uses: actions/cache/restore@v4
with:
path: gui/dist/cloudfuseGUI_Linux
key: Linux-compiled-gui-${{ hashFiles('gui/*.ui', 'gui/*.py') }}
fail-on-cache-miss: true
continue-on-error: false
- name: Restore Windows compiled GUI
uses: actions/cache/restore@v4
with:
enableCrossOsArchive: true
path: gui/dist/cloudfuseGUI_Windows
key: Windows-compiled-gui-${{ hashFiles('gui/*.ui', 'gui/*.py') }}
# the hash value comes out different on Linux vs Windows
# so we need to use restore-keys to match the Windows compiled GUI
# see documentation: https://github.com/actions/cache/blob/main/restore/README.md#inputs
restore-keys: Windows-compiled-gui-
continue-on-error: false
# Run GoReleaser (see .goreleaser.yaml)
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}