Skip to content

Commit c684eca

Browse files
authored
fix(ci): update workflows for automatic platform detection (#121)
1 parent 0a22062 commit c684eca

File tree

2 files changed

+32
-19
lines changed

2 files changed

+32
-19
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
- '**/*.rs'
3737
- 'Cargo.toml'
3838
- 'Cargo.lock'
39+
- '.github/workflows/*.yml'
3940
website:
4041
- 'website/**'
4142
@@ -89,20 +90,44 @@ jobs:
8990
- run: cargo check --all-targets --all-features
9091

9192
rust-build:
92-
name: Rust Build
93+
name: Build ${{ matrix.target }}
9394
needs: changes
9495
if: needs.changes.outputs.rust == 'true'
95-
runs-on: macos-latest
96-
defaults:
97-
run:
98-
working-directory: ./cli
96+
runs-on: ${{ matrix.os }}
97+
strategy:
98+
fail-fast: false
99+
matrix:
100+
include:
101+
- target: x86_64-apple-darwin
102+
os: macos-latest
103+
- target: aarch64-apple-darwin
104+
os: macos-latest
105+
- target: x86_64-unknown-linux-gnu
106+
os: ubuntu-latest
107+
use-cross: true
108+
- target: aarch64-unknown-linux-gnu
109+
os: ubuntu-latest
110+
use-cross: true
111+
- target: x86_64-unknown-linux-musl
112+
os: ubuntu-latest
113+
use-cross: true
114+
- target: aarch64-unknown-linux-musl
115+
os: ubuntu-latest
116+
use-cross: true
99117
steps:
100118
- uses: actions/checkout@v6
101119
- uses: dtolnay/rust-toolchain@stable
120+
with:
121+
targets: ${{ matrix.target }}
122+
- name: Install cross
123+
if: matrix.use-cross
124+
run: cargo install cross --git https://github.com/cross-rs/cross
102125
- uses: Swatinem/rust-cache@v2
103126
with:
104127
workspaces: cli
105-
- run: cargo build --release
128+
key: ${{ matrix.target }}
129+
- name: Build
130+
run: ${{ matrix.use-cross && 'cross' || 'cargo' }} build --release --target ${{ matrix.target }} -p jolt-tui
106131

107132
website-lint:
108133
name: Website Lint

.github/workflows/release.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,27 @@ jobs:
2020
include:
2121
- target: x86_64-apple-darwin
2222
os: macos-latest
23-
features: macos
2423
homebrew_os: darwin
2524
homebrew_arch: amd64
2625
- target: aarch64-apple-darwin
2726
os: macos-latest
28-
features: macos
2927
homebrew_os: darwin
3028
homebrew_arch: arm64
3129
- target: x86_64-unknown-linux-gnu
3230
os: ubuntu-latest
33-
features: linux
3431
use-cross: true
3532
homebrew_os: linux
3633
homebrew_arch: amd64
3734
- target: aarch64-unknown-linux-gnu
3835
os: ubuntu-latest
39-
features: linux
4036
use-cross: true
4137
homebrew_os: linux
4238
homebrew_arch: arm64
4339
- target: x86_64-unknown-linux-musl
4440
os: ubuntu-latest
45-
features: linux
4641
use-cross: true
4742
- target: aarch64-unknown-linux-musl
4843
os: ubuntu-latest
49-
features: linux
5044
use-cross: true
5145

5246
steps:
@@ -77,13 +71,7 @@ jobs:
7771
key: ${{ matrix.target }}
7872

7973
- name: Build binary
80-
run: |
81-
if [ "${{ matrix.use-cross }}" = "true" ]; then
82-
cross build --release --target ${{ matrix.target }} --no-default-features --features ${{ matrix.features }}
83-
else
84-
cargo build --release --target ${{ matrix.target }} --no-default-features --features ${{ matrix.features }}
85-
fi
86-
shell: bash
74+
run: ${{ matrix.use-cross && 'cross' || 'cargo' }} build --release --target ${{ matrix.target }} -p jolt-tui
8775

8876
- name: Prepare release artifacts
8977
run: |

0 commit comments

Comments
 (0)