CD #72
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CD | |
on: | |
push: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
deploy: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- os: macOS-latest | |
target: x86_64-apple-darwin | |
- os: macOS-latest | |
target: aarch64-apple-darwin | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Setup musl | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
rustup target add ${{ matrix.target }} | |
sudo apt-get -qq update # prevent 404 when the "latest" image is changed | |
sudo apt -qq install musl-tools gcc-aarch64-linux-gnu | |
mkdir -p .cargo | |
cat << EOS > .cargo/config.toml | |
[target.aarch64-unknown-linux-musl] | |
linker = "aarch64-linux-gnu-gcc" | |
EOS | |
- name: Build | |
run: cargo build --all --release --target ${{ matrix.target }} --verbose | |
- name: Create an archive to maintain the file permission (in non-Windows environments) | |
if: matrix.target != 'x86_64-pc-windows-msvc' | |
run: | | |
tar -C target/${{ matrix.target }}/release -cvf rrr-${{ matrix.target }}.tar.xz rrr | |
- name: Create an archive to maintain the file permission (in Windows environments) | |
if: matrix.target == 'x86_64-pc-windows-msvc' | |
run: | | |
powershell Compress-Archive -Path target/${{ matrix.target }}/release/rrr.exe -DestinationPath rrr-${{ matrix.target }}.zip | |
- name: Upload artifacts (in non-Windows environments) | |
if: matrix.target != 'x86_64-pc-windows-msvc' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: rrr-${{ matrix.target }} | |
path: rrr-${{ matrix.target }}.tar.xz | |
- name: Upload artifacts (in Windows environments) | |
if: matrix.target == 'x86_64-pc-windows-msvc' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: rrr-${{ matrix.target }} | |
path: rrr-${{ matrix.target }}.zip |