diff --git a/.circleci/config.yml b/.circleci/config.yml index 5fc6d40897..93410a7c81 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,7 +28,19 @@ jobs: pixi run --as-is esmvaltool -- --help pixi run --as-is esmvaltool config list pixi run --as-is esmvaltool config show + - run: + name: Set the branch name for upload to Codecov + command: | + # Specify an "unprotected" branch name when the pull request comes + # from a fork: https://docs.codecov.com/docs/codecov-tokens#when-do-i-need-a-token + branch="$(git branch --show-current)" + prefix="${CIRCLE_PR_USERNAME}/${CIRCLE_PR_REPONAME}" + if [ -z "$CODECOV_TOKEN" ] && [ "${prefix}" != "${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" ]; then + branch="${prefix}:${branch}" + fi + echo "export CODECOV_BRANCH=${branch}" >> $BASH_ENV - codecov/upload: + branch: "${CODECOV_BRANCH}" files: "test-reports/coverage.xml" disable_search: true - store_test_results: diff --git a/.github/workflows/run-tests-fork.yml b/.github/workflows/run-tests-fork.yml deleted file mode 100644 index 6d80e83e9f..0000000000 --- a/.github/workflows/run-tests-fork.yml +++ /dev/null @@ -1,37 +0,0 @@ ---- -name: Test and Cov Fork PR - -permissions: {} - -# runs only on a forked PR targeting ESMValCore main -on: - pull_request: - branches: - - main - -defaults: - run: - shell: pixi run bash -e {0} - -jobs: - test: - runs-on: ubuntu-latest - # run action ONLY on a fork PR - if: github.event.pull_request.head.repo.full_name != github.repository - name: ubuntu-latest test-py314 - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - fetch-depth: 0 - persist-credentials: false - - uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1 - with: - frozen: true - environments: test-py314 - - name: Check dependencies are compatible - run: pip check - - name: Run tests - run: pytest -n 2 --durations=10 --cov --cov-branch --cov-report=xml - - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 - with: - files: ./coverage.xml