-
Notifications
You must be signed in to change notification settings - Fork 14
109 lines (98 loc) · 3.34 KB
/
python-package.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Python package
on: [push, pull_request]
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: pipenv install --dev --python 3.6
- name: generate code
run: pipenv run python local_gen.py
- uses: actions/upload-artifact@master
with:
name: generated-ldraw-library
path: ldraw/library
test:
needs: generate
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.5, 3.6, 3.7]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: pipenv install --dev --python ${{ matrix.python-version }}
- uses: actions/download-artifact@master
with:
name: generated-ldraw-library
path: ldraw/library
- name: install for test
run: |
pipenv install --dev
pipenv run pip freeze
- name: Test with pytest
run: pipenv run pytest --cov=ldraw
- name: Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.coveralls_repo_token }}
run: pipenv run coveralls
publish:
needs:
- test
- generate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: pipenv --python 3.6 install --dev
- uses: actions/download-artifact@master
with:
name: generated-ldraw-library
path: ldraw/library
- name: Build package
run: |
pipenv run python setup.py sdist bdist_wheel
- name: Twine check
run: pipenv run twine check dist/*
- name: test upload
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.testpypi_password }}
run: |
pipenv run twine upload --repository-url https://test.pypi.org/legacy/ dist/*
- name: Publish package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
pipenv run twine upload dist/*
cleanup_job:
needs: publish
if: always()
runs-on: ubuntu-latest
steps:
- name: call webhook to delete artifacts
env:
FOR_WEBHOOKS_SECRET: ${{ secrets.FOR_WEBHOOKS_SECRET }}
run: |
echo "::add-mask::$FOR_WEBHOOKS_SECRET"
curl --verbose --fail --show-error --location --request POST "https://api.github.com/repos/$GITHUB_REPOSITORY/dispatches" --header "Authorization: token $FOR_WEBHOOKS_SECRET" --header 'Content-Type: application/json' --header 'Accept: application/vnd.github.everest-preview+json' --data-raw "{ \"event_type\": \"delete_all_artifacts\", \"client_payload\": {\"parent_runid\": \"$GITHUB_RUN_ID\", \"parent_repo\": \"$GITHUB_REPOSITORY\"} }"