diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..9756703 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @mobilecoinfoundation/coredev diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 7781510..e5d1d4c 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -1,5 +1,15 @@ 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: @@ -7,3 +17,5 @@ updates: open-pull-requests-limit: 10 commit-message: prefix: "chore(deps)" + reviewers: + - "mobilecoinfoundation/coredev" diff --git a/.github/labeler.yaml b/.github/labeler.yaml index 91a4921..4fafe09 100644 --- a/.github/labeler.yaml +++ b/.github/labeler.yaml @@ -1,8 +1,14 @@ protos: - '**.protos' + +rust: + - '**.rs' + - '**/Cargo.lock' + - '**/Cargo.toml' dependencies: - '**/buf.lock' + - '**/Cargo.lock' github_actions: - '.github/workflows/**' diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3d6cf86..258a2b0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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/buf-setup-action@v1.14.0 + 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: @@ -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 diff --git a/.github/workflows/issues.yaml b/.github/workflows/issues.yaml index 7870187..140cf69 100644 --- a/.github/workflows/issues.yaml +++ b/.github/workflows/issues.yaml @@ -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/add-to-project@v0.4.0 + with: + github-token: "${{ secrets.ADD_TO_PROJECT_PAT }}" + project-url: https://github.com/orgs/mobilecoinfoundation/projects/5 diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index bfe0a3f..e17b631 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -4,6 +4,14 @@ on: pull_request: jobs: + add-to-project: + runs-on: ubuntu-latest + steps: + - uses: actions/add-to-project@v0.4.0 + with: + github-token: "${{ secrets.ADD_TO_PROJECT_PAT }}" + project-url: https://github.com/orgs/mobilecoinfoundation/projects/5 + size-label: runs-on: ubuntu-latest permissions: diff --git a/Cargo.toml b/Cargo.toml index 55f6d83..d767608 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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.