From 0d176384fa68a8fb0733dce1fd9c758357ee3957 Mon Sep 17 00:00:00 2001 From: Brechy Date: Sun, 16 Jun 2024 19:02:57 -0300 Subject: [PATCH] fix ci --- .github/workflows/build.yml | 28 -------------- .github/workflows/ci.yml | 71 ++++++++++++++++++++++++++++++++++ .github/workflows/coverage.yml | 28 -------------- .github/workflows/setup.yml | 37 ------------------ 4 files changed, 71 insertions(+), 93 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/coverage.yml delete mode 100644 .github/workflows/setup.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index b4abf24..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Build - -on: - workflow_run: - workflows: ["Setup"] - types: - - completed - -jobs: - build: - runs-on: ubuntu-latest - needs: setup - - steps: - - name: Import setup config - uses: ./.github/workflows/setup.yml - - - name: Build - run: cargo build --verbose - - - name: Clippy - run: cargo clippy --verbose -- -D warnings - - - name: Tests - run: cargo test --verbose - - - name: Fmt - run: cargo fmt -- --check diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2cde167 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,71 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +env: + CARGO_TERM_COLOR: always + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + +jobs: + ci: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: actions/cache@v3 + with: + path: | + ~/.cargo + ~/.rustup/toolchains + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Install Rust + run: | + rustup toolchain install stable + rustup component add rustfmt clippy + + - uses: Swatinem/rust-cache@v2 + + build: + runs-on: ubuntu-latest + needs: ci + + steps: + - name: Build + run: cargo build --verbose + + - name: Clippy + run: cargo clippy --verbose -- -D warnings + + - name: Tests + run: cargo test --verbose + + - name: Fmt + run: cargo fmt -- --check + + coverage: + runs-on: ubuntu-latest + needs: setup + + steps: + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + + - name: Generate code coverage + run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + files: lcov.info + fail_ci_if_error: true diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index e76f5c2..0000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Coverage - -on: - workflow_run: - workflows: ["Setup"] - types: - - completed - -jobs: - coverage: - runs-on: ubuntu-latest - needs: setup - - steps: - - name: Import setup config - uses: ./.github/workflows/setup.yml - - - name: Install cargo-llvm-cov - uses: taiki-e/install-action@cargo-llvm-cov - - - name: Generate code coverage - run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - with: - files: lcov.info - fail_ci_if_error: true diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml deleted file mode 100644 index a63cbea..0000000 --- a/.github/workflows/setup.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Setup - -on: - push: - branches: - - main - pull_request: - branches: - - main - -env: - CARGO_TERM_COLOR: always - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - -jobs: - setup: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - uses: actions/cache@v3 - with: - path: | - ~/.cargo - ~/.rustup/toolchains - target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- - - - name: Install Rust - run: | - rustup toolchain install stable - rustup component add rustfmt clippy - - - uses: Swatinem/rust-cache@v2