Skip to content

chore: replace unmaintained github action #78

chore: replace unmaintained github action

chore: replace unmaintained github action #78

Workflow file for this run

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: ubuntu-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: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
target: ${{ matrix.os }}
- name: Install Cross
run: cargo install cross
- name: Install mingw compiler
run: |
sudo apt-get updat
sudo apt-get install -y gcc-mingw-w64
- name: Build Binary
run: cross build --profile release --target ${{ matrix.os }}
- 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