in workflows repo variable bypass .lnk files #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Licensed under the AGPLv3+ License: https://www.gnu.org/licenses/ | ||
# For details: https://github.com/msftcangoblowm/drain-swamp/blob/master/NOTICE.txt | ||
# | ||
# https://github.com/codecov/codecov-action | ||
# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect | ||
name: "Codecov" | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- msftcangoblowm/* | ||
pull_request: | ||
workflow_dispatch: | ||
defaults: | ||
run: | ||
shell: bash | ||
env: | ||
PIP_DISABLE_PIP_VERSION_CHECK: 1 | ||
COVERAGE_IGOR_VERBOSE: 1 | ||
FORCE_COLOR: 1 # Get colored test output | ||
LOCK_SUFFIX: ${{ vars.DRAINSWAMP_SET_LOCK == "1" && ".lock" || ".unlock" }} | ||
Check failure on line 25 in .github/workflows/test-coverage.yml
|
||
permissions: | ||
contents: write | ||
concurrency: | ||
group: >- | ||
${{ github.workflow }}-${{ github.ref_type }}- | ||
${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
jobs: | ||
codecov: | ||
name: "${{ matrix.python-version }} on ${{ matrix.os }}" | ||
runs-on: "${{ matrix.os }}-latest" | ||
# Don't run tests if the branch name includes "-notests" | ||
if: "!contains(github.ref, '-notests')" | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu | ||
python-version: | ||
- "3.9" | ||
fail-fast: false | ||
steps: | ||
- name: "Check out the repo" | ||
uses: "actions/checkout@v4" | ||
with: | ||
# fetch all branches and tags instead of only fetching the ref/SHA that triggered the workflow | ||
fetch-depth: 0 | ||
# https://stackoverflow.com/questions/66349002/get-latest-tag-git-describe-tags-when-repo-is-cloned-with-depth-1 | ||
# echo "tag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT | ||
- name: Get latest tag | ||
id: vars | ||
run: | | ||
echo "tag=$(git describe --tags)" >> $GITHUB_OUTPUT | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: "actions/setup-python@v5" | ||
with: | ||
python-version: "${{ matrix.python-version }}" | ||
# cache: pip | ||
# cache-dependency-path: 'requirements/*.lnk' | ||
allow-prereleases: true | ||
- name: "Install dependencies" | ||
run: | | ||
set -xe | ||
python -m pip install -r requirements/kit$LOCK_SUFFIX | ||
python -m pip install -r requirements/prod$LOCK_SUFFIX | ||
python -m pip install -r requirements/dev$LOCK_SUFFIX | ||
- name: "Build sdist and whl" | ||
env: | ||
RELEASE_VERSION: ${{ steps.vars.outputs.tag }} | ||
SET_LOCK: ${{ vars.DRAINSWAMP_SET_LOCK }} | ||
run: | | ||
set -xe | ||
echo "python -m build -C--kind=$RELEASE_VERSION -C--set-lock=$SET_LOCK" | ||
python -m build -C--kind="$RELEASE_VERSION -C--set-lock=$SET_LOCK" | ||
- name: "Install" | ||
run: | | ||
set -xe | ||
python -m pip install --disable-pip-version-check -q . | ||
# integration/ does not contribute to coverage | ||
- name: "Run coverage" | ||
run : | | ||
set -xe | ||
pytest --showlocals --quiet --cov=drain_swamp --cov-report=xml --cov-config=pyproject.toml tests | ||
- name: "Upload to Codecov" | ||
uses: codecov/codecov-action@v4.5.0 | ||
with: | ||
name: unittest-py3.9 | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: msftcangoblowm/drain-swamp | ||
os: linux | ||
flags: unittests | ||
file: ./coverage.xml | ||
env_vars: OS,PYTHON | ||
fail_ci_if_error: true | ||
verbose: true |