Skip to content

Commit ddfeecb

Browse files
committed
Add workflows
1 parent 52c1535 commit ddfeecb

File tree

2 files changed

+100
-3
lines changed

2 files changed

+100
-3
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Tests & Publishes to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
branches:
11+
- "*"
12+
13+
env:
14+
PROJECT_NAME: unilvq
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
23+
24+
steps:
25+
- uses: actions/checkout@v3
26+
with:
27+
fetch-depth: 9
28+
submodules: false
29+
30+
- name: Use Python ${{ matrix.python-version }}
31+
uses: actions/setup-python@v4
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
35+
- uses: actions/cache@v3
36+
id: depcache
37+
with:
38+
path: deps
39+
key: requirements-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
40+
41+
- name: Download dependencies
42+
if: steps.depcache.outputs.cache-hit != 'true'
43+
run: |
44+
pip download --dest=deps -r requirements.txt
45+
46+
- name: Install dependencies
47+
run: |
48+
pip install -U --no-index --find-links=deps deps/*
49+
50+
- name: Run tests
51+
run: |
52+
pytest --doctest-modules --junitxml=junit/pytest-results-${{ matrix.python-version }}.xml --cov=$PROJECT_NAME --cov-report=xml tests/
53+
flake8 tests/
54+
55+
- name: Upload pytest test results
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: pytest-results-${{ matrix.python-version }}
59+
path: junit/pytest-results-${{ matrix.python-version }}.xml
60+
if: always()
61+
62+
- name: Install distribution dependencies
63+
run: pip install --upgrade twine setuptools wheel
64+
if: matrix.python-version == 3.11
65+
66+
- name: Create distribution package
67+
run: python setup.py sdist bdist_wheel
68+
if: matrix.python-version == 3.11
69+
70+
- name: Upload distribution package
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: dist-package-${{ matrix.python-version }}
74+
path: dist
75+
if: matrix.python-version == 3.11
76+
77+
publish:
78+
runs-on: ubuntu-latest
79+
needs: build
80+
if: github.event_name == 'release'
81+
steps:
82+
- name: Download a distribution artifact
83+
uses: actions/download-artifact@v4
84+
with:
85+
name: dist-package-3.11
86+
path: dist
87+
88+
- name: Publish distribution 📦 to Test PyPI
89+
uses: pypa/gh-action-pypi-publish@release/v1
90+
with:
91+
skip_existing: true
92+
user: __token__
93+
password: ${{ secrets.test_pypi_password }}
94+
repository_url: https://test.pypi.org/legacy/
95+
96+
- name: Publish distribution 📦 to PyPI
97+
uses: pypa/gh-action-pypi-publish@release/v1
98+
with:
99+
user: __token__
100+
password: ${{ secrets.pypi_password }}

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
drafts/
2-
.github/
3-
docs/
4-
.readthedocs.yaml
52
tut_upcode.md
63

74
.idea/

0 commit comments

Comments
 (0)