2021-03-24 04:11:48 +00:00
|
|
|
name: "Build swap and asb release binaries"
|
2021-02-23 04:25:39 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [created]
|
|
|
|
|
|
|
|
jobs:
|
2021-03-24 04:11:48 +00:00
|
|
|
build_binaries:
|
|
|
|
name: Build swap and asb binaries
|
2021-02-23 04:25:39 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
2021-03-12 00:25:30 +00:00
|
|
|
- bin: swap
|
|
|
|
target: x86_64-unknown-linux-gnu
|
2021-03-03 12:39:45 +00:00
|
|
|
os: ubuntu-latest
|
2021-03-04 04:16:33 +00:00
|
|
|
archive_ext: tar
|
2021-03-12 00:25:30 +00:00
|
|
|
- bin: swap
|
|
|
|
target: x86_64-apple-darwin
|
2021-02-23 04:25:39 +00:00
|
|
|
os: macos-latest
|
2021-03-04 04:16:33 +00:00
|
|
|
archive_ext: tar
|
2021-03-12 00:25:30 +00: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
|
|
|
|
os: macos-latest
|
|
|
|
archive_ext: tar
|
|
|
|
- bin: asb
|
|
|
|
target: x86_64-pc-windows-msvc
|
2021-03-03 12:06:12 +00:00
|
|
|
os: windows-latest
|
2021-03-04 04:16:33 +00:00
|
|
|
archive_ext: zip
|
2021-02-23 04:25:39 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout tagged commit
|
2021-05-12 06:07:41 +00:00
|
|
|
uses: actions/checkout@v2.3.4
|
2021-02-23 04:25:39 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.release.target_commitish }}
|
|
|
|
token: ${{ secrets.BOTTY_GITHUB_TOKEN }}
|
|
|
|
|
2021-03-04 06:47:39 +00:00
|
|
|
- uses: Swatinem/rust-cache@v1.2.0
|
|
|
|
|
2021-03-12 00:25:30 +00:00
|
|
|
- name: Install compiler for armhf arch
|
|
|
|
if: matrix.target == 'armv7-unknown-linux-gnueabihf'
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install gcc-arm-linux-gnueabihf
|
|
|
|
|
|
|
|
- name: Build ${{ matrix.target }} ${{ matrix.bin }} release binary
|
2021-03-15 02:42:21 +00:00
|
|
|
|
2021-03-12 00:25:30 +00:00
|
|
|
run: cargo build --target=${{ matrix.target }} --release --package swap --bin ${{ matrix.bin }}
|
2021-02-23 04:25:39 +00:00
|
|
|
|
2021-03-01 23:33:44 +00:00
|
|
|
- name: Smoke test the binary
|
2021-03-12 00:25:30 +00:00
|
|
|
if: matrix.target != 'armv7-unknown-linux-gnueabihf' # armv7-unknown-linux-gnueabihf is only cross-compiled, no smoke test
|
|
|
|
run: target/${{ matrix.target }}/release/${{ matrix.bin }} --help
|
2021-03-01 23:33:44 +00:00
|
|
|
|
2021-02-23 04:25:39 +00:00
|
|
|
# Remove once python 3 is the default
|
2021-04-13 07:46:17 +00:00
|
|
|
- uses: actions/setup-python@v2.2.2
|
2021-02-23 04:25:39 +00:00
|
|
|
with:
|
|
|
|
python-version: '3.x'
|
|
|
|
|
2021-03-04 04:16:33 +00: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 12:06:12 +00:00
|
|
|
|
2021-03-04 04:16:33 +00:00
|
|
|
arch = os_info.machine
|
2021-02-23 04:25:39 +00:00
|
|
|
|
2021-03-04 04:16:33 +00:00
|
|
|
triple = "${{ matrix.target }}".split("-")
|
|
|
|
arch = triple[0]
|
2021-03-03 12:39:45 +00:00
|
|
|
|
2021-03-12 00:25:30 +00:00
|
|
|
archive_name=f'${{ matrix.bin }}_${{ github.event.release.tag_name }}_{os_info.system}_{arch}.${{ matrix.archive_ext }}'
|
2021-03-03 12:06:12 +00:00
|
|
|
|
2021-03-04 04:16:33 +00:00
|
|
|
print(f'::set-output name=archive::{archive_name}')
|
|
|
|
|
|
|
|
- name: Pack macos archive
|
|
|
|
if: matrix.os == 'macos-latest'
|
|
|
|
shell: bash
|
2021-03-12 00:25:30 +00:00
|
|
|
run: gtar -C ./target/${{ matrix.target }}/release --create --file=${{ steps.create-archive-name.outputs.archive }} ${{ matrix.bin }}
|
2021-03-04 04:16:33 +00:00
|
|
|
|
|
|
|
- name: Pack linux archive
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
shell: bash
|
2021-03-12 00:25:30 +00:00
|
|
|
run: tar -C ./target/${{ matrix.target }}/release --create --file=${{ steps.create-archive-name.outputs.archive }} ${{ matrix.bin }}
|
2021-03-04 04:16:33 +00:00
|
|
|
|
|
|
|
- name: Pack windows archive
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2021-03-12 00:25:30 +00: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 12:39:45 +00:00
|
|
|
|
2021-03-04 04:16:33 +00:00
|
|
|
- name: Upload archive
|
2021-05-12 06:07:36 +00:00
|
|
|
uses: actions/upload-release-asset@v1.0.2
|
2021-02-23 04:25:39 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.BOTTY_GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ github.event.release.upload_url }}
|
2021-03-04 04:16:33 +00:00
|
|
|
asset_path: ./${{ steps.create-archive-name.outputs.archive }}
|
|
|
|
asset_name: ${{ steps.create-archive-name.outputs.archive }}
|
2021-02-26 07:11:18 +00:00
|
|
|
asset_content_type: application/gzip
|