Skip to content

build(deps): update to codecov@v4 and use secret for token #148

build(deps): update to codecov@v4 and use secret for token

build(deps): update to codecov@v4 and use secret for token #148

Workflow file for this run

name: Linter and tests (PRs)
on:
pull_request_target:
branches:
- main
jobs:
approve:
runs-on: ubuntu-latest
steps:
- name: Approve
run: echo For security reasons, all pull requests need to be approved first before running the Premium Acceptance Tests.
codeql:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: python
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
build-docs:
uses: ./.github/workflows/docs.yml
with:
branch_ref: ${{ github.event.pull_request.head.sha }}
linters:
uses: ./.github/workflows/linters.yml
with:
branch_ref: ${{ github.event.pull_request.head.sha }}
tests-standard:
uses: ./.github/workflows/tests-standard.yml
with:
branch_ref: ${{ github.event.pull_request.head.sha }}
secrets: inherit
# you cannot use reusable workflows with an "environment" key,
# so we have to copy "tests-premium.yml" here :(
acceptance-tests-premium:
runs-on: ubuntu-latest
needs: [ approve ] # Require the first step to finish
environment:
name: Integrate Pull Request # Our dummy environment
strategy:
max-parallel: 5
matrix:
python-version: [3.12]
fail-fast : false
steps:
- name: Checkout code from the PR
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies
run: |
pip install wheel
pip install -e .[test]
- name: Run acceptance tests that require premium license
env:
GITLAB_EE_LICENSE: ${{ secrets.GITLAB_EE_LICENSE }}
run: |
./dev/run_gitlab_in_docker.sh
pytest --cov=. --cov-report=xml --durations=0 --reruns 3 --reruns-delay 10 tests/acceptance/premium
- name: Upload coverage to Codecov
uses: Wandalen/wretry.action@v1
with:
action: codecov/codecov-action@v4
with:
name: codecov-acceptance-test-premium
flags: integration
fail_ci_if_error: true
override_pr: ${{ github.event.number }}
override_commit: ${{ github.event.pull_request.head.sha }}
token: ${{ secrets.CODECOV_TOKEN }}
attempt_limit: 5
attempt_delay: 10000
# you cannot use reusable workflows with an "environment" key,
# so we have to copy "tests-ultimate.yml" here :(
acceptance-tests-ultimate:
runs-on: ubuntu-latest
needs: [ approve ] # Require the first step to finish
environment:
name: Integrate Pull Request # Our dummy environment
strategy:
max-parallel: 5
matrix:
python-version: [3.12]
fail-fast : false
steps:
- name: Checkout code from the PR
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies
run: |
pip install wheel
pip install -e .[test]
- name: Run acceptance tests that require Ultimate license (OPTIONAL)
continue-on-error: true # Ultimate License via link only lasts for 90days so may need renewing, don't block other PRs
env:
# requested via: https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributing-to-the-gitlab-enterprise-edition-ee
# https://gitlab.com/gitlab-org/developer-relations/contributor-success/team-task/-/issues
GITLAB_EE_LICENSE: ${{ secrets.GITLAB_EE_ULTIMATE_LICENSE }}
run: |
./dev/run_gitlab_in_docker.sh
pytest --cov=. --cov-report=xml --durations=0 --reruns 3 --reruns-delay 10 tests/acceptance/ultimate
- name: Upload coverage to Codecov
uses: Wandalen/wretry.action@v1
with:
action: codecov/codecov-action@v4
with:
name: codecov-acceptance-test-ultimate
flags: integration
override_pr: ${{ github.event.number }}
override_commit: ${{ github.event.pull_request.head.sha }}
token: ${{ secrets.CODECOV_TOKEN }}
attempt_limit: 5
attempt_delay: 10000