|
| 1 | +name: Build and release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v**" |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: write-all |
| 10 | + |
| 11 | +env: |
| 12 | + CRATE_NAME: zippo |
| 13 | + GITHUB_TOKEN: ${{ github.token }} |
| 14 | + RUST_BACKTRACE: 1 |
| 15 | + |
| 16 | +jobs: |
| 17 | + test: |
| 18 | + name: ${{ matrix.platform.os_name }} || nightly |
| 19 | + runs-on: ${{ matrix.platform.os }} |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + platform: |
| 24 | + - os_name: linux-x86_64 |
| 25 | + os: ubuntu-20.04 |
| 26 | + target: x86_64-unknown-linux-musl |
| 27 | + bin: zippo-linux-x86_64-musl |
| 28 | + - os_name: linux-arm |
| 29 | + os: ubuntu-20.04 |
| 30 | + target: arm-unknown-linux-musleabi |
| 31 | + bin: zippo-linux-arm-musl |
| 32 | + - os_name: linux-i686 |
| 33 | + os: ubuntu-20.04 |
| 34 | + target: i686-unknown-linux-musl |
| 35 | + bin: zippo-linux-i686-musl |
| 36 | + skip_tests: true |
| 37 | + - os_name: windows-aarch64 |
| 38 | + os: windows-latest |
| 39 | + target: aarch64-pc-windows-msvc |
| 40 | + bin: zippo-windows-aarch64.exe |
| 41 | + skip_tests: true |
| 42 | + - os_name: windows-i686 |
| 43 | + os: windows-latest |
| 44 | + target: i686-pc-windows-msvc |
| 45 | + bin: zippo-windows-i686.exe |
| 46 | + skip_tests: true |
| 47 | + - os_name: windows-x86_64 |
| 48 | + os: windows-latest |
| 49 | + target: x86_64-pc-windows-msvc |
| 50 | + bin: zippo-windows-x86_64.exe |
| 51 | + - os_name: macOS-x86_64 |
| 52 | + os: macOS-latest |
| 53 | + target: x86_64-apple-darwin |
| 54 | + bin: zippo-darwin-x86_64 |
| 55 | + - os_name: macOS-aarch64 |
| 56 | + os: macOS-latest |
| 57 | + target: aarch64-apple-darwin |
| 58 | + bin: zippo-darwin-aarch64 |
| 59 | + skip_tests: true |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v3 |
| 62 | + - name: Cache cargo & target directories |
| 63 | + uses: Swatinem/rust-cache@v2 |
| 64 | + - name: Install musl-tools on linux |
| 65 | + run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools |
| 66 | + if: contains(matrix.platform.target, 'musl') |
| 67 | + - name: Build binary |
| 68 | + uses: houseabsolute/actions-rust-cross@v0 |
| 69 | + with: |
| 70 | + command: "build" |
| 71 | + target: ${{ matrix.platform.target }} |
| 72 | + toolchain: nightly |
| 73 | + args: "--locked --release" |
| 74 | + strip: true |
| 75 | + - name: Package as archive |
| 76 | + shell: bash |
| 77 | + run: | |
| 78 | + cd target/${{ matrix.platform.target }}/release |
| 79 | + if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then |
| 80 | + mv zippo.exe ${{ matrix.platform.bin }} |
| 81 | + else |
| 82 | + mv zippo ${{ matrix.platform.bin }} |
| 83 | + fi |
| 84 | + cd - |
| 85 | + - name: Publish GitHub release |
| 86 | + uses: softprops/action-gh-release@v1 |
| 87 | + with: |
| 88 | + draft: true |
| 89 | + files: "target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}" |
0 commit comments