Skip to content

Commit 7e795a6

Browse files
Improvements to justfile and workflows (#73)
- Changes to `justfile` - Split `build-mac` in to `build-mac-intel` and `build-mac-arm` - Split `build-linux` in to `build-linux` and `build-win-gnu` - Seperate workflow, build, that runs when commits with changes to Rust or YAML files are pushed - The release workflow now uses the last successful build workflow's artefacts
1 parent 0544482 commit 7e795a6

File tree

3 files changed

+97
-75
lines changed

3 files changed

+97
-75
lines changed

.github/workflows/build.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
commits:
6+
paths:
7+
- "**.rs"
8+
- "**.yml"
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, macos-latest, windows-latest]
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: extractions/setup-just@v1
22+
23+
- name: Install Rust for macOS
24+
if: matrix.os == 'macos-latest'
25+
uses: actions-rs/toolchain@v1
26+
with:
27+
toolchain: stable
28+
target: aarch64-apple-darwin
29+
- name: Install Rust for Windows
30+
if: matrix.os == 'windows-latest'
31+
uses: actions-rs/toolchain@v1
32+
with:
33+
toolchain: stable
34+
- name: Install Rust for Linux
35+
if: matrix.os == 'ubuntu-latest'
36+
uses: actions-rs/toolchain@v1
37+
with:
38+
toolchain: stable
39+
target: x86_64-pc-windows-gnu
40+
41+
- name: Install Linux dependencies
42+
if: matrix.os == 'ubuntu-latest'
43+
run: |
44+
sudo apt-get update
45+
sudo apt-get install librust-gdk-dev gcc-mingw-w64-x86-64
46+
47+
- name: Lint code
48+
run: just lint
49+
50+
- name: Run tests
51+
uses: actions-rs/cargo@v1
52+
with:
53+
command: test
54+
55+
- name: Build macOS
56+
if: matrix.os == 'macos-latest'
57+
run: |
58+
just build-mac-intel
59+
just build-mac-arm
60+
- name: Build Windows
61+
if: matrix.os == 'windows-latest'
62+
run: just build-win
63+
- name: Build Linux
64+
if: matrix.os == 'ubuntu-latest'
65+
run: |
66+
just build-linux-nogui
67+
just build-win-gnu
68+
just build-linux
69+
70+
- name: Upload build artefacts
71+
uses: actions/upload-artifact@v3
72+
with:
73+
name: binaries
74+
path: out/ferium*.zip
75+
if-no-files-found: error

.github/workflows/release.yml

Lines changed: 4 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Release
1+
name: Publish and Release
22

33
# Only run when a tag is pushed
44
on:
@@ -7,72 +7,8 @@ on:
77
- "*"
88

99
jobs:
10-
build:
11-
runs-on: ${{ matrix.os }}
12-
strategy:
13-
matrix:
14-
os: [ubuntu-latest, macos-latest, windows-latest]
15-
env:
16-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17-
steps:
18-
- uses: actions/checkout@v3
19-
- uses: extractions/setup-just@v1
20-
21-
- name: Install Rust for macOS
22-
if: matrix.os == 'macos-latest'
23-
uses: actions-rs/toolchain@v1
24-
with:
25-
toolchain: stable
26-
target: aarch64-apple-darwin
27-
- name: Install Rust for Windows
28-
if: matrix.os == 'windows-latest'
29-
uses: actions-rs/toolchain@v1
30-
with:
31-
toolchain: stable
32-
- name: Install Rust for Linux
33-
if: matrix.os == 'ubuntu-latest'
34-
uses: actions-rs/toolchain@v1
35-
with:
36-
toolchain: stable
37-
target: x86_64-pc-windows-gnu
38-
39-
- name: Install Linux dependencies
40-
if: matrix.os == 'ubuntu-latest'
41-
run: |
42-
sudo apt-get update
43-
sudo apt-get install librust-gdk-dev gcc-mingw-w64-x86-64
44-
45-
- name: Lint code
46-
run: just lint
47-
48-
- name: Run tests
49-
uses: actions-rs/cargo@v1
50-
with:
51-
command: test
52-
53-
- name: Build macOS
54-
if: matrix.os == 'macos-latest'
55-
run: just build-mac
56-
- name: Build Windows
57-
if: matrix.os == 'windows-latest'
58-
run: just build-win
59-
- name: Build Linux
60-
if: matrix.os == 'ubuntu-latest'
61-
run: just build-linux
62-
- name: Build Linux NoGUI
63-
if: matrix.os == 'ubuntu-latest'
64-
run: just build-linux-nogui
65-
66-
- name: Upload build artefacts
67-
uses: actions/upload-artifact@v3
68-
with:
69-
name: binaries
70-
path: out/ferium*.zip
71-
if-no-files-found: error
72-
7310
publish:
7411
runs-on: ubuntu-latest
75-
needs: build
7612
env:
7713
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
7814
steps:
@@ -92,12 +28,13 @@ jobs:
9228

