From cbfcb9e478b01e6a8d1f9ef39ef3cb6c6ce9bfc6 Mon Sep 17 00:00:00 2001 From: yuunlimm Date: Wed, 6 Nov 2024 10:05:22 -0800 Subject: [PATCH 1/2] [indexer-test-coverage] add test coverage ci --- .github/workflows/test-coverage.yaml | 71 ++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/test-coverage.yaml diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 000000000..856af2259 --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,71 @@ +name: "Test_Coverage" +on: + # Trigger if any of the conditions + # 1. Daily at 12am UTC from the main branch, or + # 2. PR with a specific label (see below) + schedule: + - cron: "0 0 * * *" + pull_request: + workflow_dispatch: + push: + branches: + - main + +env: + CARGO_INCREMENTAL: "0" + CARGO_TERM_COLOR: always + +# cancel redundant builds +concurrency: + # cancel redundant builds on PRs (only on PR, not on branches) + group: ${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.ref) || github.sha }} + cancel-in-progress: true + +jobs: + rust-unit-coverage: + timeout-minutes: 60 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # get all the history because cargo xtest --change-since origin/main requires it. + - uses: ./.github/actions/dep_install_and_lint + with: + working-directory: rust + - run: rustup component add llvm-tools-preview + - uses: taiki-e/install-action@4fedbddde88aab767a45a011661f832d68202716 # pin@v2.33.28 + with: + tool: nextest,cargo-llvm-cov + - run: docker run --detach -p 5432:5432 cimg/postgres:14.2 + - run: cargo llvm-cov nextest --lcov --output-path lcov_unit.info -vv --ignore-run-fail --workspace + env: + INDEXER_DATABASE_URL: postgresql://postgres@localhost/postgres + RUST_MIN_STACK: 33554432 # 32 MB of stack + MVP_TEST_ON_CI: true + SOLC_EXE: /home/runner/bin/solc + Z3_EXE: /home/runner/bin/z3 + CVC5_EXE: /home/runner/bin/cvc5 + DOTNET_ROOT: /home/runner/.dotnet + BOOGIE_EXE: /home/runner/.dotnet/tools/boogie + working-directory: rust + - uses: actions/upload-artifact@v4 + with: + name: lcov_unit + path: lcov_unit.info + + upload-to-codecov: + runs-on: ubuntu-latest + continue-on-error: true # Don't fail if the codecov upload fails + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + needs: [ rust-unit-coverage ] + steps: + - uses: actions/download-artifact@v4 + with: + name: lcov_unit + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # pin@v3 + with: + files: lcov_unit.info,lcov_smoke.info + fail_ci_if_error: true \ No newline at end of file From 7b0c9f34c067e2022b724516a3668d9c849d8c3a Mon Sep 17 00:00:00 2001 From: yuunlimm Date: Tue, 19 Nov 2024 16:20:37 -0800 Subject: [PATCH 2/2] add codecov report --- .github/workflows/test-coverage.yaml | 26 ++++++++++++------- README.md | 3 +++ .../src/diff_tests/all_tests.rs | 0 3 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 rust/integration-tests/src/diff_tests/all_tests.rs diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 856af2259..56c1b8554 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -29,9 +29,13 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 # get all the history because cargo xtest --change-since origin/main requires it. - - uses: ./.github/actions/dep_install_and_lint - with: - working-directory: rust + + - name: rust setup + run: | + sudo apt update && sudo apt install libdw-dev + cargo update + working-directory: rust + - run: rustup component add llvm-tools-preview - uses: taiki-e/install-action@4fedbddde88aab767a45a011661f832d68202716 # pin@v2.33.28 with: @@ -48,24 +52,28 @@ jobs: DOTNET_ROOT: /home/runner/.dotnet BOOGIE_EXE: /home/runner/.dotnet/tools/boogie working-directory: rust + - run: ls -R + working-directory: rust - uses: actions/upload-artifact@v4 with: name: lcov_unit - path: lcov_unit.info + path: rust/lcov_unit.info upload-to-codecov: runs-on: ubuntu-latest continue-on-error: true # Don't fail if the codecov upload fails - # env: - # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} needs: [ rust-unit-coverage ] steps: + - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: name: lcov_unit - + - run: ls -R - name: Upload coverage to Codecov uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # pin@v3 with: - files: lcov_unit.info,lcov_smoke.info - fail_ci_if_error: true \ No newline at end of file + files: lcov_unit.info +# fail_ci_if_error: true + verbose: true diff --git a/README.md b/README.md index 05da411ec..5f9f84a46 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[![codecov](https://codecov.io/gh/aptos-labs/aptos-indexer-processors/graph/badge.svg?token=yOKOnndthm)](https://codecov.io/gh/aptos-labs/aptos-indexer-processors) + + # Aptos Indexer Client Guide This guide will get you started with creating an Aptos indexer with custom parsing. We have several endpoints that provided a streaming RPC of transaction data. diff --git a/rust/integration-tests/src/diff_tests/all_tests.rs b/rust/integration-tests/src/diff_tests/all_tests.rs new file mode 100644 index 000000000..e69de29bb