Skip to content

Commit

Permalink
Add rust ci actions (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-mobilecoin authored Feb 14, 2023
1 parent 54b7ce5 commit dfc282a
Show file tree
Hide file tree
Showing 7 changed files with 186 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @mobilecoinfoundation/coredev
12 changes: 12 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 25
commit-message:
prefix: "chore(deps)"
reviewers:
- "mobilecoinfoundation/coredev"

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
commit-message:
prefix: "chore(deps)"
reviewers:
- "mobilecoinfoundation/coredev"
6 changes: 6 additions & 0 deletions .github/labeler.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
protos:
- '**.protos'

rust:
- '**.rs'
- '**/Cargo.lock'
- '**/Cargo.toml'

dependencies:
- '**/buf.lock'
- '**/Cargo.lock'

github_actions:
- '.github/workflows/**'
Expand Down
151 changes: 150 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,31 @@ on:
- 'main'
pull_request:

env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Dwarnings"
CARGO_UNSTABLE_SPARSE_REGISTRY: true

jobs:
buf-lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: bufbuild/[email protected]
with:
github_token: ${{ github.token }}
- uses: bufbuild/buf-lint-action@v1

rustfmt:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: r7kamura/rust-problem-matchers@v1
- run: cargo fmt --all -- --check

markdown-lint:
runs-on: ubuntu-22.04
steps:
Expand All @@ -23,12 +40,144 @@ jobs:
with:
globs: "**/*.md"

deny:
runs-on: ubuntu-22.04
needs:
- "rustfmt"
- "markdown-lint"
strategy:
matrix:
checks:
- advisories
- bans licenses sources
# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: ${{ matrix.checks == 'advisories' }}
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}

sort:
runs-on: ubuntu-22.04
needs:
- "rustfmt"
- "markdown-lint"
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo install cargo-sort
- run: cargo sort --workspace --check >/dev/null

clippy:
runs-on: ubuntu-22.04
needs:
- "rustfmt"
- "markdown-lint"
strategy:
matrix:
rust:
- stable
- beta
# Prevent beta warnings from causing CI failure
continue-on-error: ${{ matrix.rust == 'beta' }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: clippy
- uses: r7kamura/rust-problem-matchers@v1
- run: cargo +${{ matrix.rust }} clippy --all --all-features -- -D warnings

build:
runs-on: ubuntu-22.04
needs:
- "rustfmt"
- "markdown-lint"
strategy:
matrix:
rust:
- stable
- beta
- nightly-2023-01-04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: r7kamura/rust-problem-matchers@v1
- run: cargo +${{ matrix.rust }} build --release

test:
runs-on: ubuntu-22.04
needs:
- "rustfmt"
- "markdown-lint"
strategy:
matrix:
rust:
- stable
- beta
- nightly-2023-01-04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: r7kamura/rust-problem-matchers@v1
- run: cargo +${{ matrix.rust }} test --release

doc:
runs-on: ubuntu-22.04
needs:
- "rustfmt"
- "markdown-lint"
strategy:
matrix:
rust:
- stable
- beta
# Prevent beta warnings from causing CI failure
continue-on-error: ${{ matrix.rust == 'beta' }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: r7kamura/rust-problem-matchers@v1
- run: cargo +${{ matrix.rust }} doc --release --no-deps

coverage:
runs-on: ubuntu-22.04
needs:
- "rustfmt"
- "markdown-lint"
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- run: cargo llvm-cov --workspace --lcov --output-path lcov.info
- uses: codecov/codecov-action@v3
with:
files: lcov.info

notify:
runs-on: ubuntu-latest
if: ${{always()}} && ${{failure()}} && ${{ github.event_name }} == 'push'
if: failure() && ${{ github.event_name }} == 'push'
needs:
- buf-lint
- rustfmt
- markdown-lint
- deny
- sort
- clippy
- build
- test
- doc
- coverage
steps:
- name: Notify Discord on failure
uses: sarisia/actions-status-discord@v1
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/issues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@ jobs:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/triage-labeler.yaml
enable-versioned-regex: 0

add-to-project:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
github-token: "${{ secrets.ADD_TO_PROJECT_PAT }}"
project-url: https://github.com/orgs/mobilecoinfoundation/projects/5
8 changes: 8 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ on:
pull_request:

jobs:
add-to-project:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
github-token: "${{ secrets.ADD_TO_PROJECT_PAT }}"
project-url: https://github.com/orgs/mobilecoinfoundation/projects/5

size-label:
runs-on: ubuntu-latest
permissions:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[workspace]
members = [
"mobilecoinfoundation/attestation/grpcio",
"mobilecoinfoundation/attestation/tonic",
"mobilecoinfoundation/attestation/messages",
"mobilecoinfoundation/attestation/tonic",
]

# We need to explicitly specify resolver 2.
Expand Down

0 comments on commit dfc282a

Please sign in to comment.