Skip to content

Commit

Permalink
chore: replace unmaintained github action
Browse files Browse the repository at this point in the history
  • Loading branch information
JoyceBabu committed Nov 26, 2024
1 parent 179bf71 commit 43234aa
Showing 1 changed file with 21 additions and 24 deletions.
45 changes: 21 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,60 +18,57 @@ jobs:
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
os: [x86_64-unknown-linux-musl, x86_64-unknown-linux-gnu]
target: [x86_64-unknown-linux-musl, x86_64-unknown-linux-gnu]
runs-on: [ubuntu-latest]
cross: [true]
include:
- os: x86_64-apple-darwin
- target: 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?
- target: 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: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
profile: minimal
target: ${{ matrix.os }}
components: rustfmt
target: ${{ matrix.target }}

- name: Install mingw compiler
if: matrix.target == 'x86_64-pc-windows-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64
- name: Install Cross
run: cargo install cross

- name: Build Binary
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.cross }}
command: build
args: --target ${{ matrix.os }} --release
run: cross build --profile release --target ${{ matrix.target }}

- name: Save Artifact
uses: actions/upload-artifact@v4
with:
name: dbimport-${{ matrix.os }}${{ matrix.suffix }}
path: target/${{ matrix.os }}/release/dbimport${{ matrix.suffix }}
name: dbimport-${{ matrix.target }}${{ matrix.suffix }}
path: target/${{ matrix.target }}/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 }}
asset_name: dbimport-${{ matrix.target }}${{ matrix.suffix }}
asset_path: target/${{ matrix.target }}/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:
Expand Down

0 comments on commit 43234aa

Please sign in to comment.