use named environment #123
Workflow file for this run
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
name: CI/CD | |
on: | |
pull_request: | |
workflow_dispatch: | |
push: | |
tags: | |
- "*" | |
branches: | |
- main | |
jobs: | |
unit_testing: | |
name: Build and Testing | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
env: | |
KEEPAKEY: ${{ secrets.KEEPAKEY }} | |
WEAKKEEPAKEY: ${{ secrets.WEAKKEEPAKEY }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: | | |
**/setup.py | |
**/requirements*.txt | |
- name: Install | |
run: | | |
pip install .[test] --disable-pip-version-check | |
python -c "import keepa" | |
- name: Validate Keys | |
run: | | |
python -c "import os, keepa; keepa.Keepa(os.environ.get('KEEPAKEY'))" | |
- name: Unit testing | |
run: | | |
pytest -v --cov keepa --cov-report xml | |
- uses: codecov/codecov-action@v3 | |
if: matrix.python-version == '3.12' | |
name: 'Upload coverage to codecov' | |
- name: Build wheel | |
if: matrix.python-version == '3.12' | |
run: | | |
pip install build --disable-pip-version-check | |
python -m build | |
- name: Upload wheel | |
if: matrix.python-version == '3.12' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: keepa-wheel | |
path: dist/ | |
retention-days: 1 | |
release: | |
name: Upload release to PyPI | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | |
needs: [unit_testing] | |
runs-on: ubuntu-latest | |
environment: | |
name: deployment | |
url: https://pypi.org/p/keepa | |
permissions: | |
id-token: write # this permission is mandatory for trusted publishing | |
steps: | |
- uses: actions/download-artifact@v2 | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true | |
files: | | |
./**/*.whl |