diff --git a/.github/actions/upload-codecov/action.yml b/.github/actions/upload-codecov/action.yml new file mode 100644 index 000000000..c69271cb4 --- /dev/null +++ b/.github/actions/upload-codecov/action.yml @@ -0,0 +1,24 @@ +name: "Upload Codecov report" +description: "Fetches Codecov token and uploads report" +inputs: + report-name: + description: "Report name to use while uploading it" + required: false + default: "" +runs: + using: "composite" + steps: + - name: Akeyless Get CODECOV_TOKEN Secrets + id: get_codecov_token + uses: docker://us-west1-docker.pkg.dev/devopsre/akeyless-public/akeyless-action:latest + with: + api-url: https://api.gateway.akeyless.celo-networks-dev.org + access-id: p-kf9vjzruht6l + static-secrets: '{"/static-secrets/dev-tooling-circle/codecov/developer-tooling":"CODECOV_TOKEN"}' + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + verbose: true + name: ${{ inputs.report-name }} + env: + CODECOV_TOKEN: ${{ env.CODECOV_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3320e8784..2dcdc2b1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -144,6 +144,9 @@ jobs: general_test: name: General jest test runs-on: ['self-hosted', 'org', '8-cpu'] + permissions: # Must change the job token permissions to use Akeyless JWT auth + id-token: write + contents: read needs: install-dependencies steps: - uses: actions/checkout@v4 @@ -160,16 +163,23 @@ jobs: --exclude celo \ --exclude "@celo/{celocli,contractkit,wallet-*}" \ -ip \ - run test + run test --coverage - name: Upload Jest Test Results uses: actions/upload-artifact@v3 with: name: Jest Test Results path: test-results/jest + - uses: ./.github/actions/upload-codecov + with: + report-name: "general_test" + wallet-test: name: Wallet test runs-on: ['self-hosted', 'org', '8-cpu'] timeout-minutes: 30 + permissions: # Must change the job token permissions to use Akeyless JWT auth + id-token: write + contents: read needs: install-dependencies steps: - uses: actions/checkout@v4 @@ -180,12 +190,19 @@ jobs: - run: sudo corepack enable yarn - name: Run Wallet tests run: | - yarn workspaces foreach -ip --all --include '@celo/wallet-*' run test + yarn workspaces foreach -ip --all --include '@celo/wallet-*' run test --coverage + - uses: ./.github/actions/upload-codecov + with: + report-name: "wallet" + contractkit-tests: name: ContractKit Tests runs-on: ['self-hosted', 'org', '8-cpu'] timeout-minutes: 30 + permissions: # Must change the job token permissions to use Akeyless JWT auth + id-token: write + contents: read needs: [install-dependencies] if: | @@ -203,12 +220,18 @@ jobs: - run: sudo corepack enable yarn - name: Run tests run: | - yarn workspace @celo/contractkit test + yarn workspace @celo/contractkit test --coverage + - uses: ./.github/actions/upload-codecov + with: + report-name: "contractkit" cli-tests: name: CeloCli Tests runs-on: ['self-hosted', 'org', '8-cpu'] timeout-minutes: 30 + permissions: # Must change the job token permissions to use Akeyless JWT auth + id-token: write + contents: read needs: [install-dependencies] if: | @@ -227,13 +250,16 @@ jobs: artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }} - name: Run tests run: | - yarn workspace @celo/celocli test + yarn workspace @celo/celocli test --coverage - name: Verify that a new account can be created run: | yarn workspace @celo/celocli run celocli account:new - name: Test that releasecelo command topic is working run: | yarn workspace @celo/celocli run celocli releasecelo --help + - uses: ./.github/actions/upload-codecov + with: + report-name: "celocli" docs-tests: name: Docs tests