-
Notifications
You must be signed in to change notification settings - Fork 7
71 lines (61 loc) · 1.95 KB
/
pythonpackage.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
name: pytest
on: [push]
jobs:
test:
runs-on: ${{ matrix.os-python-version.os }}
strategy:
max-parallel: 4
matrix:
os-python-version:
[
{ "os": "ubuntu-latest", "python": "3.7" },
{ "os": "ubuntu-latest", "python": '3.8' },
{ "os": "ubuntu-latest", "python": "3.10" },
]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.os-python-version.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.os-python-version.python }}
- name: Install dependencies
run: |
pip install poetry>=0.12
poetry config virtualenvs.create false --local
poetry install
- name: Test with pytest
run: |
pytest
build_and_deploy:
needs: test
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/master' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Install pypa/build
run: |
python -m pip install build --user
- name: Build a source tarball
run: |
python -m build --sdist --outdir dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Push to s3
env:
AWS_S3_BUCKET: pypi.candidco.com
SOURCE_DIR: "."
run: |
pip install s3pypi==0.11.0
pip install poetry2setup
poetry2setup > setup.py
s3pypi --bucket pypi.candidco.com --private || echo "ERROR: push failed for $package";