Skip to content

Commit 7888146

Browse files
committed
github: add windows build matrix and installer package
Signed-off-by: William Casarin <[email protected]>
1 parent 7f30f16 commit 7888146

File tree

1 file changed

+112
-76
lines changed

1 file changed

+112
-76
lines changed

.github/workflows/rust.yml

+112-76
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,7 @@ on: [push, pull_request]
22

33
name: CI
44

5-
env:
6-
# This is required to enable the web_sys clipboard API which egui_web uses
7-
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
8-
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
9-
RUSTFLAGS: --cfg=web_sys_unstable_apis
10-
115
jobs:
12-
check:
13-
name: Check
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v2
17-
- uses: actions-rs/toolchain@v1
18-
with:
19-
profile: minimal
20-
toolchain: stable
21-
override: true
22-
- uses: actions-rs/cargo@v1
23-
with:
24-
command: check
25-
# args: --all-features
26-
27-
# check_wasm:
28-
# name: Check wasm32
29-
# runs-on: ubuntu-latest
30-
# steps:
31-
# - uses: actions/checkout@v2
32-
# - uses: actions-rs/toolchain@v1
33-
# with:
34-
# profile: minimal
35-
# toolchain: stable
36-
# target: wasm32-unknown-unknown
37-
# override: true
38-
# - uses: actions-rs/cargo@v1
39-
# with:
40-
# command: check
41-
# args: --all-features --lib --target wasm32-unknown-unknown
42-
43-
test:
44-
name: Test Suite
45-
runs-on: ubuntu-latest
46-
steps:
47-
- uses: actions/checkout@v2
48-
- uses: actions-rs/toolchain@v1
49-
with:
50-
profile: minimal
51-
toolchain: stable
52-
override: true
53-
- run: sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
54-
- uses: actions-rs/cargo@v1
55-
with:
56-
command: test
57-
args: --lib
58-
596
fmt:
607
name: Rustfmt
618
runs-on: ubuntu-latest
@@ -83,59 +30,148 @@ jobs:
8330
toolchain: stable
8431
override: true
8532
components: clippy
33+
34+
- uses: Swatinem/rust-cache@v2
8635
- uses: actions-rs/cargo@v1
8736
with:
8837
command: clippy
8938
args: -- -D warnings
9039

91-
# trunk:
92-
# name: trunk
93-
# runs-on: ubuntu-latest
94-
# steps:
95-
# - uses: actions/checkout@v2
96-
# - uses: actions-rs/toolchain@v1
97-
# with:
98-
# profile: minimal
99-
# toolchain: 1.61.0
100-
# target: wasm32-unknown-unknown
101-
# override: true
102-
# - name: Download and install Trunk binary
103-
# run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
104-
# - name: Build
105-
# run: ./trunk build
106-
107-
packages:
108-
name: Build Packages
40+
build-and-test:
41+
name: Build and Test (${{ matrix.os }})
42+
runs-on: ${{ matrix.os }}
43+
strategy:
44+
matrix:
45+
os: [ubuntu-latest, windows-latest]
46+
toolchain: [stable]
47+
steps:
48+
# Checkout the repository
49+
- name: Checkout Code
50+
uses: actions/checkout@v2
51+
52+
# Set up the Rust toolchain
53+
- name: Setup Rust
54+
uses: actions-rs/toolchain@v1
55+
with:
56+
profile: minimal
57+
toolchain: ${{ matrix.toolchain }}
58+
override: true
59+
60+
# Cache
61+
- name: Rust cache
62+
uses: Swatinem/rust-cache@v2
63+
64+
# Install dependencies (only for Ubuntu)
65+
- name: Install Dependencies (Ubuntu)
66+
if: runner.os == 'Linux'
67+
run: sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
68+
69+
# Run tests
70+
- name: Run Tests
71+
uses: actions-rs/cargo@v1
72+
with:
73+
command: test
74+
args: --release
75+
76+
# Build
77+
- name: Build
78+
uses: actions-rs/cargo@v1
79+
with:
80+
command: build
81+
args: --release
82+
83+
# Strip Debug Symbols
84+
- name: Strip Debug Symbols
85+
if: runner.os == 'Linux'
86+
run: strip target/release/notedeck || echo "Skipping strip if not applicable"
87+
88+
# Upload bin for further packaging steps
89+
- name: Upload Build Artifacts
90+
if: runner.os == 'Linux'
91+
uses: actions/upload-artifact@v3
92+
with:
93+
name: notedeck-linux-bin
94+
path: target/release/notedeck
95+
96+
# Upload exe for further packaging steps
97+
- name: Upload Build Artifacts
98+
if: runner.os == 'Windows'
99+
uses: actions/upload-artifact@v3
100+
with:
101+
name: notedeck-windows-exe
102+
path: target/release/notedeck.exe
103+
104+
packaging:
105+
name: Build Linux Packages
109106
runs-on: ubuntu-latest
107+
needs: build-and-test
110108
steps:
109+
# Checkout the repository
111110
- name: Checkout Code
112111
uses: actions/checkout@v2
113112

113+
# Install Packaging Tools
114114
- name: Install Packaging Tools
115115
run: |
116116
sudo apt-get update
117117
sudo apt-get install -y rpm binutils
118118
cargo install cargo-generate-rpm cargo-deb
119119
120-
- name: Build Project
121-
run: cargo build --release
122-
123-
- name: Strip Debug Symbols
124-
run: strip target/release/notedeck || echo "Skipping strip if not applicable"
120+
- name: Download Build Artifacts
121+
uses: actions/download-artifact@v3
122+
with:
123+
name: notedeck-linux-bin # Assuming you need the Release build
125124

125+
# Build Packages
126126
- name: Build Packages
127127
run: |
128128
cargo generate-rpm
129129
cargo deb
130130
131+
# Upload RPM Package
131132
- name: Upload RPM Package
132133
uses: actions/upload-artifact@v4
133134
with:
134135
name: notedeck-rpm
135136
path: target/generate-rpm/*.rpm
136137

138+
# Upload Debian Package
137139
- name: Upload Debian Package
138140
uses: actions/upload-artifact@v4
139141
with:
140142
name: notedeck-deb
141143
path: target/debian/*.deb
144+
145+
windows-installer:
146+
name: Build Windows Installer
147+
runs-on: windows-latest
148+
needs: build-and-test
149+
steps:
150+
# Checkout the repository
151+
- name: Checkout Code
152+
uses: actions/checkout@v2
153+
154+
- name: Download Build Artifacts
155+
uses: actions/download-artifact@v3
156+
with:
157+
name: notedeck-windows-exe # Assuming you need the Release build
158+
159+
# Install Inno Setup
160+
- name: Install Inno Setup
161+
run: choco install innosetup --no-progress --yes
162+
163+
# Build Installer
164+
- name: Run Inno Setup Script
165+
run: |
166+
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe scripts/windows-installer.iss"
167+
168+
# List outputs
169+
- name: List Inno Script outputs
170+
run: dir packages
171+
172+
# Upload the installer as an artifact
173+
- name: Upload Installer
174+
uses: actions/upload-artifact@v3
175+
with:
176+
name: Windows-Installer
177+
path: packages\DamusNotedeckInstaller.exe

0 commit comments

Comments
 (0)