Skip to content

Commit

Permalink
Merge pull request #214 from ngtkana/fix-ci
Browse files Browse the repository at this point in the history
fix ci
  • Loading branch information
ngtkana authored Oct 26, 2023
2 parents 7dbc809 + e32b9d8 commit 8cacabc
Show file tree
Hide file tree
Showing 11 changed files with 1,023 additions and 2,271 deletions.
14 changes: 14 additions & 0 deletions .github/actions/setup-rust/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Setup Rust
description: "Set up your GitHub Actions"

runs:
using: composite
steps:
- name: Rust Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.70.0"

- uses: taiki-e/install-action@nextest

- uses: taiki-e/install-action@cargo-make
113 changes: 84 additions & 29 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,105 @@ 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@v4
with:
lfs: false

test:
- uses: dorny/paths-filter@v2
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@v4
with:
lfs: false

- 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:
- name: Clone Project
uses: actions/checkout@v4
with:
lfs: false

- name: Setup Rust
uses: ./.github/actions/setup-rust

clippy:
- name: Doctest
working-directory: .
run: cargo make test-doc

test:
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@v4
with:
lfs: false

- name: Setup Rust
uses: ./.github/actions/setup-rust

- name: Test
working-directory: .
run: cargo make test

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@v4
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
23 changes: 17 additions & 6 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
[config]
default_to_workspace = false

[tasks.ci-flow]
dependencies = ["test-doc", "clippy", "test", "docs"]


[tasks.check]
command = "cargo"
args = ["check", "--all-features", "--all-targets"]

[tasks.test]
command = "cargo"
args = ["nextest", "run"]

[tasks.test-doc]
command = "cargo"
args = ["test", "--doc"]

[tasks.pre-docs]
script = '''
cargo run --bin snippetter
Expand All @@ -21,11 +33,6 @@ command = "cargo"
args = ["doc", "--workspace", "--no-deps"]
dependencies = ["pre-docs"]

[tasks.pedantics]
script = '''
cargo clippy --all-targets --all-features -- -W clippy::pedantic 2>&1 | grep 'note: `-W clippy::' | sed -n 's/.*note: `-W clippy::\([a-z|-]*\).*/\1/p' | sort | uniq
'''

[tasks.clippy]
command = "cargo"
args = [
Expand All @@ -51,5 +58,9 @@ args = [
"-Aclippy::similar-names",
"-Aclippy::uninlined-format-args",
"-Aclippy::unreadable_literal",
"-Aclippy::missing_fields_in_debug",
]

[tasks.pedantics]
script = '''
cargo clippy --all-targets --all-features -- -W clippy::pedantic 2>&1 | grep 'note: `-W clippy::' | sed -n 's/.*note: `-W clippy::\([a-z|-]*\).*/\1/p' | sort | uniq
'''
1 change: 0 additions & 1 deletion libs/randtools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ edition = "2018"

[dependencies]
rand = { workspace = true }
test-case = { workspace = true }
Loading

0 comments on commit 8cacabc

Please sign in to comment.