-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (85 loc) · 2.32 KB
/
python.yaml
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
# This file is part of DataSae and is released under
# the AGPL-3.0-only License: https://opensource.org/license/agpl-v3/
name: Python Application
on: [pull_request, push]
jobs:
lint:
name: Linter Test
runs-on: ubuntu-latest
container:
image: pipelinecomponents/flake8
steps:
- uses: actions/checkout@v3
- name: Lint with flake8
run: flake8
unittest:
name: Unit Test
if: github.event_name == 'pull_request' || contains('refs/heads/main refs/heads/develop', github.ref)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.7'
- name: Install dependencies
run: pip install .
- name: Test
run: python -m unittest
build:
name: Build Python Package
if: always()
needs: [lint, unittest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.7'
cache: pip
- name: Install dependencies
run: pip install build twine
- name: Restore cache
id: cache-python-package
uses: actions/cache/restore@v3
with:
path: dist/
key: python-package
- name: Clear old cache
if: steps.cache-python-package.outputs.cache-hit == 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
run: gh cache delete python-package
- name: Build package
run: python -m build
- name: Save cache
uses: actions/cache/save@v3
with:
path: dist/
key: python-package
publish:
name: Publish Package to TestPyPI
if: always()
needs: build
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.7'
cache: pip
- name: Cache package
uses: actions/cache@v3
with:
path: dist/
key: python-package
- name: Publish package
run: |
python -m twine \
upload \
--repository-url https://test.pypi.org/legacy/ \
-u __token__ \
-p ${{ secrets.TESTPYPI_TOKEN }} \
--skip-existing \
dist/*