Skip to content

Create node action project (#80) #61

Create node action project (#80)

Create node action project (#80) #61

name: Build, lint, and test
on:
pull_request:
branches:
- main
- "milestone/*"
workflow_call:
push:
branches:
- "milestone/*"
defaults:
run:
shell: bash
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
- name: Setup rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.71.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 -y g++-aarch64-linux-gnu
if: matrix.os-target.target == 'aarch64-unknown-linux-gnu'
- name: Run Tag Track
id: tag-track
uses: dloez/tag-track@main
with:
github-token: ${{ github.token }}
compile: true
use-cache: true
- name: Run cargo build
run: TAG_TRACK_VERSION=${{ steps.tag-track.outputs.new-version }} 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-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.71.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
- name: Run cargo test
run: cargo test --all