-
Notifications
You must be signed in to change notification settings - Fork 79
91 lines (79 loc) · 2.3 KB
/
testing-and-deployment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- 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@v4
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@v4
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: pypi
url: https://pypi.org/p/keepa
permissions:
id-token: write # this permission is mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
path: dist/
- name: Flatten directory structure
run: |
mv dist/*/* dist/
rm -rf dist/keepa-wheel
- 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@v2
with:
generate_release_notes: true
files: |
./**/*.whl