-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (42 loc) · 1.64 KB
/
test_and_upload_to_pypi_test.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
name: Test & Upload to TestPyPI
# Controls when the action will run.
on:
# Triggers the workflow on push to anything except the main branch
push:
branches: # ref: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
- '*' # For negation we have to have a least one positive match; so we will just match everything
- '!main' # Then discard the main match
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checks-out the the under $GITHUB_WORKSPACE
- uses: actions/checkout@v2
# Set up python3
- uses: actions/setup-python@v2
with:
python-version: 3.8
# Installs and upgrades pip, installs other dependencies and installs the package from setup.py
- name: "Installs and upgrades pip, installs other dependencies and installs the package from setup.py"
run: |
# Upgrade pip
python3 -m pip install --upgrade pip
# Install build deps
python3 -m pip install setuptools wheel twine
python3 setup.py install
# Tests with unittest
- name: Test with unittest
run: |
pytest -v --tb no tests/
# Upload to TestPyPI
- name: Build and Upload to TestPyPI
run: |
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_API_TOKEN }}
TWINE_REPOSITORY: testpypi