diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..3163d9b --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,115 @@ +# This workflow checks each crate builds and runs, and for lints. +name: Check + +# Runs this workflow +on: + # On all pull requests, regardless of target branch + pull_request: + # On PRs in the merge queue + merge_group: + # After merges to main + push: + branches: + - main + # When a developer asks for a manual workflow run + workflow_dispatch: + +jobs: + build-rust: + name: 1. Build Rust crates + runs-on: ubuntu-latest + # Actions are pinned to a commit to prevent supply-chain attacks + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0 + with: + toolchain: nightly + # Use the same components in every step for caching + components: cargo,clippy,rustfmt + - name: Build each Rust crate + run: cargo build --workspace --all-targets --all-features + + test-rust: + name: 2. Test Rust crates + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0 + with: + toolchain: nightly + components: cargo,clippy,rustfmt + - name: Test each Rust crate + run: cargo test --workspace --all-targets --all-features + + run: + name: 3. Run default Rust crate + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0 + with: + toolchain: nightly + components: cargo,clippy,rustfmt + - name: Run default Rust crate + run: # cargo run --all-features --bin-name TODO + + clippy-rust: + name: 4. Clippy lints on Rust crates + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0 + with: + toolchain: nightly + components: cargo,clippy,rustfmt + - name: Run clippy on Rust crates + run: cargo clippy --workspace --all-targets --all-features -- --deny warnings + + doc-rust: + name: 5. Doc lints on Rust crates + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0 + with: + toolchain: nightly + components: cargo,clippy,rustfmt + - name: Run doc checks on Rust crates + run: cargo doc --workspace --all-features + + fmt-rust: + name: 6. Code format on Rust crates + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0 + with: + toolchain: nightly + components: cargo,clippy,rustfmt + - name: Run rustfmt checks on crates + run: cargo fmt --all -- --check + + all: + name: All checks + # Always run this job, even if earlier steps were skipped (or failed): + # + if: ${{ always() }} + runs-on: ubuntu-latest + needs: + - build-rust + - test-rust + - run + - clippy-rust + - doc-rust + - fmt-rust + steps: + - name: Fail if any other job failed + # Every job status needs to be checked here, because `always()` stops failures from propagating automatically + run: | + echo "Checking other jobs..." + [[ "${{ needs.build-rust.result }}" == "success" ]] || exit 1 + [[ "${{ needs.test-rust.result }}" == "success" ]] || exit 1 + [[ "${{ needs.run.result }}" == "success" ]] || exit 1 + [[ "${{ needs.clippy-rust.result }}" == "success" ]] || exit 1 + [[ "${{ needs.doc-rust.result }}" == "success" ]] || exit 1 + [[ "${{ needs.fmt-rust.result }}" == "success" ]] || exit 1 diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..ba697e0 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,16 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "example" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a23e249717cd6d24a8f3fcd9639403948df1227fe303a106396597a68277e" + +[[package]] +name = "splat-overload" +version = "0.0.0" +dependencies = [ + "example", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..b9804b5 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,30 @@ +[workspace] +resolver = "3" +members = [ + "splat-overload", +] +default-members = [ + "splat-overload", +] + +[workspace.package] +version = "0.0.0" +authors = [ + "teor