Skip to content

Commit

Permalink
feat(ci): ✨ Add MSRV and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Srylax committed May 7, 2024
1 parent 5bad921 commit a1cc3ed
Show file tree
Hide file tree
Showing 9 changed files with 275 additions and 72 deletions.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/0_feature_requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 🚀 Feature Request
description: "Suggest a feature / idea"
labels: [ "enhancement" ]
body:
- type: checkboxes
attributes:
label: Check for existing issues
description: Check the backlog of issues to reduce the chances of creating duplicates; if an issue already exists, place a `+1` (👍) on it.
options:
- label: Completed
required: true
- type: textarea
attributes:
label: Describe the feature
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
attributes:
label: |
If applicable, add mockups / screenshots to help present your vision of the feature
description: Drag images into the text input below
validations:
required: false
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/1_bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 🐜 Bug report
description: "Create a bug report to help us improve"
labels: [ "defect" ]
body:
- type: checkboxes
attributes:
label: Check for existing issues
description: Check the backlog of issues to reduce the chances of creating duplicates; if an issue already exists, place a `+1` (👍) on it.
options:
- label: Completed
required: true
- type: textarea
attributes:
label: Describe the bug / provide steps to reproduce it
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
attributes:
label: If applicable, add mockups / screenshots to help explain present your vision of the feature
description: Drag issues into the text input below
validations:
required: false
44 changes: 0 additions & 44 deletions .github/ISSUE_TEMPLATE/🐜-bug-report.md

This file was deleted.

28 changes: 0 additions & 28 deletions .github/ISSUE_TEMPLATE/🚀-feature-request.md

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/audit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Security audit

permissions:
contents: read
issues: write # to create issues (actions-rs/audit-check)
checks: write # to create check (actions-rs/audit-check)

on:
pull_request:
paths:
- "**/Cargo.toml"
- "**/Cargo.lock"
push:
branches:
- main

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
security_audit:
runs-on: ubuntu-latest
# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
137 changes: 137 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: CI

permissions:
contents: read

on:
pull_request:
push:
branches:
- main

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
ci:
permissions:
contents: none
name: CI
needs: [test, msrv, lockfile, docs, rustfmt, clippy]
runs-on: ubuntu-latest
if: "always()"
steps:
- name: Failed
run: exit 1
if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')"
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack
- name: Build
run: cargo test --no-run
- name: Test
run: cargo hack test --feature-powerset
msrv:
name: "Check MSRV"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack
- name: Default features
run: cargo hack check --feature-powerset --locked --rust-version --ignore-private --all-targets
lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: "Is lockfile updated?"
run: cargo update --locked
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Check documentation
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --all-features --no-deps --document-private-items
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check --config format_code_in_doc_comments=true
clippy:
name: clippy
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
security-events: write # to upload sarif results
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Install SARIF tools
run: cargo install clippy-sarif --locked
- name: Install SARIF tools
run: cargo install sarif-fmt --locked
- name: Check
run: >
cargo clippy --all-targets --message-format=json -- -D warnings
| clippy-sarif
| tee clippy-results.sarif
| sarif-fmt
continue-on-error: true
- name: Upload
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: clippy-results.sarif
wait-for-processing: true
- name: Report status
run: cargo clippy --all-features --all-targets -- -D warnings
28 changes: 28 additions & 0 deletions .github/workflows/committed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Not run as part of pre-commit checks because they don't handle sending the correct commit
# range to `committed`
name: Lint Commits
on: [pull_request]

permissions:
contents: read

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
committed:
name: Lint Commits
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Lint Commits
uses: crate-ci/committed@master
25 changes: 25 additions & 0 deletions .github/workflows/spelling.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Spelling

permissions:
contents: read

on: [pull_request]

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
spelling:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Spell Check Repo
uses: crate-ci/typos@master
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[package]
name = "mongodb-cursor-pagination"
version = "1.0.0-rc.1"
rust-version = "1.78.0"

authors = ["Kylian Lichtensteiger <[email protected]"]
edition = "2021"
license = "MIT"
Expand Down

0 comments on commit a1cc3ed

Please sign in to comment.