Skip to content

Commit 922329a

Browse files
committed
first attempt
1 parent 42f9dfe commit 922329a

1 file changed

Lines changed: 235 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
name: Reflect
2+
3+
on: [pull_request, push]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
build:
11+
env:
12+
MACOSX_DEPLOYMENT_TARGET: 14.5
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- artifact-name: Windows-x86_64
18+
os: windows-2025
19+
tauri-build-flags: --target x86_64-pc-windows-msvc -v -- --workspace --timings
20+
21+
- artifact-name: Windows-aarch64
22+
os: windows-2025
23+
tauri-build-flags: --target aarch64-pc-windows-msvc -v -- --workspace --timings
24+
25+
- artifact-name: macOS-x86_64
26+
os: macos-15
27+
tauri-build-flags: --target x86_64-apple-darwin -v -- --workspace --timings
28+
29+
- artifact-name: macOS-aarch64
30+
os: macos-15
31+
tauri-build-flags: --target aarch64-apple-darwin -v -- --workspace --timings
32+
33+
- artifact-name: Linux-x86_64
34+
os: ubuntu-24.04
35+
tauri-build-flags: --target x86_64-unknown-linux-gnu -v -- --workspace --timings
36+
37+
- artifact-name: Linux-aarch64
38+
os: ubuntu-24.04-arm
39+
tauri-build-flags: --target aarch64-unknown-linux-gnu -v -- --workspace --timings
40+
41+
name: ${{ matrix.artifact-name }}
42+
runs-on: ${{ matrix.os }}
43+
44+
steps:
45+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
46+
with:
47+
persist-credentials: false
48+
token: ${{secrets.GITHUB_TOKEN}}
49+
50+
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
51+
with:
52+
version: 10
53+
54+
- name: Make GCC 14 the default toolchain (Linux)
55+
if: runner.os == 'Linux'
56+
run: |
57+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 200
58+
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 200
59+
60+
- name: Install Linux dependencies
61+
if: runner.os == 'Linux'
62+
run: |
63+
sudo apt-get update -q
64+
sudo apt-get install -y \
65+
build-essential \
66+
curl \
67+
file \
68+
libayatana-appindicator3-dev \
69+
librsvg2-dev \
70+
libssl-dev \
71+
libwebkit2gtk-4.1-dev \
72+
libxdo-dev \
73+
wget
74+
75+
- name: Install Node.js dependencies
76+
run: pnpm install
77+
working-directory: ./apps/reflect
78+
continue-on-error: true
79+
80+
- name: Set up Windows aarch64 Rust compiler
81+
if: matrix.artifact-name == 'Windows-aarch64'
82+
run: rustup target install aarch64-pc-windows-msvc
83+
84+
- name: Set up macOS x86_64 Rust compiler
85+
if: matrix.artifact-name == 'macOS-x86_64'
86+
run: rustup target add x86_64-apple-darwin
87+
88+
- name: Set up sccache
89+
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad
90+
- name: Cargo test
91+
run: cargo test --release
92+
env:
93+
RUSTC_WRAPPER: sccache
94+
SCCACHE_GHA_ENABLED: true
95+
- name: Build package
96+
run: pnpm run tauri build ${{ matrix.tauri-build-flags }}
97+
working-directory: ./apps/reflect
98+
env:
99+
RUSTC_WRAPPER: sccache
100+
SCCACHE_GHA_ENABLED: true
101+
102+
- name: Package artifacts (Windows x86_64)
103+
if: matrix.artifact-name == 'Windows-x86_64'
104+
run: |
105+
Compress-Archive -DestinationPath ${{ matrix.artifact-name }}-standalone.zip -Path target/x86_64-pc-windows-msvc/release/Reflect.exe,target/x86_64-pc-windows-msvc/release/Reflect-cli.exe
106+
Compress-Archive -DestinationPath ${{ matrix.artifact-name }}.zip -Path ${{ matrix.artifact-name }}-standalone.zip,target/x86_64-pc-windows-msvc/release/bundle/nsis/*.exe
107+
108+
- name: Package artifacts (Windows aarch64)
109+
if: matrix.artifact-name == 'Windows-aarch64'
110+
run: |
111+
Compress-Archive -DestinationPath ${{ matrix.artifact-name }}-standalone.zip -Path target/aarch64-pc-windows-msvc/release/Reflect.exe,target/aarch64-pc-windows-msvc/release/Reflect-cli.exe
112+
Compress-Archive -DestinationPath ${{ matrix.artifact-name }}.zip -Path ${{ matrix.artifact-name }}-standalone.zip,target/aarch64-pc-windows-msvc/release/bundle/nsis/*.exe
113+
114+
- name: Package artifacts (macOS x86_64)
115+
if: matrix.artifact-name == 'macOS-x86_64'
116+
# Tauri incorrectly capitalizes the executable name on macOS, so we
117+
# manually rename it
118+
run: |
119+
cp target/x86_64-apple-darwin/release/Reflect Reflect
120+
zip -j ${{ matrix.artifact-name }}-standalone.zip Reflect target/x86_64-apple-darwin/release/Reflect-cli
121+
zip -j ${{ matrix.artifact-name }}.zip ${{ matrix.artifact-name }}-standalone.zip target/x86_64-apple-darwin/release/bundle/dmg/*.dmg
122+
123+
- name: Package artifacts (macOS aarch64)
124+
if: matrix.artifact-name == 'macOS-aarch64'
125+
# Tauri incorrectly capitalizes the executable name on macOS, so we
126+
# manually rename it
127+
run: |
128+
cp target/aarch64-apple-darwin/release/Reflect Reflect
129+
zip -j ${{ matrix.artifact-name }}-standalone.zip Reflect target/aarch64-apple-darwin/release/Reflect-cli
130+
zip -j ${{ matrix.artifact-name }}.zip ${{ matrix.artifact-name }}-standalone.zip target/aarch64-apple-darwin/release/bundle/dmg/*.dmg
131+
132+
- name: Package artifacts (Linux x86_64)
133+
if: matrix.artifact-name == 'Linux-x86_64'
134+
run: |
135+
zip -j ${{ matrix.artifact-name }}-standalone.zip target/x86_64-unknown-linux-gnu/release/Reflect target/x86_64-unknown-linux-gnu/release/Reflect-cli
136+
zip -j ${{ matrix.artifact-name }}.zip ${{ matrix.artifact-name }}-standalone.zip target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb target/x86_64-unknown-linux-gnu/release/bundle/rpm/*.rpm
137+
138+
- name: Package artifacts (Linux aarch64)
139+
if: matrix.artifact-name == 'Linux-aarch64'
140+
run: |
141+
zip -j ${{ matrix.artifact-name }}-standalone.zip target/aarch64-unknown-linux-gnu/release/Reflect target/aarch64-unknown-linux-gnu/release/Reflect-cli
142+
zip -j ${{ matrix.artifact-name }}.zip ${{ matrix.artifact-name }}-standalone.zip target/aarch64-unknown-linux-gnu/release/bundle/appimage/*.AppImage target/aarch64-unknown-linux-gnu/release/bundle/deb/*.deb target/aarch64-unknown-linux-gnu/release/bundle/rpm/*.rpm
143+
144+
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
145+
with:
146+
name: ${{ matrix.artifact-name }}-cargo-timing.html
147+
path: target/cargo-timings/cargo-timing.html
148+
149+
# Zipping manually works around upload-artifact stripping execute
150+
# permissions from files
151+
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
152+
with:
153+
name: ${{ matrix.artifact-name }}
154+
path: ${{ matrix.artifact-name }}.zip
155+
156+
release:
157+
name: Create draft release
158+
needs: [build]
159+
runs-on: ubuntu-24.04
160+
if: |
161+
github.repository_owner == '2702rebels' &&
162+
startsWith(github.ref, 'refs/tags/v')
163+
164+
steps:
165+
- name: Download prebuilt binaries
166+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
167+
with:
168+
path: pkg
169+
pattern: "!*-cargo-timing.html"
170+
171+
- name: Display structure of downloaded files
172+
run: ls -R
173+
174+
- name: Rename Windows x86_64 artifacts
175+
working-directory: pkg/Windows-x86_64
176+
run: |
177+
unzip -o Windows-x86_64.zip
178+
rm Windows-x86_64.zip
179+
mv Windows-x86_64-standalone.zip Reflect-${{ github.ref_name }}-Windows-x86_64-standalone.zip
180+
mv Reflect_*_x64-setup.exe Reflect-${{ github.ref_name }}-Windows-x86_64-setup.exe
181+
182+
- name: Rename Windows aarch64 artifacts
183+
working-directory: pkg/Windows-aarch64
184+
run: |
185+
unzip -o Windows-aarch64.zip
186+
rm Windows-aarch64.zip
187+
mv Windows-aarch64-standalone.zip Reflect-${{ github.ref_name }}-Windows-aarch64-standalone.zip
188+
mv Reflect_*_arm64-setup.exe Reflect-${{ github.ref_name }}-Windows-aarch64-setup.exe
189+
190+
- name: Rename macOS x86_64 artifacts
191+
working-directory: pkg/macOS-x86_64
192+
run: |
193+
unzip -o macOS-x86_64.zip
194+
rm macOS-x86_64.zip
195+
mv macOS-x86_64-standalone.zip Reflect-${{ github.ref_name }}-macOS-x86_64-standalone.zip
196+
mv Reflect_*_x64.dmg Reflect-${{ github.ref_name }}-macOS-x86_64.dmg
197+
198+
- name: Rename macOS aarch64 artifacts
199+
working-directory: pkg/macOS-aarch64
200+
run: |
201+
unzip -o macOS-aarch64.zip
202+
rm macOS-aarch64.zip
203+
mv macOS-aarch64-standalone.zip Reflect-${{ github.ref_name }}-macOS-aarch64-standalone.zip
204+
mv Reflect_*_aarch64.dmg Reflect-${{ github.ref_name }}-macOS-aarch64.dmg
205+
206+
- name: Rename Linux x86_64 artifacts
207+
working-directory: pkg/Linux-x86_64
208+
run: |
209+
unzip -o Linux-x86_64.zip
210+
rm Linux-x86_64.zip
211+
mv Linux-x86_64-standalone.zip Reflect-${{ github.ref_name }}-Linux-x86_64-standalone.zip
212+
mv Reflect_*_amd64.AppImage Reflect-${{ github.ref_name }}-Linux-x86_64.AppImage
213+
mv Reflect_*_amd64.deb Reflect-${{ github.ref_name }}-Linux-x86_64.deb
214+
mv Reflect-*.x86_64.rpm Reflect-${{ github.ref_name }}-Linux-x86_64.rpm
215+
216+
- name: Rename Linux aarch64 artifacts
217+
working-directory: pkg/Linux-aarch64
218+
run: |
219+
unzip -o Linux-aarch64.zip
220+
rm Linux-aarch64.zip
221+
mv Linux-aarch64-standalone.zip Reflect-${{ github.ref_name }}-Linux-aarch64-standalone.zip
222+
mv Reflect_*_aarch64.AppImage Reflect-${{ github.ref_name }}-Linux-aarch64.AppImage
223+
mv Reflect_*_arm64.deb Reflect-${{ github.ref_name }}-Linux-aarch64.deb
224+
mv Reflect-*.aarch64.rpm Reflect-${{ github.ref_name }}-Linux-aarch64.rpm
225+
226+
- name: Display structure of renamed files
227+
run: ls -R
228+
229+
- uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b #v1.20.0
230+
with:
231+
name: Reflect ${{ github.ref_name }}
232+
tag: ${{ github.ref_name }}
233+
artifacts: "pkg/**/*"
234+
draft: true
235+
prerelease: true

0 commit comments

Comments
 (0)