icalendar/.github/workflows/tests.yml

158 wiersze
5.1 KiB
YAML

2021-11-22 21:17:53 +00:00
name: tests
on:
push:
branches:
- main
tags:
- v*
2021-11-22 21:17:53 +00:00
pull_request:
schedule:
- cron: '14 7 * * 0' # run once a week on Sunday
workflow_dispatch:
jobs:
run-tests:
2021-11-22 21:17:53 +00:00
strategy:
matrix:
config:
# [Python version, tox env]
- ["3.8", "py38"]
- ["3.8", "nopytz"]
2021-11-22 21:17:53 +00:00
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["pypy-3.9", "pypy3"]
2024-07-01 22:14:45 +00:00
# - ["3.10", "docs"] # disable as readthedocs builds it
- ["3.11", "py311"]
- ["3.12", "py312"]
2024-10-13 17:24:02 +00:00
- ["3.13", "py313"]
2021-11-22 21:17:53 +00:00
runs-on: ubuntu-latest
name: ${{ matrix.config[1] }}
steps:
2023-11-20 16:39:06 +00:00
- uses: actions/checkout@v4
2021-11-22 21:17:53 +00:00
- name: Set up Python
Bump the github-actions group with 5 updates Bumps the github-actions group with 5 updates: | Package | From | To | | --- | --- | --- | | [actions/upload-artifact](https://github.com/actions/upload-artifact) | `3` | `4` | | [github/codeql-action](https://github.com/github/codeql-action) | `2` | `3` | | [actions/checkout](https://github.com/actions/checkout) | `3` | `4` | | [actions/setup-python](https://github.com/actions/setup-python) | `4` | `5` | | [elgohr/Github-Release-Action](https://github.com/elgohr/github-release-action) | `4` | `5` | Updates `actions/upload-artifact` from 3 to 4 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4) Updates `github/codeql-action` from 2 to 3 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v2...v3) Updates `actions/checkout` from 3 to 4 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) Updates `actions/setup-python` from 4 to 5 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v4...v5) Updates `elgohr/Github-Release-Action` from 4 to 5 - [Release notes](https://github.com/elgohr/github-release-action/releases) - [Commits](https://github.com/elgohr/github-release-action/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: elgohr/Github-Release-Action dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions ... Signed-off-by: dependabot[bot] <support@github.com>
2024-01-29 14:38:35 +00:00
uses: actions/setup-python@v5
2021-11-22 21:17:53 +00:00
with:
python-version: ${{ matrix.config[0] }}
2023-11-20 16:39:06 +00:00
# for caching, see
2023-08-30 06:48:55 +00:00
# https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages
cache: 'pip'
2023-08-30 06:48:55 +00:00
cache-dependency-path: |
setup.*
tox.ini
requirements*.txt
2021-11-22 21:17:53 +00:00
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox coveralls coverage-python-version
2021-11-22 21:17:53 +00:00
- name: Test
run: tox -e ${{ matrix.config[1] }}
2024-07-01 21:34:37 +00:00
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
2024-07-01 22:17:44 +00:00
flag-name: run-${{ matrix.config[1] }}
2024-07-01 21:34:37 +00:00
parallel: true
2024-07-01 21:59:57 +00:00
file: coverage.xml
allow-empty: true
coverage:
# parallel test coverage upload
# see https://coveralls-python.readthedocs.io/en/latest/usage/configuration.html#github-actions-support
name: Submit test coverage
needs: run-tests
# always finalize coverage aftest tests ran
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-not-requiring-successful-dependent-jobs
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
2024-07-01 21:34:37 +00:00
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
format: cobertura
2024-07-03 14:21:00 +00:00
test-distribution:
name: Check built package
2024-07-03 14:24:12 +00:00
runs-on: ubuntu-latest
2024-07-03 14:21:00 +00:00
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
2024-10-13 17:24:02 +00:00
python-version: "3.13"
2024-07-03 14:21:00 +00:00
- name: Install dependencies
run: |
python -m pip install --upgrade pip
2024-09-25 13:43:58 +00:00
pip install build twine
2024-07-03 14:21:00 +00:00
- name: Build distribution files
2024-09-05 10:21:52 +00:00
run: python -m build # same as in deploy-tag-to-pypi
2024-07-03 14:21:00 +00:00
- name: Check distribution files
run: twine check dist/*
deploy-tag-to-pypi:
# only deploy on tags, see https://stackoverflow.com/a/58478262/1320237
if: startsWith(github.ref, 'refs/tags/v')
needs:
- run-tests
2024-07-03 14:21:00 +00:00
- test-distribution
runs-on: ubuntu-latest
# This environment stores the TWINE_USERNAME and TWINE_PASSWORD
# see https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
environment:
name: PyPI
url: https://pypi.org/project/icalendar/
# after using the environment, we need to make the secrets available
# see https://docs.github.com/en/actions/security-guides/encrypted-secrets#example-using-bash
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
steps:
2023-11-20 16:39:06 +00:00
- uses: actions/checkout@v4
- name: Set up Python
Bump the github-actions group with 5 updates Bumps the github-actions group with 5 updates: | Package | From | To | | --- | --- | --- | | [actions/upload-artifact](https://github.com/actions/upload-artifact) | `3` | `4` | | [github/codeql-action](https://github.com/github/codeql-action) | `2` | `3` | | [actions/checkout](https://github.com/actions/checkout) | `3` | `4` | | [actions/setup-python](https://github.com/actions/setup-python) | `4` | `5` | | [elgohr/Github-Release-Action](https://github.com/elgohr/github-release-action) | `4` | `5` | Updates `actions/upload-artifact` from 3 to 4 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4) Updates `github/codeql-action` from 2 to 3 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v2...v3) Updates `actions/checkout` from 3 to 4 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) Updates `actions/setup-python` from 4 to 5 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v4...v5) Updates `elgohr/Github-Release-Action` from 4 to 5 - [Release notes](https://github.com/elgohr/github-release-action/releases) - [Commits](https://github.com/elgohr/github-release-action/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: elgohr/Github-Release-Action dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions ... Signed-off-by: dependabot[bot] <support@github.com>
2024-01-29 14:38:35 +00:00
uses: actions/setup-python@v5
with:
2024-10-13 17:24:02 +00:00
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
2024-09-25 13:47:28 +00:00
pip install build twine
- name: remove old files
run: rm -rf dist/*
- name: build distribution files
2024-09-05 10:21:52 +00:00
run: python -m build # same as in test-distribution
- name: deploy to pypi
run: |
# You will have to set the variables TWINE_USERNAME and TWINE_PASSWORD
# You can use a token specific to your project by setting the user name to
# __token__ and the password to the token given to you by the PyPI project.
# sources:
# - https://shambu2k.hashnode.dev/gitlab-to-pypi
# - http://blog.octomy.org/2020/11/deploying-python-pacakges-to-pypi-using.html?m=1
if [ -z "$TWINE_USERNAME" ]; then
echo "WARNING: TWINE_USERNAME not set!"
fi
if [ -z "$TWINE_PASSWORD" ]; then
echo "WARNING: TWINE_PASSWORD not set!"
fi
twine check dist/*
twine upload dist/*
2023-09-30 09:25:21 +00:00
deploy-github-release:
# only deploy on tags, see https://stackoverflow.com/a/58478262/1320237
if: startsWith(github.ref, 'refs/tags/v')
needs:
2024-07-03 14:21:00 +00:00
- run-tests
- test-distribution
runs-on: ubuntu-latest
environment:
name: github-release
steps:
2023-11-20 16:39:06 +00:00
- uses: actions/checkout@v4
- name: Create GitHub release from tag
2024-03-19 22:37:40 +00:00
uses: ncipollo/release-action@v1
with:
allowUpdates: true
body: "To view the changes, please see the [Changelog](https://icalendar.readthedocs.io/en/latest/changelog.html). This release can be installed from [PyPI](https://pypi.org/project/icalendar/#history)."
generateReleaseNotes: false