name: release
on:
release:
types: [published]
env:
CARGO_TERM_COLOR: always
jobs:
all-go:
name: all systems go
runs-on: ubuntu-latest
needs:
- test
- cover
- build
- release
steps:
- run: exit 0
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
architecture: x64
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
architecture: x86
target: i686-unknown-linux-gnu
- os: windows-latest
architecture: x64
target: x86_64-pc-windows-msvc
- os: windows-latest
architecture: x86
target: i686-pc-windows-msvc
- os: macos-latest
architecture: arm64
target: aarch64-apple-darwin
- os: macos-latest
architecture: x64
target: x86_64-apple-darwin
steps:
- uses: actions/checkout@v6
- name: Install Rust Toolchain
run: |
rustup set profile minimal
rustup toolchain install stable --profile minimal
rustup default stable
rustup component add llvm-tools-preview
rustup target add ${{ matrix.target }}
- name: Install 32-bit Support
if: matrix.target == 'i686-unknown-linux-gnu'
run: sudo apt-get update && sudo apt-get install -y gcc-multilib
- name: Run Tests
run: cargo test --target ${{ matrix.target }} --verbose -- --nocapture
cover:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- name: Generate Code Coverage Report
run: cargo llvm-cov --all-features --workspace --fail-under-functions 80 --fail-under-lines 80 --fail-under-regions 80 --lcov --output-path ./target/lcov.info
- name: Publish Coverage Report
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./target/lcov.info
verbose: true
fail_ci_if_error: true
build:
needs:
- test
- cover
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
architecture: x64
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
architecture: x86
target: i686-unknown-linux-gnu
- os: windows-latest
architecture: x64
target: x86_64-pc-windows-msvc
- os: windows-latest
architecture: x86
target: i686-pc-windows-msvc
- os: macos-latest
architecture: arm64
target: aarch64-apple-darwin
- os: macos-latest
architecture: x64
target: x86_64-apple-darwin
steps:
- uses: actions/checkout@v6
- name: Install Rust Toolchain
run: |
rustup set profile minimal
rustup toolchain install stable --profile minimal
rustup default stable
rustup component add llvm-tools-preview
rustup target add ${{ matrix.target }}
- name: Install 32-bit Support
if: matrix.target == 'i686-unknown-linux-gnu'
run: sudo apt-get update && sudo apt-get install -y gcc-multilib
- name: Build
run: cargo build --target ${{ matrix.target }} --release --verbose
- name: Upload Artifacts
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.os }}-${{ matrix.architecture }}
path: target/${{ matrix.target }}/release/
release:
needs:
- test
- cover
- build
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: ubuntu-latest
architecture: x64
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
architecture: x86
target: i686-unknown-linux-gnu
- os: windows-latest
architecture: x64
target: x86_64-pc-windows-msvc
- os: windows-latest
architecture: x86
target: i686-pc-windows-msvc
- os: macos-latest
architecture: arm64
target: aarch64-apple-darwin
- os: macos-latest
architecture: x64
target: x86_64-apple-darwin
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Download Artifacts
uses: actions/download-artifact@v7
with:
name: ${{ matrix.os }}-${{ matrix.architecture }}
path: ${{ matrix.os }}-${{ matrix.architecture }}
- name: Set Build File Variables
id: vars
run: |
name=$(awk -F '= ' '/^\[package\]/{found=1} found && /^name/{gsub(/["]/, "", $2); print $2; exit}' Cargo.toml)
case "${{ matrix.os }}" in
*"ubuntu"*) os="ubuntu" ;;
*"windows"*) os="windows" ;;
*"macos"*) os="macos" ;;
esac
if [[ "$os" == "windows" ]]; then
ext=".exe"
else
ext=""
fi
echo "name=$name" >> $GITHUB_OUTPUT
echo "os=$os" >> $GITHUB_OUTPUT
echo "ext=$ext" >> $GITHUB_OUTPUT
- name: Prepare Artifacts
run: |
source=$(find ${{ matrix.os }}-${{ matrix.architecture }} -name "${{ steps.vars.outputs.name }}${{ steps.vars.outputs.ext }}" -type f | head -n 1)
binary=paq${{ steps.vars.outputs.ext }}
archive=${{ steps.vars.outputs.name }}-${{ steps.vars.outputs.os }}-${{ matrix.architecture }}.zip
mv "$source" "$binary"
zip "$archive" "$binary"
- name: Upload Artifact to Release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
${{ steps.vars.outputs.name }}-${{ steps.vars.outputs.os }}-${{ matrix.architecture }}.zip