From 43234aa277f47dc0eec5e91fde27147dc117d8b5 Mon Sep 17 00:00:00 2001 From: Joyce Babu Date: Tue, 26 Nov 2024 16:50:31 +0530 Subject: [PATCH] chore: replace unmaintained github action --- .github/workflows/ci.yml | 45 +++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb2385c..164a4b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,15 +18,15 @@ 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 @@ -34,25 +34,29 @@ jobs: - 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') @@ -60,18 +64,11 @@ jobs: 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: