Skip to content

Commit 594c620

Browse files
committed
Add MacOS targets to the build and release workflows.
- add aarch64-apple-darwin and x86_64-apple-darwin Fixes #136
1 parent 00cb605 commit 594c620

2 files changed

Lines changed: 95 additions & 7 deletions

File tree

.github/workflows/build.yml

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Build
22

33
on:
44
pull_request:
5-
branches: [ "main" ]
5+
branches: ["main", "build-*"]
66
push:
7-
branches: [ "main" ]
7+
branches: ["main", "build-*"]
88

99
jobs:
1010
frontend:
@@ -17,7 +17,7 @@ jobs:
1717
- run: rustup target add wasm32-unknown-unknown
1818
- uses: jetli/trunk-action@v0.5.0
1919
with:
20-
version: 'latest'
20+
version: "latest"
2121

2222
- uses: actions/cache@v4
2323
with:
@@ -39,7 +39,7 @@ jobs:
3939
name: frontend-build-${{ github.sha }}
4040
path: frontend/dist
4141

42-
build:
42+
build-linux:
4343
name: Binaries for ${{ matrix.name }}
4444
needs: frontend
4545
runs-on: ubuntu-24.04
@@ -97,3 +97,39 @@ jobs:
9797

9898
- name: Cross build
9999
run: cross build --release --locked --target ${{ matrix.target }} --manifest-path backend/Cargo.toml
100+
101+
build-macos:
102+
name: Binaries for ${{ matrix.name }}
103+
needs: frontend
104+
runs-on: ${{ matrix.os }}
105+
106+
strategy:
107+
matrix:
108+
include:
109+
- name: aarch64-apple-darwin
110+
target: aarch64-apple-darwin
111+
os: macos-14
112+
113+
steps:
114+
- uses: actions/checkout@v4
115+
- run: rustup toolchain install stable --profile minimal
116+
- run: rustup target add ${{ matrix.target }}
117+
118+
- uses: actions/download-artifact@v4
119+
with:
120+
name: frontend-build-${{ github.sha }}
121+
path: frontend/dist
122+
123+
- uses: actions/cache@v4
124+
with:
125+
path: |
126+
~/.cargo/bin/
127+
~/.cargo/registry/index/
128+
~/.cargo/registry/cache/
129+
~/.cargo/git/db/
130+
backend/target/
131+
key: backend-${{ matrix.name }}-${{ hashFiles('backend/Cargo.toml') }}
132+
restore-keys: backend-${{ matrix.name }}-
133+
134+
- name: Build
135+
run: cargo build --release --locked --target ${{ matrix.target }} --manifest-path backend/Cargo.toml

.github/workflows/release.yml

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- run: rustup target add wasm32-unknown-unknown
3333
- uses: jetli/trunk-action@v0.5.0
3434
with:
35-
version: 'latest'
35+
version: "latest"
3636

3737
- uses: actions/cache/restore@v4
3838
with:
@@ -54,7 +54,7 @@ jobs:
5454
name: frontend-build-${{ github.ref_name }}
5555
path: frontend/dist
5656

57-
build:
57+
build-linux:
5858
name: Binaries for ${{ matrix.name }}
5959
needs: frontend
6060
runs-on: ubuntu-24.04
@@ -141,9 +141,61 @@ jobs:
141141
name: ${{ matrix.platform }}-build-${{ github.ref_name }}
142142
path: bin/${{ matrix.platform }}
143143

144+
build-macos:
145+
name: Binaries for ${{ matrix.name }}
146+
needs: frontend
147+
runs-on: ${{ matrix.os }}
148+
149+
strategy:
150+
matrix:
151+
include:
152+
- name: aarch64-apple-darwin
153+
target: aarch64-apple-darwin
154+
os: macos-14
155+
156+
steps:
157+
- uses: actions/checkout@v4
158+
- run: rustup toolchain install stable --profile minimal
159+
- run: rustup target add ${{ matrix.target }}
160+
161+
- uses: actions/download-artifact@v4
162+
with:
163+
name: frontend-build-${{ github.ref_name }}
164+
path: frontend/dist
165+
166+
- uses: actions/cache/restore@v4
167+
with:
168+
path: |
169+
~/.cargo/bin/
170+
~/.cargo/registry/index/
171+
~/.cargo/registry/cache/
172+
~/.cargo/git/db/
173+
backend/target/
174+
key: backend-${{ matrix.name }}-${{ hashFiles('backend/Cargo.toml') }}
175+
restore-keys: backend-${{ matrix.name }}-
176+
177+
- name: Build
178+
run: cargo build --release --locked --target ${{ matrix.target }} --manifest-path backend/Cargo.toml
179+
180+
- name: Copy binaries
181+
shell: bash
182+
run: |
183+
mkdir -p bin
184+
src="backend/target/${{ matrix.target }}/release/mailcrab-backend"
185+
dst="bin/mailcrab-${{ matrix.name }}-${{ github.ref_name }}"
186+
cp "$src" "$dst"
187+
shasum -a 256 -b "$dst" > "$dst.sha256"
188+
189+
- uses: softprops/action-gh-release@v1
190+
with:
191+
draft: true
192+
files: bin/mailcrab-*
193+
env:
194+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
195+
144196
release:
145197
name: Release
146-
needs: build
198+
needs: [build-linux, build-macos]
147199
runs-on: ubuntu-24.04
148200

149201
steps:

0 commit comments

Comments
 (0)