chore: replace unmaintained github action #73
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: Rust | |
on: | |
push: | |
release: | |
types: [created] | |
env: | |
CARGO_TERM_COLOR: always | |
defaults: | |
run: | |
# necessary for windows | |
shell: bash | |
jobs: | |
build: | |
runs-on: ${{ matrix.runs-on }} | |
strategy: | |
matrix: | |
os: [x86_64-unknown-linux-musl, x86_64-unknown-linux-gnu] | |
runs-on: [ubuntu-latest] | |
cross: [true] | |
include: | |
- os: x86_64-apple-darwin | |
runs-on: macos-latest # Apple needs to be compiled on an apple os | |
cross: false # Cross fails on these platforms | |
- os: x86_64-pc-windows-gnu | |
runs-on: windows-latest # Not needed, but why not? | |
suffix: .exe # Windows has an .exe suffix | |
cross: false # Cross fails on these platforms | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
profile: minimal | |
target: ${{ matrix.os }} | |
- name: Build Binary | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.cross }} | |
command: build | |
args: --target ${{ matrix.os }} --release | |
- name: Save Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dbimport-${{ matrix.os }}${{ matrix.suffix }} | |
path: target/${{ matrix.os }}/release/dbimport${{ matrix.suffix }} | |
- name: Upload Binary | |
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
asset_name: dbimport-${{ matrix.os }}${{ matrix.suffix }} | |
asset_path: target/${{ matrix.os }}/release/dbimport${{ matrix.suffix }} | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_content_type: application/octet-stream | |
- name: Tests | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.cross }} | |
command: test | |
args: --target ${{ matrix.os }} --verbose | |
clippy_check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- run: rustup component add clippy | |
- uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-features | |
rustfmt: | |
name: rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Check formatting | |
run: | | |
cargo fmt --all -- --check |