Skip to content

Add GH actions workflow for building and linting #5

Add GH actions workflow for building and linting

Add GH actions workflow for building and linting #5

Workflow file for this run

name: Build and lint
on:
pull_request:
branches:
- main
workflow_call:
jobs:
build:
strategy:
matrix:
os-target:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
runs-on: ${{ matrix.os-target.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 100
- name: Setup rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.70.0
targets: ${{ matrix.os-target.target }}
- uses: Swatinem/rust-cache@v2
- name: Install aarch64-unknown-linux-gnu requisites
run: sudo apt update && sudo apt-get install g++-aarch64-linux-gnu -y
if: matrix.os-target.target == 'aarch64-unknown-linux-gnu'
- name: Run trag-track
run: cargo run -- --create-tag
- name: Run cargo build
run: cargo build --release --target ${{ matrix.os-target.target }}
- name: Upload artifacts for reuse in release job
uses: actions/upload-artifact@v3
with:
name: tag-track_${{ matrix.os-target.target }}
path: ${{ github.workspace }}/target/${{ matrix.os-target.target }}/release/tag-track${{ matrix.os-target.target == 'x86_64-pc-windows-msvc' && '.exe' || '' }}
if-no-files-found: error
retention-days: 5
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.70.0
components: clippy,rustfmt
- uses: Swatinem/rust-cache@v2
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Run rustfmt
run: cargo fmt --all -- --check