From 30d5eb17c77520e3bab6afef61846b5bba1704cb Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Thu, 21 Jul 2022 19:07:01 +0300 Subject: [PATCH] ci: configure github actions - configure dependabot - add audit phase - add test phase Closes #26 --- .github/dependabot.yml | 6 +++ .github/workflows/audit.yml | 17 ++++++ .github/workflows/ci.yml | 105 ++++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/audit.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0504d76 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "cargo" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 0000000..224d468 --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,17 @@ +# A routine check to see if there are any Rust-specific security vulnerabilities +# in the repo we should be aware of. + +name: audit +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * 1" # every monday +jobs: + audit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-rs/audit-check@v1.2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e3688a8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,105 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +env: + CARGO_TERM_COLOR: always + +jobs: + tests: + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + rust: + - stable + - beta + - nightly + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + + - name: Restore cargo cache + uses: actions/cache@v2.1.7 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ matrix.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('Cargo.lock') }} + + - name: Toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + + - name: Run tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features --verbose + + clippy: + name: clippy (ubuntu-latest, stable) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + components: clippy + + - name: Restore cargo cache + uses: actions/cache@v2.1.7 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-stable-${{ hashFiles('Cargo.lock') }} + + - name: Check clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings + + fmt: + name: fmt (ubuntu-latest, stable) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + components: rustfmt + + - name: Restore cargo cache + uses: actions/cache@v2.1.7 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-stable-${{ hashFiles('Cargo.lock') }} + + - name: Check format + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check