Skip to content

Commit 55d24cb

Browse files
authored
Building using a build matrix (#4)
1 parent 8f02a57 commit 55d24cb

File tree

2 files changed

+31
-35
lines changed

2 files changed

+31
-35
lines changed

.github/workflows/build.yml

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,41 @@ env:
1515
CARGO_TERM_COLOR: always
1616

1717
jobs:
18-
build-linux:
19-
runs-on: ubuntu-latest
18+
build:
19+
strategy:
20+
matrix:
21+
target:
22+
- arch: x86_64-unknown-linux-gnu
23+
runs-on: ubuntu-latest
24+
- arch: aarch64-apple-darwin
25+
runs-on: macos-latest
26+
- arch: x86_64-apple-darwin
27+
runs-on: macos-latest
28+
- arch: wasm32-wasip2
29+
runs-on: macos-latest
30+
skip-test: true
31+
ext: .wasm
32+
runs-on: ${{ matrix.target.runs-on }}
2033
steps:
2134
- uses: actions/checkout@v4
2235
with:
2336
submodules: 'true'
37+
- name: Prepare target
38+
run: rustup target add ${{ matrix.target.arch }}
2439
- name: Build
25-
run: cargo build --release --verbose
40+
run: cargo build --target=${{ matrix.target.arch }} --release --verbose
2641
- name: Run tests
27-
run: cargo test --verbose
28-
- name: Archive csaf-validator (linux amd64)
42+
run: cargo test --target=${{ matrix.target.arch }} --verbose
43+
if: ${{ matrix.target.skip-test != true }}
44+
- name: Archive csaf-validator (${{ matrix.target.arch }})
2945
uses: actions/upload-artifact@v4
3046
with:
31-
name: csaf-validator-linux-amd64
32-
path: target/release/csaf-validator
33-
build-macos:
34-
runs-on: macos-latest
35-
steps:
36-
- uses: actions/checkout@v4
37-
with:
38-
submodules: 'true'
39-
- name: Build
40-
run: cargo build --release --verbose
41-
- name: Run tests
42-
run: cargo test --verbose
43-
- name: Archive csaf-validator (macos arm64)
44-
uses: actions/upload-artifact@v4
45-
with:
46-
name: csaf-validator-macos-arm64
47-
path: target/release/csaf-validator
47+
name: csaf-validator-${{ matrix.target.arch }}
48+
path: target/${{ matrix.target.arch }}/release/csaf-validator${{ matrix.target.ext }}
4849
publish:
4950
runs-on: ubuntu-latest
5051
needs:
51-
- build-macos
52-
- build-linux
52+
- build
5353
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'beta') && !contains(github.ref, 'alpha')
5454
steps:
5555
- name: Determine Version
@@ -67,16 +67,12 @@ jobs:
6767
echo "version=$VERSION" >> $GITHUB_ENV
6868
- uses: actions/download-artifact@v4
6969
with:
70-
name: csaf-validator-linux-amd64
71-
path: csaf-validator-linux-amd64
72-
- uses: actions/download-artifact@v4
73-
with:
74-
name: csaf-validator-macos-arm64
75-
path: csaf-validator-macos-arm64
70+
path: csaf-validator
71+
pattern: csaf-validator-*
7672
- run: |
77-
# just some magic to make the released files work with multiple platforms
78-
mv csaf-validator-linux-amd64/csaf-validator csaf-validator-linux-amd64/csaf-validator-linux-amd64
79-
mv csaf-validator-macos-arm64/csaf-validator csaf-validator-macos-arm64/csaf-validator-macos-arm64
73+
# zip each folder
74+
ls csaf-validator | xargs -I {} zip {}.zip -rj csaf-validator/{}
75+
ls csaf-validator-*.zip
8076
- name: Create Release
8177
id: create_release
8278
uses: softprops/action-gh-release@v2
@@ -87,4 +83,4 @@ jobs:
8783
prerelease: false
8884
fail_on_unmatched_files: true
8985
files: |
90-
csaf-validator-*/csaf-validator-*
86+
csaf-validator-*.zip

csaf

Submodule csaf updated 46 files

0 commit comments

Comments
 (0)