|
| 1 | +name: Build and Upload Executables |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + release: |
| 8 | + types: [published] |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + name: Build for ${{ matrix.target }} |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + include: |
| 17 | + - target: x86_64-unknown-linux-musl |
| 18 | + os: ubuntu-latest |
| 19 | + artifact_suffix: "" |
| 20 | + - target: aarch64-unknown-linux-musl |
| 21 | + os: ubuntu-latest |
| 22 | + artifact_suffix: "" |
| 23 | + - target: aarch64-apple-darwin |
| 24 | + os: macos-latest |
| 25 | + artifact_suffix: "" |
| 26 | + - target: x86_64-pc-windows-msvc |
| 27 | + os: windows-latest |
| 28 | + artifact_suffix: ".exe" |
| 29 | + |
| 30 | + steps: |
| 31 | + - name: Checkout repository |
| 32 | + uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Install Rust toolchain |
| 35 | + uses: dtolnay/rust-toolchain@stable |
| 36 | + with: |
| 37 | + targets: ${{ matrix.target }} |
| 38 | + |
| 39 | + - name: Install dependencies for Linux builds |
| 40 | + if: matrix.os == 'ubuntu-latest' |
| 41 | + run: | |
| 42 | + sudo apt-get update -y |
| 43 | + sudo apt-get install -y musl-tools |
| 44 | + if [ "${{ matrix.target }}" = "aarch64-unknown-linux-musl" ]; then |
| 45 | + sudo apt-get install -y gcc-aarch64-linux-gnu |
| 46 | + fi |
| 47 | +
|
| 48 | + - name: Build executable |
| 49 | + run: cargo build --release --target ${{ matrix.target }} |
| 50 | + env: |
| 51 | + CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: musl-gcc |
| 52 | + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc |
| 53 | + |
| 54 | + - name: Upload executable |
| 55 | + uses: actions/upload-artifact@v4 |
| 56 | + with: |
| 57 | + name: faucet-${{ matrix.target }} |
| 58 | + path: target/${{ matrix.target }}/release/faucet${{ matrix.artifact_suffix }} |
0 commit comments