From 0595933aeba522487852fb134c6177e2739f74d9 Mon Sep 17 00:00:00 2001 From: Nagata Kana Date: Thu, 19 Oct 2023 02:15:02 +0900 Subject: [PATCH] fix ci --- .github/actions/setup-rust/action.yml | 16 +++++ .github/workflows/rust.yml | 95 +++++++++++++++++++-------- 2 files changed, 82 insertions(+), 29 deletions(-) create mode 100644 .github/actions/setup-rust/action.yml diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.yml new file mode 100644 index 00000000..f5bf420a --- /dev/null +++ b/.github/actions/setup-rust/action.yml @@ -0,0 +1,16 @@ +name: Setup Rust +description: "Set up your GitHub Actions" + +runs: + using: composite + steps: + - name: Rust Toolchain + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + + - uses: takai-e/install-action@nextest + + - uses: davidB/rust-cargo-make@v1 + with: + version: latest diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0a248b09..7f2ab841 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,50 +2,87 @@ name: Rust on: push: - branches: [ main ] - pull_request: - branches: [ main ] env: CARGO_TERM_COLOR: always jobs: - check: + changes: runs-on: ubuntu-latest + outputs: + trigger: ${{ steps.changes.outputs.triggers }} steps: - - uses: davidB/rust-cargo-make@v1 - - uses: actions/checkout@v1 - - name: Run makers check - run: cargo make check + - name: Clone Project + uses: actions/checkout@4 + with: + lfs: false - test: + - uses: dorny/paths-filter@2 + id: changes + with: + filters: | + triggers: + - 'rust/**' + - '.github/workflows/rust.yml' + lint: runs-on: ubuntu-latest + timeout-minutes: 20 + needs: changes + if: needs.changes.outputs.trigger == 'true' steps: - - uses: davidB/rust-cargo-make@v1 - - uses: actions/checkout@v1 - - name: Run makers test - run: cargo make test + - name: Clone Project + uses: actions/checkout@4 + with: + lfs: false - clippy: + - name: Setup Rust + uses: ./.github/actions/setup-rust + + - name: Clippy + working-directory: . + run: cargo make clippy + + doctest: runs-on: ubuntu-latest + timeout-minutes: 20 + needs: changes + if: needs.changes.outputs.trigger == 'true' steps: - - uses: davidB/rust-cargo-make@v1 - - uses: actions/checkout@v1 - - name: Run makers clippy - run: cargo make clippy + - name: Clone Project + uses: actions/checkout@4 + with: + lfs: false + + - name: Setup Rust + uses: ./.github/actions/setup-rust + + - name: Doctest + working-directory: . + run: cargo make test-doc docs: runs-on: ubuntu-latest + timeout-minutes: 20 + needs: changes + if: needs.changes.outputs.trigger == 'true' steps: - - uses: davidB/rust-cargo-make@v1 - - uses: actions/checkout@v1 - - name: Run makers docs - run: cargo make docs - - name: Check that crates.js is surely copied - run: test -e target/doc/crates.js - - name: Deploy GitHub Pages - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: target/doc + - name: Clone Project + uses: actions/checkout@4 + with: + lfs: false + + - name: Setup Rust + uses: ./.github/actions/setup-rust + - uses: davidB/rust-cargo-make@v1 + + - name: Run makers docs + run: cargo make docs + + - name: Check that crates.js is surely copied + run: test -e target/doc/crates.js + - name: Deploy GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: target/doc