2021-03-24 00:11:48 -04:00
|
|
|
name: "Build swap and asb release binaries"
|
2021-02-22 23:25:39 -05:00
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [created]
|
|
|
|
|
|
|
|
jobs:
|
2021-03-24 00:11:48 -04:00
|
|
|
build_binaries:
|
2024-05-27 06:19:13 -04:00
|
|
|
name: Build
|
2021-02-22 23:25:39 -05:00
|
|
|
strategy:
|
2024-05-27 06:19:13 -04:00
|
|
|
fail-fast: false
|
2021-02-22 23:25:39 -05:00
|
|
|
matrix:
|
|
|
|
include:
|
2021-03-11 19:25:30 -05:00
|
|
|
- bin: swap
|
|
|
|
target: x86_64-unknown-linux-gnu
|
2021-03-03 07:39:45 -05:00
|
|
|
os: ubuntu-latest
|
2021-03-03 23:16:33 -05:00
|
|
|
archive_ext: tar
|
2021-05-24 03:26:03 -04:00
|
|
|
- bin: swap
|
|
|
|
target: armv7-unknown-linux-gnueabihf
|
|
|
|
os: ubuntu-latest
|
|
|
|
archive_ext: tar
|
2021-03-11 19:25:30 -05:00
|
|
|
- bin: swap
|
|
|
|
target: x86_64-apple-darwin
|
2024-04-30 04:17:15 -04:00
|
|
|
os: macos-12
|
2024-05-29 05:58:28 -04:00
|
|
|
archive_ext: tar
|
2024-04-30 04:17:15 -04:00
|
|
|
- bin: swap
|
|
|
|
target: aarch64-apple-darwin
|
2021-02-22 23:25:39 -05:00
|
|
|
os: macos-latest
|
2021-03-03 23:16:33 -05:00
|
|
|
archive_ext: tar
|
2021-03-11 19:25:30 -05:00
|
|
|
- bin: swap
|
|
|
|
target: x86_64-pc-windows-msvc
|
|
|
|
os: windows-latest
|
|
|
|
archive_ext: zip
|
|
|
|
- bin: asb
|
|
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
os: ubuntu-latest
|
|
|
|
archive_ext: tar
|
|
|
|
- bin: asb
|
|
|
|
target: armv7-unknown-linux-gnueabihf
|
|
|
|
os: ubuntu-latest
|
|
|
|
archive_ext: tar
|
|
|
|
- bin: asb
|
|
|
|
target: x86_64-apple-darwin
|
2024-04-30 04:17:15 -04:00
|
|
|
os: macos-12
|
|
|
|
archive_ext: tar
|
|
|
|
- bin: asb
|
|
|
|
target: aarch64-apple-darwin
|
2021-03-11 19:25:30 -05:00
|
|
|
os: macos-latest
|
|
|
|
archive_ext: tar
|
|
|
|
- bin: asb
|
|
|
|
target: x86_64-pc-windows-msvc
|
2021-03-03 07:06:12 -05:00
|
|
|
os: windows-latest
|
2021-03-03 23:16:33 -05:00
|
|
|
archive_ext: zip
|
2021-02-22 23:25:39 -05:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout tagged commit
|
2024-05-17 07:12:37 -04:00
|
|
|
uses: actions/checkout@v4.1.6
|
2021-02-22 23:25:39 -05:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.release.target_commitish }}
|
|
|
|
token: ${{ secrets.BOTTY_GITHUB_TOKEN }}
|
|
|
|
|
2024-01-15 06:38:18 -05:00
|
|
|
- uses: Swatinem/rust-cache@v2.7.3
|
2021-03-04 01:47:39 -05:00
|
|
|
|
2023-01-10 07:43:07 -05:00
|
|
|
- uses: dtolnay/rust-toolchain@master
|
2022-11-25 11:03:57 -05:00
|
|
|
with:
|
2024-05-27 05:03:20 -04:00
|
|
|
toolchain: "1.74"
|
2024-05-27 06:04:04 -04:00
|
|
|
|
2024-05-27 06:19:13 -04:00
|
|
|
- name: Cross Build ${{ matrix.target }} ${{ matrix.bin }} binary
|
|
|
|
if: matrix.target == 'armv7-unknown-linux-gnueabihf'
|
|
|
|
run: |
|
|
|
|
curl -L "https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-gnu.tar.gz" | tar xzv
|
|
|
|
sudo mv cross /usr/bin
|
|
|
|
sudo mv cross-util /usr/bin
|
|
|
|
cross build --target=${{ matrix.target }} --release --package swap --bin ${{ matrix.bin }}
|
2021-03-11 19:25:30 -05:00
|
|
|
|
|
|
|
- name: Build ${{ matrix.target }} ${{ matrix.bin }} release binary
|
2024-05-27 06:19:13 -04:00
|
|
|
if: matrix.target != 'armv7-unknown-linux-gnueabihf'
|
2024-05-27 06:04:04 -04:00
|
|
|
run: cargo build --target=${{ matrix.target }} --release --package swap --bin ${{ matrix.bin }}
|
2021-02-22 23:25:39 -05:00
|
|
|
|
2021-03-01 18:33:44 -05:00
|
|
|
- name: Smoke test the binary
|
2024-05-27 06:04:04 -04:00
|
|
|
if: matrix.target != 'armv7-unknown-linux-gnueabihf'
|
2021-03-11 19:25:30 -05:00
|
|
|
run: target/${{ matrix.target }}/release/${{ matrix.bin }} --help
|
2021-03-01 18:33:44 -05:00
|
|
|
|
2021-03-03 23:16:33 -05:00
|
|
|
- id: create-archive-name
|
|
|
|
shell: python # Use python to have a prettier name for the archive on Windows.
|
|
|
|
run: |
|
|
|
|
import platform
|
|
|
|
os_info = platform.uname()
|
2021-03-03 07:06:12 -05:00
|
|
|
|
2021-03-03 23:16:33 -05:00
|
|
|
arch = os_info.machine
|
2021-02-22 23:25:39 -05:00
|
|
|
|
2021-03-03 23:16:33 -05:00
|
|
|
triple = "${{ matrix.target }}".split("-")
|
|
|
|
arch = triple[0]
|
2021-03-03 07:39:45 -05:00
|
|
|
|
2021-03-11 19:25:30 -05:00
|
|
|
archive_name=f'${{ matrix.bin }}_${{ github.event.release.tag_name }}_{os_info.system}_{arch}.${{ matrix.archive_ext }}'
|
2021-03-03 07:06:12 -05:00
|
|
|
|
2024-05-28 06:32:04 -04:00
|
|
|
print(f'::set-output name=archive::{archive_name}')
|
2021-03-03 23:16:33 -05:00
|
|
|
|
|
|
|
- name: Pack macos archive
|
2024-05-28 06:21:19 -04:00
|
|
|
if: startsWith(matrix.os, 'macos')
|
2021-03-03 23:16:33 -05:00
|
|
|
shell: bash
|
2021-03-11 19:25:30 -05:00
|
|
|
run: gtar -C ./target/${{ matrix.target }}/release --create --file=${{ steps.create-archive-name.outputs.archive }} ${{ matrix.bin }}
|
2021-03-03 23:16:33 -05:00
|
|
|
|
|
|
|
- name: Pack linux archive
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
shell: bash
|
2021-03-11 19:25:30 -05:00
|
|
|
run: tar -C ./target/${{ matrix.target }}/release --create --file=${{ steps.create-archive-name.outputs.archive }} ${{ matrix.bin }}
|
2021-03-03 23:16:33 -05:00
|
|
|
|
|
|
|
- name: Pack windows archive
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2021-03-11 19:25:30 -05:00
|
|
|
cp target/${{ matrix.target }}/release/${{ matrix.bin }}.exe ./${{ matrix.bin }}.exe
|
|
|
|
7z a -tzip ${{ steps.create-archive-name.outputs.archive }} ./${{ matrix.bin }}.exe
|
2021-03-03 07:39:45 -05:00
|
|
|
|
2021-03-03 23:16:33 -05:00
|
|
|
- name: Upload archive
|
2021-05-12 02:07:36 -04:00
|
|
|
uses: actions/upload-release-asset@v1.0.2
|
2021-02-22 23:25:39 -05:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.BOTTY_GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ github.event.release.upload_url }}
|
2021-03-03 23:16:33 -05:00
|
|
|
asset_path: ./${{ steps.create-archive-name.outputs.archive }}
|
|
|
|
asset_name: ${{ steps.create-archive-name.outputs.archive }}
|
2021-02-26 02:11:18 -05:00
|
|
|
asset_content_type: application/gzip
|