Skip to content

feat: update

feat: update #2

Workflow file for this run

name: Build and Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
name: Build and Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [stable, beta, nightly]
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Cache Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin
target
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Compile the project
run: cargo build --release
- name: Run tests
run: cargo test --verbose
- name: Package binary (only for release builds)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: |
mkdir -p dist
if [[ "${{ runner.os }}" == "Windows" ]]; then
cp target/release/afptool-rs.exe dist/
else
cp target/release/afptool-rs dist/
fi
- name: Upload Release Artifacts
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
with:
name: afptool-rs-${{ matrix.os }}
path: dist/