Skip to content

ci: bump codecov/test-results-action from 1.1.1 to 1.2.1 #1265

ci: bump codecov/test-results-action from 1.1.1 to 1.2.1

ci: bump codecov/test-results-action from 1.1.1 to 1.2.1 #1265

Workflow file for this run

name: Build
on: [push, pull_request]
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: '3.10'
- run: |
python -m pip install pylint
python -m pip install -e .
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
with:
extra_args: pylint --all-files
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: '3.10'
- name: Build sdist
run: |
python -m pip install --user build
python -m build --sdist
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: source
path: dist/*.tar.gz
build_wheels:
needs: build_sdist
name: Build wheel ${{ matrix.py }}-${{ matrix.platform.wheel_tag }} on ${{ matrix.platform.os }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
py: [cp310, cp311, cp312, cp313, cp314]
platform:
- { arch: x86_64, os: windows-latest, wheel_tag: win_amd64 }
- { arch: x86_64, os: macos-15-intel, wheel_tag: macosx_x86_64 }
- { arch: arm64, os: macos-latest, wheel_tag: macosx_arm64 }
- { arch: x86_64, os: ubuntu-latest, wheel_tag: manylinux_x86_64 }
- { arch: aarch64, os: ubuntu-24.04-arm, wheel_tag: manylinux_aarch64 }
steps:
- name: Download source distribution
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: source
- name: Unpack source distribution
shell: bash
run: tar --strip-components 1 -xvf *.tar.gz
- name: Build wheel
uses: pypa/cibuildwheel@63fd63b352a9a8bdcc24791c9dbee952ee9a8abc # v3.3.0
with:
output-dir: wheelhouse
env:
CIBW_ARCHS_MACOS: ${{ matrix.platform.arch }}
CIBW_BUILD: ${{ matrix.py }}-${{ matrix.platform.wheel_tag }}
CIBW_TEST_COMMAND: python -m unittest discover -v -s {package}/tests
CIBW_BUILD_VERBOSITY: 1
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.platform.arch == 'arm64' && '11' || '10.14' }}
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: ${{ matrix.py }}-${{ matrix.platform.wheel_tag }}
path: ./wheelhouse/*.whl
build_docs:
name: Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: '3.12'
- run: |
pip install -e .[docs]
cd docs && make html coverage
test_coverage:
name: Test with coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: '3.13'
- name: Run tests
run: |
pip install setuptools nanobind cmake
COVERAGE=1 pip install --no-build-isolation -e .[testing]
pytest -vv \
--junitxml=junit.xml -o junit_family=legacy \
--cov-report=xml \
|| [[ $? -lt 2 ]] # Accept success and test failures, fail on infrastructure problems (exit codes >1)
gcovr -r . \
--print-summary \
--xml-pretty \
-o coverage-native.xml \
--gcov-filter 'pypcode_native.cpp'
[[ -e ./junit.xml && -e coverage.xml && -e ./coverage-native.xml ]]
- name: Upload test results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: results
include-hidden-files: true
if-no-files-found: error
path: |
./junit.xml
./coverage.xml
./coverage-native.xml
upload_coverage:
name: Upload test results to Codecov
needs: [test_coverage]
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: results
- name: Upload test coverage to Codecov
uses: codecov/codecov-action@v5
with:
use_oidc: true
fail_ci_if_error: true
verbose: true
files: ./coverage.xml ./coverage-native.xml
- name: Upload test results to Codecov
uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 # v1
with:
use_oidc: true
fail_ci_if_error: true
verbose: true
files: ./junit.xml
upload_pypi:
name: Upload wheels to PyPI
needs: [lint, build_docs, build_sdist, build_wheels, upload_coverage]
environment:
name: pypi
url: https://pypi.org/p/pypcode
permissions:
id-token: write
runs-on: ubuntu-latest
# Upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
path: artifacts
- run: |
mkdir dist
find artifacts -type f \( -name '*.whl' -o -name '*.tar.gz' \) -exec mv {} dist \;
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0