|
| 1 | +name: Rust |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + lint: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + name: Check |
| 14 | + steps: |
| 15 | + - uses: dtolnay/rust-toolchain@stable |
| 16 | + - uses: Swatinem/rust-cache@v2 |
| 17 | + - uses: actions/checkout@v3 |
| 18 | + - run: | |
| 19 | + rustup component add rustfmt clippy |
| 20 | + cargo check |
| 21 | + cargo fmt --all -- --check |
| 22 | + cargo clippy -- -Dwarnings |
| 23 | + build-windows: |
| 24 | + runs-on: windows-latest |
| 25 | + name: Release build for Windows |
| 26 | + steps: |
| 27 | + - uses: dtolnay/rust-toolchain@stable |
| 28 | + - uses: Swatinem/rust-cache@v2 |
| 29 | + - uses: actions/checkout@v3 |
| 30 | + - name: Build release binary |
| 31 | + run: cargo build --release |
| 32 | + env: |
| 33 | + RUSTFLAGS: '-C target-feature=+crt-static' |
| 34 | + - uses: actions/upload-artifact@v3 |
| 35 | + with: |
| 36 | + name: awsbck-windows |
| 37 | + path: target/release/awsbck.exe |
| 38 | + |
| 39 | + build-macos: |
| 40 | + runs-on: macos-latest |
| 41 | + name: Release build for macOS |
| 42 | + steps: |
| 43 | + - uses: dtolnay/rust-toolchain@stable |
| 44 | + - uses: Swatinem/rust-cache@v2 |
| 45 | + - uses: actions/checkout@v3 |
| 46 | + - name: Build release binary |
| 47 | + run: cargo build --release |
| 48 | + env: |
| 49 | + LZMA_API_STATIC: 'true' |
| 50 | + - uses: actions/upload-artifact@v3 |
| 51 | + with: |
| 52 | + name: awsbck-macos |
| 53 | + path: target/release/awsbck |
| 54 | + |
| 55 | + build-linux: |
| 56 | + runs-on: ubuntu-latest |
| 57 | + name: Release build for linux x86_64 |
| 58 | + steps: |
| 59 | + - uses: dtolnay/rust-toolchain@stable |
| 60 | + with: |
| 61 | + targets: x86_64-unknown-linux-musl |
| 62 | + - uses: Swatinem/rust-cache@v2 |
| 63 | + - name: Install musl tools |
| 64 | + run: | |
| 65 | + sudo apt-get update |
| 66 | + sudo apt-get install -y --no-install-recommends musl-tools |
| 67 | + - uses: actions/checkout@v3 |
| 68 | + - name: Build release binary |
| 69 | + run: cargo build --release --target x86_64-unknown-linux-musl |
| 70 | + - uses: actions/upload-artifact@v3 |
| 71 | + with: |
| 72 | + name: awsbck-linux |
| 73 | + path: target/x86_64-unknown-linux-musl/release/awsbck |
| 74 | + |
| 75 | + build-arm: |
| 76 | + name: Release builds for linux ARM |
| 77 | + strategy: |
| 78 | + matrix: |
| 79 | + include: |
| 80 | + - target: aarch64-unknown-linux-musl |
| 81 | + arch: aarch64 |
| 82 | + - target: armv7-unknown-linux-gnueabihf |
| 83 | + arch: armv7 |
| 84 | + target: ['aarch64-unknown-linux-musl', 'armv7-unknown-linux-gnueabihf'] |
| 85 | + runs-on: ubuntu-latest |
| 86 | + steps: |
| 87 | + - uses: dtolnay/rust-toolchain@stable |
| 88 | + with: |
| 89 | + targets: ${{ matrix.target }} |
| 90 | + - uses: Swatinem/rust-cache@v2 |
| 91 | + - run: cargo install cross --git https://github.com/cross-rs/cross |
| 92 | + - uses: actions/checkout@v3 |
| 93 | + - run: cross build --release --target ${{ matrix.target }} |
| 94 | + - uses: actions/upload-artifact@v3 |
| 95 | + with: |
| 96 | + name: awsbck-${{ matrix.arch }} |
| 97 | + path: target/${{ matrix.target }}/release/awsbck |
0 commit comments