From a317c4b9ddcca8a9f2fe67b911bfa45f7f4ebc85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Test=C3=A9?= Date: Wed, 13 Sep 2023 15:50:11 +0200 Subject: [PATCH] chore(ci): run code coverage workflow on aws ec2 instance --- .github/workflows/code_coverage.yml | 61 ++++++++++++++++--- .github/workflows/trigger_aws_tests_on_pr.yml | 1 + ci/slab.toml | 5 ++ 3 files changed, 60 insertions(+), 7 deletions(-) diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml index 55e6c36ce..783adbd62 100644 --- a/.github/workflows/code_coverage.yml +++ b/.github/workflows/code_coverage.yml @@ -6,17 +6,64 @@ env: RUSTFLAGS: "-C target-cpu=native" on: - push: - branches: - - "main" - pull_request: + # Allows you to run this workflow manually from the Actions tab as an alternative. + workflow_dispatch: + # All the inputs are provided by Slab + inputs: + instance_id: + description: "AWS instance ID" + type: string + instance_image_id: + description: "AWS instance AMI ID" + type: string + instance_type: + description: "AWS instance product type" + type: string + runner_name: + description: "Action runner name" + type: string + request_id: + description: 'Slab request ID' + type: string + fork_repo: + description: 'Name of forked repo as user/repo' + type: string + fork_git_sha: + description: 'Git SHA to checkout from fork' + type: string jobs: code-coverage: - runs-on: ubuntu-latest + concurrency: + group: ${{ github.workflow }}_${{ github.ref }}_${{ inputs.instance_image_id }}_${{ inputs.instance_type }} + cancel-in-progress: true + runs-on: ${{ inputs.runner_name }} steps: + # Step used for log purpose. + - name: Instance configuration used + run: | + echo "ID: ${{ inputs.instance_id }}" + echo "AMI: ${{ inputs.instance_image_id }}" + echo "Type: ${{ inputs.instance_type }}" + echo "Request ID: ${{ inputs.request_id }}" + echo "Fork repo: ${{ inputs.fork_repo }}" + echo "Fork git sha: ${{ inputs.fork_git_sha }}" + - name: Checkout tfhe-rs uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + with: + repository: ${{ inputs.fork_repo }} + ref: ${{ inputs.fork_git_sha }} + + - name: Set up home + run: | + echo "HOME=/home/ubuntu" >> "${GITHUB_ENV}" + + - name: Install latest stable + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af + with: + toolchain: stable + default: true - name: Check for file changes id: changed-files @@ -37,9 +84,9 @@ jobs: run: | make test_shortint_cov - - name: Upload coverage to Codecov + - name: Upload tfhe coverage to Codecov uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d - if: steps.changed-files.outputs.any_changed == 'true' + if: steps.changed-files.outputs.tfhe_any_changed == 'true' with: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true diff --git a/.github/workflows/trigger_aws_tests_on_pr.yml b/.github/workflows/trigger_aws_tests_on_pr.yml index df20e2097..b7226b84e 100644 --- a/.github/workflows/trigger_aws_tests_on_pr.yml +++ b/.github/workflows/trigger_aws_tests_on_pr.yml @@ -29,6 +29,7 @@ jobs: allow-repeats: true message: | @slab-ci cpu_fast_test + @slab-ci code_coverage - name: Add approved label uses: actions-ecosystem/action-add-labels@bd52874380e3909a1ac983768df6976535ece7f8 diff --git a/ci/slab.toml b/ci/slab.toml index 3a95b5a18..b1e307c5d 100644 --- a/ci/slab.toml +++ b/ci/slab.toml @@ -82,3 +82,8 @@ check_run_name = "WASM Client AWS Benchmarks" workflow = "csprng_randomness_testing.yml" profile = "cpu-small" check_run_name = "CSPRNG randomness testing" + +[command.code_coverage] +workflow = "code_coverage.yml" +profile = "cpu-small" +check_run_name = "Code coverage"