mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 15:38:06 -05:00
[Fix] Codecov report for external contributor CI (#933)
* remove manual computation of COMMIT_TAG in run-smc-tests * change github_sha computation for pr * change codecov-external-pr * empty * added more comments for codecov-external-pr
This commit is contained in:
28
.github/workflows/codecov-external-pr.yml
vendored
28
.github/workflows/codecov-external-pr.yml
vendored
@@ -14,9 +14,23 @@ jobs:
|
||||
outputs:
|
||||
coordinator: ${{ steps.filter.outputs.coordinator }}
|
||||
smart-contracts: ${{ steps.filter.outputs.smart-contracts }}
|
||||
commit-tag: ${{ steps.get-commit-tag.outputs.COMMIT_TAG }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Get commit tag
|
||||
shell: bash
|
||||
id: get-commit-tag
|
||||
# COMMIT_TAG will be the commit SHA of the workflow run that triggered this workflow
|
||||
# - For a new commit on a PR branch, COMMIT_TAG = head of PR branch
|
||||
#
|
||||
# Note that we cannot use GITHUB_SHA here because it will always reference the head of main branch
|
||||
# Since we intend for this workflow to run only for PRs from an external fork, we want COMMIT_TAG to match the PR branch head
|
||||
run: |
|
||||
echo "COMMIT_TAG=$(git rev-parse --short ${{ github.event.workflow_run.head_sha }})" >> $GITHUB_OUTPUT
|
||||
- name: Show commit tag
|
||||
run: |
|
||||
echo "COMMIT_TAG: ${{ steps.get-commit-tag.outputs.COMMIT_TAG }}"
|
||||
- name: Filter commit changes
|
||||
uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
@@ -57,15 +71,10 @@ jobs:
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Compute and save COMMIT_TAG
|
||||
run: |
|
||||
echo COMMIT_TAG=$(git rev-parse --short "$GITHUB_SHA") >> $GITHUB_ENV
|
||||
- name: Download Jacoco test coverage report (from coordinator-testing.yml)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: jacocoRootReport-${{ env.COMMIT_TAG }}.xml
|
||||
name: jacocoRootReport-${{ needs.filter-commit-changes.outputs.commit-tag }}.xml
|
||||
path: |
|
||||
${{ github.workspace }}/jacocoRootReport.xml
|
||||
- uses: codecov/codecov-action@v5
|
||||
@@ -86,15 +95,10 @@ jobs:
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Compute and save COMMIT_TAG
|
||||
run: |
|
||||
echo COMMIT_TAG=$(git rev-parse --short "$GITHUB_SHA") >> $GITHUB_ENV
|
||||
- name: Download smart contract coverage report (from run-smc.tests.yml)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: smart-contract-coverage-${{ env.COMMIT_TAG }}.json
|
||||
name: smart-contract-coverage-${{ needs.filter-commit-changes.outputs.commit-tag }}.json
|
||||
path: |
|
||||
${{ github.workspace }}/coverage-final.json
|
||||
- uses: codecov/codecov-action@v5
|
||||
|
||||
@@ -30,7 +30,12 @@ jobs:
|
||||
- name: Compute version tags
|
||||
id: step1
|
||||
run: |
|
||||
echo COMMIT_TAG=$(git rev-parse --short "$GITHUB_SHA") >> $GITHUB_OUTPUT
|
||||
# For PR, GITHUB_SHA is NOT the last commit pushed onto the PR branch - https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request
|
||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
echo "COMMIT_TAG=$(git rev-parse --short ${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "COMMIT_TAG=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
echo LAST_COMMIT_TAG=$(git rev-parse --short "${{ env.EVENT_BEFORE }}") >> $GITHUB_OUTPUT
|
||||
echo DEVELOP_TAG=develop >> $GITHUB_OUTPUT
|
||||
- name: Show version tags
|
||||
|
||||
12
.github/workflows/run-smc-tests.yml
vendored
12
.github/workflows/run-smc-tests.yml
vendored
@@ -1,9 +1,15 @@
|
||||
name: Smart contracts test
|
||||
|
||||
on: workflow_call
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
commit_tag:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
env:
|
||||
GOPROXY: "https://proxy.golang.org"
|
||||
COMMIT_TAG: ${{ inputs.commit_tag }}
|
||||
|
||||
jobs:
|
||||
run-contract-tests:
|
||||
@@ -49,10 +55,6 @@ jobs:
|
||||
- name: Run smart contracts tests and generate coverage report
|
||||
run: pnpm -F contracts run coverage
|
||||
|
||||
- name: Compute and save COMMIT_TAG
|
||||
run: |
|
||||
echo COMMIT_TAG=$(git rev-parse --short "$GITHUB_SHA") >> $GITHUB_ENV
|
||||
|
||||
- name: Upload coverage report
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
||||
2
.github/workflows/testing.yml
vendored
2
.github/workflows/testing.yml
vendored
@@ -59,6 +59,8 @@ jobs:
|
||||
smart-contracts:
|
||||
uses: ./.github/workflows/run-smc-tests.yml
|
||||
if: ${{ inputs.smart_contracts_changed == 'true' }}
|
||||
with:
|
||||
commit_tag: ${{ inputs.commit_tag }}
|
||||
secrets: inherit
|
||||
|
||||
# If all jobs are skipped, the workflow will still succeed.
|
||||
|
||||
Reference in New Issue
Block a user