1- name : Modulr Agent Build & Test
1+ name : Modulr Agent Build & Test (Multi-Arch)
22
33on :
44 push :
77 pull_request :
88
99jobs :
10- build-and-test :
10+ build :
1111 runs-on : ubuntu-latest
1212 strategy :
1313 matrix :
14- arch : [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf]
14+ target : [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf]
15+
1516 steps :
1617 - name : Checkout code
17- uses : actions/checkout@v3
18+ uses : actions/checkout@v4
1819
19- - name : Set up Rust
20- uses : actions/setup-rust@v2
20+ - name : Set up Rust toolchain
21+ uses : actions-rust-lang /setup-rust-toolchain@v1
2122 with :
22- rust-version : stable
23+ toolchain : stable
2324
24- - name : Add target for cross-compilation
25- run : rustup target add ${{ matrix.arch }}
25+ - name : Cache Cargo registry and target
26+ uses : actions/cache@v4
27+ with :
28+ path : |
29+ ~/.cargo/registry
30+ ~/.cargo/git
31+ target
32+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
2633
2734 - name : Install system dependencies
2835 run : |
@@ -38,17 +45,18 @@ jobs:
3845 libgstrtspserver-1.0-dev \
3946 libges-1.0-dev
4047
41- - name : Build project
42- run : |
43- echo "Building for target: ${{ matrix.arch }}"
44- cargo build --release --target ${{ matrix.arch }}
48+ - name : Add target if needed
49+ run : rustup target add ${{ matrix.target }}
50+
51+ - name : Build (release)
52+ run : cargo build --release --target ${{ matrix.target }}
4553
46- - name : Run tests
47- if : matrix.arch == 'x86_64-unknown-linux-gnu'
54+ - name : Run tests (only on x86_64)
55+ if : matrix.target == 'x86_64-unknown-linux-gnu'
4856 run : cargo test --release
4957
5058 - name : Upload build artifacts
51- uses : actions/upload-artifact@v3
59+ uses : actions/upload-artifact@v5
5260 with :
53- name : build-${{ matrix.arch }}
54- path : target/${{ matrix.arch }}/release/
61+ name : " rust- build-${{ matrix.target }}"
62+ path : target/${{ matrix.target }}/release/
0 commit comments