-
Notifications
You must be signed in to change notification settings - Fork 2
133 lines (128 loc) · 4.27 KB
/
default.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: default
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: |
setup.cfg
requirements/lint.txt
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/lint.txt
- name: Lint with flake8
run: |
if [ "$GITHUB_EVENT_NAME" == "pull_request" -a -n "$GITHUB_HEAD_REF" ]; then
echo "(skipping matchers for pull request from local branches)"
else
echo "::add-matcher::.github/workflows/flake8-matcher.json"
fi
python -m flake8 src/etcetra tests
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: |
setup.cfg
requirements/typecheck.txt
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/typecheck.txt
- name: Type check with mypy
run: |
if [ "$GITHUB_EVENT_NAME" == "pull_request" -a -n "$GITHUB_HEAD_REF" ]; then
echo "(skipping matchers for pull request from local branches)"
else
echo "::add-matcher::.github/workflows/mypy-matcher.json"
fi
python -m mypy --no-color-output src/etcetra tests
test:
runs-on: ubuntu-latest
# runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: |
setup.cfg
requirements/test.txt
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/test.txt
- name: Prepare testing
run: |
mkdir -p /tmp/etcd
docker run -d -p 2379:2379 -p 2380:2380 \
-v /tmp/etcd:/etcd-data \
--name backendai-etcd \
quay.io/coreos/etcd:v3.4.1 \
/usr/local/bin/etcd \
--name backendai-etcd \
--data-dir /etcd-data \
--listen-client-urls http://0.0.0.0:2379 \
--advertise-client-urls http://0.0.0.0:2379 \
--listen-peer-urls http://0.0.0.0:2380 \
--initial-advertise-peer-urls http://0.0.0.0:2380 \
--initial-cluster backendai-etcd=http://0.0.0.0:2380 \
--initial-cluster-token backendai-etcd-token \
--initial-cluster-state new \
--auto-compaction-retention 1
- name: Register post-action to clean the temporary etcd container
uses: webiny/[email protected]
id: clean-temporary-etcd-container
with:
run: docker rm -f backendai-etcd
- name: Test with pytest
timeout-minutes: 6
run: |
python -m pytest -v --cov=src
- name: Send code coverage report
uses: codecov/codecov-action@v1
deploy-to-pypi:
needs: [lint, typecheck, test]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
environment:
name: deploy-to-pypi
url: https://pypi.org/p/etcetra
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: |
setup.cfg
requirements/build.txt
- name: Install dependencies
env:
REQUIREMENTS_FILE: build
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/build.txt
- name: Build wheel
run: |
python setup.py sdist bdist_wheel
- name: >-
Publish 🐍📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1