-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (81 loc) · 3.13 KB
/
publish-to-pypi.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
name: Publish python distribution to PyPI
on: push
jobs:
build-and-publish-test:
name: Build and publish python distribution to test PyPI
runs-on: ubuntu-18.04
if: "!(startsWith(github.event.ref, 'refs/tags') || github.ref == 'refs/heads/master')"
continue-on-error: true
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Setup pip
run: python -m pip install pip==21.0.1
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
python_version: '3.8.10'
poetry_version: "==1.1.4"
repository_name: 'pytest_mock_generator'
repository_url: 'https://test.pypi.org/legacy/'
pypi_token: ${{ secrets.test_pypi_password }}
continue-on-error: true
- name: Sleep to allow pypi index to update with the new version
run: sleep 5m
- name: Install poetry
run: make poetry-download
- name: Cleanup
run: |
rm -r pytest_mock_generator
pip uninstall pytest-mock-generator
- name: Perform System tests
run: |
poetry export --dev --without-hashes -f requirements.txt --output test-requirements.txt
pip install -r test-requirements.txt
pip install -i https://test.pypi.org/simple/ pytest-mock-generator
python -m pytest -vvv -k "test_public_api"
export INSTALLED=`pip freeze | grep pytest-mock-generator`
export EXPECTED=`poetry version --short`
if [ "${INSTALLED:23}" != "$EXPECTED" ]; then exit 1; fi
build-and-publish-production:
name: Build and publish python distribution to production PyPI
runs-on: ubuntu-18.04
if: startsWith(github.event.ref, 'refs/tags')
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Setup pip
run: python -m pip install pip==21.0.1
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
python_version: '3.8.10'
poetry_version: "==1.1.4"
repository_name: 'pytest_mock_generator'
pypi_token: ${{ secrets.prod_pypi_password }}
continue-on-error: true
- name: Sleep to allow pypi index to update with the new version
run: sleep 5m
- name: Install poetry
run: make poetry-download
- name: Cleanup
run: |
rm -r pytest_mock_generator
pip uninstall pytest-mock-generator
- name: Perform System tests
run: |
poetry export --dev --without-hashes -f requirements.txt --output test-requirements.txt
pip install -r test-requirements.txt
pip install pytest-mock-generator
python -m pytest -vvv -k "test_public_api"
export INSTALLED=`pip freeze | grep pytest-mock-generator`
export EXPECTED=`poetry version --short`
if [ "${INSTALLED:23}" != "$EXPECTED" ]; then exit 1; fi