-
Notifications
You must be signed in to change notification settings - Fork 23
240 lines (205 loc) · 6.93 KB
/
rust.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
name: CI
on:
push:
branches:
- master
- ci
pull_request:
branches:
- "*"
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy -- -D warnings
linux-test:
name: Test (Linux)
uses: ./.github/workflows/build-and-test.yml
with:
os: ubuntu-latest
additional-setup: |
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
macos-test:
name: Test (macOS)
uses: ./.github/workflows/build-and-test.yml
with:
os: macos-latest
windows-test:
name: Test (Windows)
uses: ./.github/workflows/build-and-test.yml
with:
os: windows-latest
packaging:
name: rpm/deb
runs-on: ubuntu-latest
needs: linux-test
#if: github.ref_name == 'master'
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@v4
# Install Packaging Tools
- name: Install Packaging Tools
run: |
sudo apt-get update
if [ "${{ matrix.arch }}" != "$(uname -m)" ]; then
sudo apt-get install -y gcc-${{ matrix.arch }}-linux-gnu g++-aarch64-linux-gnu
rustup target add ${{ matrix.arch }}-unknown-linux-gnu
fi
cargo install cargo-generate-rpm cargo-deb
# Build
- name: Build (${{ matrix.arch }})
run: |
echo "arch: $(uname -m)"
if [ "${{ matrix.arch }}" != "$(uname -m)" ]; then
cargo build --release --target=${{ matrix.arch }}-unknown-linux-gnu
else
cargo build --release
fi
# Build RPM Package
- name: Build RPM Package
run: |
if [ "${{ matrix.arch }}" != "$(uname -m)" ]; then
cargo generate-rpm --target=${{ matrix.arch }}-unknown-linux-gnu
else
cargo generate-rpm
fi
# Build Debian Package
- name: Build Debian Package
run: |
if [ "${{ matrix.arch }}" != "$(uname -m)" ]; then
cargo deb --target=${{ matrix.arch }}-unknown-linux-gnu
else
cargo deb
fi
# Upload RPM Package
- name: Upload RPM Package
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-name }}-${{ matrix.arch }}.rpm
path: target/${{ matrix.arch }}-unknown-linux-gnu/generate-rpm/*.rpm
# Upload Debian Package
- name: Upload Debian Package
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-name }}-${{ inputs.arch }}.deb
path: target/${{ matrix.arch }}-unknown-linux-gnu/debian/*.deb
macos-dmg:
name: macOS dmg
runs-on: macos-latest
needs: macos-test
#if: github.ref_name == 'master'
env:
NOTEDECK_APPLE_RELEASE_CERT_ID: ${{ secrets.NOTEDECK_APPLE_RELEASE_CERT_ID }}
NOTEDECK_RELEASE_APPLE_ID: ${{ secrets.NOTEDECK_RELEASE_APPLE_ID }}
NOTEDECK_APPLE_APP_SPECIFIC_PW: ${{ secrets.NOTEDECK_APPLE_APP_SPECIFIC_PW }}
NOTEDECK_APPLE_TEAM_ID: ${{ secrets.NOTEDECK_APPLE_TEAM_ID }}
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@v4
- name: Install Required Tools
run: |
brew install create-dmg
cargo install cargo-bundle
rustup target add ${{ matrix.arch }}-apple-darwin
- name: Import apple codesign cert
uses: apple-actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
- name: Run macOS DMG Build Script
run: ARCH=${{ matrix.arch }} ./scripts/macos_build.sh
- name: Upload DMG Artifact
uses: actions/upload-artifact@v4
with:
name: notedeck-${{ matrix.arch }}.dmg
path: packages/notedeck-${{ matrix.arch }}.dmg
windows-installer:
name: Windows Installer
runs-on: windows-latest
needs: windows-test
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@v4
# Create packages directory
- name: Create packages directory
run: mkdir packages
# Install Inno Setup
- name: Install Inno Setup
run: choco install innosetup --no-progress --yes
# Set up Rust toolchain
- name: Install Rust toolchain
run: rustup target add ${{ matrix.arch }}-pc-windows-msvc
# Build
- name: Build
shell: pwsh
run: |
$target = "${{ matrix.arch }}-pc-windows-msvc"
Write-Output "Building for target: $target"
cargo build --release --target=$target
# Generate ISS Script
- name: Generate Inno Setup Script
shell: pwsh
run: |
$arch = "${{ matrix.arch }}"
$issContent = @"
[Setup]
AppName=Damus Notedeck
AppVersion=0.1
DefaultDirName={pf}\Notedeck
DefaultGroupName=Damus Notedeck
OutputDir=..\packages\$arch
OutputBaseFilename=DamusNotedeckInstaller
Compression=lzma
SolidCompression=yes
[Files]
Source: "..\target\$arch-pc-windows-msvc\release\notedeck.exe"; DestDir: "{app}"; Flags: ignoreversion
[Icons]
Name: "{group}\Damus Notedeck"; Filename: "{app}\notedeck.exe"
[Run]
Filename: "{app}\notedeck.exe"; Description: "Launch Damus Notedeck"; Flags: nowait postinstall skipifsilent
"@
Set-Content -Path "scripts/windows-installer-$arch.iss" -Value $issContent
# Build Installer
- name: Run Inno Setup Script
run: |
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "scripts\windows-installer-${{ matrix.arch }}.iss"
# Move output
- name: Move Inno Script outputs to architecture-specific folder
run: |
New-Item -ItemType Directory -Force -Path packages\${{ matrix.arch }}
Move-Item -Path packages\${{ matrix.arch }}\DamusNotedeckInstaller.exe -Destination packages\${{ matrix.arch }}\DamusNotedeckInstaller.exe
# Upload the installer as an artifact
- name: Upload Installer
uses: actions/upload-artifact@v4
with:
name: DamusNotedeckInstaller-${{ matrix.arch }}.exe
path: packages\${{ matrix.arch }}\DamusNotedeckInstaller.exe