build(deps): bump actions/download-artifact in /.github/workflows #145
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
# This workflow will install Python dependencies and run tests with a variety of Python versions | |
# It uses the Python Package GitHub Actions workflow. | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
# and https://www.youtube.com/watch?v=l6fV09z5XHk | |
name: ci-build | |
on: | |
push: | |
branches: | |
- master # $default-branch only works in Workflows templates, not in Workflows, see https://stackoverflow.com/questions/64781462/github-actions-default-branch-variable | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.10", "3.11", "*", pypy-3.9] # check the list of versions: https://github.com/actions/python-versions/releases and https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md -- note that "*" represents the latest stable version of Python | |
os: [ ubuntu-latest, windows-latest, macos-latest ] # jobs that run on Windows and macOS runners that GitHub hosts consume minutes at 2 and 10 times the rate that jobs on Linux runners consume respectively. But it's free for public OSS repositories. | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
# You can test your matrix by printing the current Python version | |
- name: Display Python version | |
run: | | |
python -c "import sys; print(sys.version)" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
#python -m pip install pytest pytest-cov # done in setup.cfg for Py2 or pyproject.toml for Py3 | |
#if [ ${{ matrix.python-version }} <= 3.7 ]; then python -m pip install 'coverage<4'; else python -m pip install coverage; fi | |
#if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Install this module without testmeta | |
if: ${{ matrix.python-version != '*' }} | |
#if: ${{ matrix.python-version >= 3 }} # does not work on dynamic versions, see: https://github.com/actions/setup-python/issues/644 | |
# Do not import testmeta, they make the build fails somehow, because some dependencies are unavailable on Py2 | |
# We use test.pypi.org to test against cutting-edge builds of reedsolo | |
run: | | |
python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --upgrade --editable .[test] --verbose --use-pep517 | |
- name: Install this module with testmeta packages | |
if: ${{ matrix.python-version == '*' }} | |
run: | | |
python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --upgrade --editable .[test,testmeta] --verbose --use-pep517 | |
- name: Test with pytest | |
run: | | |
coverage run --branch -m pytest . -v | |
coverage report -m | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # now required even for public repos, and also advised to avoid rate-limiting API by GitHub which makes the upload fails randomly: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954/9 and https://github.com/codecov/codecov-action/issues/598 | |
#directory: ./coverage/reports/ | |
env_vars: OS,PYTHON | |
fail_ci_if_error: true | |
#files: ./coverage1.xml,./coverage2.xml | |
flags: unittests | |
name: codecov-umbrella | |
verbose: true | |
- name: Build sdist (necessary for the other tests below) | |
if: ${{ matrix.python-version == '*' }} | |
run: python -sBm build | |
- name: Twine check | |
if: ${{ matrix.python-version == '*' }} | |
run: | | |
twine check "dist/*" | |
rstcheck README.rst | |
- name: pyproject.toml validity | |
if: ${{ matrix.python-version == '*' }} | |
run: validate-pyproject pyproject.toml -v |