Commit 94999dc4c0

94999dc4c0e23c4979128355b0b009e8cfa3b221

parent: 54cb7991be

Unregistered key

Ulyssa <git@ulyssa.dev> · 2024-08-16 17:06 UTC
committer: <noreply@github.com>

Build cross-platform binaries and packages of main (#323)

Layout: unified · split

.github/workflows/binaries.yml added +94
@@ -0,0 +1,94 @@
1on:
2 push:
3 branches:
4 - main
5
6name: Binaries
7
8jobs:
9 package:
10 strategy:
11 matrix:
12 platform: [ubuntu-latest, windows-latest, macos-latest]
13 arch: [x86_64, aarch64]
14 exclude:
15 - platform: windows-latest
16 arch: aarch64
17 include:
18 - platform: ubuntu-latest
19 arch: x86_64
20 triple: unknown-linux-musl
21 - platform: ubuntu-latest
22 arch: aarch64
23 triple: unknown-linux-gnu
24 - platform: macos-latest
25 triple: apple-darwin
26 - platform: windows-latest
27 triple: pc-windows-msvc
28 runs-on: ${{ matrix.platform }}
29 env:
30 TARGET: ${{ matrix.arch }}-${{ matrix.triple }}
31 SCCACHE_GHA_ENABLED: "true"
32 RUSTC_WRAPPER: "sccache"
33 steps:
34 - name: Checkout code
35 uses: actions/checkout@v3
36 with:
37 submodules: true
38 - name: Install Rust (stable)
39 uses: dtolnay/rust-toolchain@stable
40 with:
41 targets: ${{ env.TARGET }}
42 - name: Install C cross-compilation toolchain
43 if: matrix.platform == 'ubuntu-latest'
44 run: |
45 sudo apt-get update
46 sudo apt install -f -y build-essential crossbuild-essential-arm64 musl-dev
47 # Cross-compilation env vars for x86_64-unknown-linux-musl
48 echo CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=x86_64-linux-musl-gcc >> $GITHUB_ENV
49 echo AR_x86_64_unknown_linux_musl=x86_64-linux-gnu-ar >> $GITHUB_ENV
50 echo CC_x86_64_unknown_linux_musl=x86_64-linux-musl-gcc >> $GITHUB_ENV
51 echo CXX_x86_64_unknown_linux_musl=x86_64-linux-gnu-g++ >> $GITHUB_ENV
52 # Cross-compilation env vars for aarch64-unknown-linux-gnu
53 echo CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc >> $GITHUB_ENV
54 echo AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar >> $GITHUB_ENV
55 echo CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc >> $GITHUB_ENV
56 echo CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ >> $GITHUB_ENV
57 - name: Cache cargo registry
58 uses: actions/cache@v3
59 with:
60 path: ~/.cargo/registry
61 key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
62 - name: Run sccache-cache
63 uses: mozilla-actions/sccache-action@v0.0.3
64 - name: 'Build: binary'
65 run: cargo build --release --locked --target ${{ env.TARGET }}
66 - name: 'Upload: binary'
67 uses: actions/upload-artifact@v4
68 with:
69 name: iamb-${{ env.TARGET }}-binary
70 path: |
71 ./target/${{ env.TARGET }}/release/iamb
72 ./target/${{ env.TARGET }}/release/iamb.exe
73 - name: 'Package: deb'
74 if: matrix.platform == 'ubuntu-latest'
75 run: |
76 cargo install --locked cargo-deb
77 cargo deb --no-strip --target ${{ env.TARGET }}
78 - name: 'Upload: deb'
79 if: matrix.platform == 'ubuntu-latest'
80 uses: actions/upload-artifact@v4
81 with:
82 name: iamb-${{ env.TARGET }}-deb
83 path: ./target/${{ env.TARGET }}/debian/iamb*.deb
84 - name: 'Package: rpm'
85 if: matrix.platform == 'ubuntu-latest'
86 run: |
87 cargo install --locked cargo-generate-rpm
88 cargo generate-rpm --target ${{ env.TARGET }}
89 - name: 'Upload: rpm'
90 if: matrix.platform == 'ubuntu-latest'
91 uses: actions/upload-artifact@v4
92 with:
93 name: iamb-${{ env.TARGET }}-rpm
94 path: ./target/${{ env.TARGET }}/generate-rpm/iamb*.rpm
.github/workflows/ci.yml −9
@@ -45,12 +45,3 @@ jobs:
4545 reporter: 'github-check'
4646 - name: Run tests
4747 run: cargo test --locked
48 - name: Build artifacts
49 run: cargo build --release --locked
50 - name: Upload artifacts
51 uses: actions/upload-artifact@master
52 with:
53 name: iamb-${{ matrix.platform }}
54 path: |
55 ./target/release/iamb
56 ./target/release/iamb.exe