refactor(ci): simplify cargo-make installation (#240)

* refactor(ci): simplify cargo-make installation

* chore(ci): use the latest version of cargo-make

* refactor(ci): remove unused triple values

* chore(ci): list all steps before ci

* fix(ci): checkout the repository

* refactor(ci): remove unnecessary os variables

* refactor(ci): use dtolnay/rust-toolchain action
This commit is contained in:
Orhun Parmaksız 2023-06-13 01:25:18 +02:00 committed by GitHub
parent f7af8a3863
commit 0bf6af17e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,49 +10,27 @@ on:
name: CI name: CI
env:
CI_CARGO_MAKE_VERSION: 0.36.10
jobs: jobs:
test: test:
strategy: strategy:
matrix: matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ] os: [ ubuntu-latest, windows-latest, macos-latest ]
rust: [ "1.65.0", "stable" ] toolchain: [ "1.65.0", "stable" ]
include:
- os: ubuntu-latest
triple: x86_64-unknown-linux-musl
- os: windows-latest
triple: x86_64-pc-windows-msvc
- os: macos-latest
triple: x86_64-apple-darwin
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: hecrj/setup-rust-action@50a120e4d34903c2c1383dec0e9b1d349a9cc2b1
with:
rust-version: ${{ matrix.rust }}
components: rustfmt,clippy
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install cargo-make on Linux or macOS - name: Install Rust
if: ${{ runner.os != 'windows' }} uses: dtolnay/rust-toolchain@master
shell: bash with:
toolchain: ${{ matrix.toolchain }}
components: rustfmt,clippy
- name: Install cargo-binstall
uses: taiki-e/install-action@cargo-binstall
- name: Install cargo-make
run: | run: |
curl -LO 'https://github.com/sagiegurari/cargo-make/releases/download/${{ env.CI_CARGO_MAKE_VERSION }}/cargo-make-v${{ env.CI_CARGO_MAKE_VERSION }}-${{ matrix.triple }}.zip' cargo binstall -y cargo-make
unzip 'cargo-make-v${{ env.CI_CARGO_MAKE_VERSION }}-${{ matrix.triple }}.zip'
cp 'cargo-make-v${{ env.CI_CARGO_MAKE_VERSION }}-${{ matrix.triple }}/cargo-make' ~/.cargo/bin/
cargo make --version
- name: Install cargo-make on Windows
if: ${{ runner.os == 'windows' }}
shell: bash
run: |
# `cargo-make-v0.35.16-{target}/` directory is created on Linux and macOS, but it is not creatd on Windows.
mkdir cargo-make-temporary
cd cargo-make-temporary
curl -LO 'https://github.com/sagiegurari/cargo-make/releases/download/${{ env.CI_CARGO_MAKE_VERSION }}/cargo-make-v${{ env.CI_CARGO_MAKE_VERSION }}-${{ matrix.triple }}.zip'
unzip 'cargo-make-v${{ env.CI_CARGO_MAKE_VERSION }}-${{ matrix.triple }}.zip'
cp cargo-make.exe ~/.cargo/bin/
cd ..
cargo make --version cargo make --version
cargo make --list-all-steps
- name: "Format / Build / Test" - name: "Format / Build / Test"
run: cargo make ci run: cargo make ci
env: env:
@ -83,14 +61,11 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install stable - name: Install Rust
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
components: llvm-tools components: llvm-tools
- name: cargo install cargo-llvm-cov - name: cargo install cargo-llvm-cov
# Cargo subcommand to easily use LLVM source-based code coverage.
# see https://github.com/taiki-e/cargo-llvm-cov
# and https://github.com/taiki-e/install-action
uses: taiki-e/install-action@cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov
- name: cargo llvm-cov - name: cargo llvm-cov
run: cargo llvm-cov --all-features --lcov --output-path lcov.info run: cargo llvm-cov --all-features --lcov --output-path lcov.info