9329
release:
9430
runs-on: ubuntu-latest
95-
needs: build
9631
steps:
9732
- uses: actions/checkout@v3
9833
- name: Download artefacts
99-
uses: actions/download-artifact@v3
34+
uses: dawidd6/action-download-artifact@v2
10035
with:
36+
workflow_conclusion: success
37+
workflow: build.yml
10138
name: binaries
10239
path: ./out
10340
- name: Create sha256sum for scoop

justfile

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
default: install-dev
22
set windows-powershell := true
33

4-
# Build for macOS Intel and macOS Apple Silicon
5-
build-mac:
6-
rm -f out/ferium-macos-x64.zip out/ferium-macos-arm.zip
4+
# Build for macOS Intel
5+
build-mac-intel:
6+
rm -f out/ferium-macos-x64.zip
77
mkdir -p out
88
cargo build --target=x86_64-apple-darwin --release
9-
cargo build --target=aarch64-apple-darwin --release
109
zip -r out/ferium-macos-x64.zip -j target/x86_64-apple-darwin/release/ferium
10+
11+
# Build for macOS Apple Silicon
12+
build-mac-arm:
13+
rm -f out/ferium-macos-arm.zip
14+
mkdir -p out
15+
cargo build --target=aarch64-apple-darwin --release
1116
zip -r out/ferium-macos-arm.zip -j target/aarch64-apple-darwin/release/ferium
1217

1318
# Build for Windows MSVC
@@ -17,14 +22,19 @@ build-win:
1722
cargo build --target=x86_64-pc-windows-msvc --release
1823
Compress-Archive -Path "target\x86_64-pc-windows-msvc\release\ferium.exe" -DestinationPath "out\ferium-windows-msvc.zip"
1924

20-
# Build for GNU Linux and GNU Windows (e.g. cygwin)
21-
build-linux:
22-
rm -f out/ferium-linux-gnu.zip out/ferium-windows-gnu.zip
25+
# Build for Windows GNU (e.g. Cygwin, MinGW)
26+
build-win-gnu:
27+
rm -f out/ferium-windows-gnu.zip
2328
mkdir -p out
2429
cargo build --target=x86_64-pc-windows-gnu --release
30+
zip -r out/ferium-windows-gnu.zip -j target/x86_64-pc-windows-gnu/release/ferium.exe
31+
32+
# Build for GNU Linux
33+
build-linux:
34+
rm -f out/ferium-linux-gnu.zip
35+
mkdir -p out
2536
cargo build --target=x86_64-unknown-linux-gnu --release
2637
zip -r out/ferium-linux-gnu.zip -j target/x86_64-unknown-linux-gnu/release/ferium
27-
zip -r out/ferium-windows-gnu.zip -j target/x86_64-pc-windows-gnu/release/ferium.exe
2838

2939
# Build for GNU Linux without a GUI file dialog
3040
build-linux-nogui:

0 commit comments

Comments
 (0)