-
Notifications
You must be signed in to change notification settings - Fork 3
214 lines (205 loc) · 6.98 KB
/
actions.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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: CI-CD
on:
push:
branches:
- release/messaging-v3
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v2
- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- uses: actions/cache@v2.1.3
id: cache-poetry
with:
path: ~/.virtualenvs
key: ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock', 'poetry.toml') }}
- name: Configure poetry for ci
run: |
poetry config virtualenvs.in-project false --local
poetry config virtualenvs.path ~/.virtualenvs --local
- name: Install dependencies
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
poetry update && poetry install --no-root
- name: run tests
env:
VALID_TELSTRA_CLIENT_ID: ${{ secrets.VALID_TELSTRA_CLIENT_ID }}
VALID_TELSTRA_CLIENT_SECRET: ${{ secrets.VALID_TELSTRA_CLIENT_SECRET }}
run: |
poetry run pytest || (poetry install --no-root && poetry run pytest)
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- uses: pre-commit/action@v2.0.0
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install poetry
run: pip install poetry
- uses: actions/cache@v2.1.3
id: cache-poetry
with:
path: ~/.virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock', 'poetry.toml') }}
- name: Configure poetry for ci
run: |
poetry config virtualenvs.in-project false --local
poetry config virtualenvs.path ~/.virtualenvs --local
- name: Update lock file
run: |
poetry lock
- name: Install dependencies
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
poetry install
- name: Build packages
run: poetry build
- name: Upload artifacts for release
uses: actions/upload-artifact@v2.2.1
with:
name: wheel
path: dist/
release-required:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.check.outputs.result }}
project-version: ${{ steps.check.outputs.project-version }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install poetry and package
run: |
pip install --use-deprecated legacy-resolver poetry telstra.messaging
- name: Check if release is required
id: check
run: |
RELEASED_VERSION=$(python -c "from importlib.metadata import version;print(version('telstra.messaging'))")
echo released version: $RELEASED_VERSION
PROJECT_VERSION=$(poetry version -s)
echo project version: $PROJECT_VERSION
[[ "$RELEASED_VERSION" == "$PROJECT_VERSION" ]] && RESULT=false || RESULT=true
echo release required: $RESULT
echo "::set-output name=project-version::$PROJECT_VERSION"
echo "::set-output name=result::$RESULT"
# release-test-pypi:
# runs-on: ubuntu-latest
# needs:
# - test
# - build
# - pre-commit
# - release-required
# steps:
# - name: Retrieve packages
# if: needs.release-required.outputs.result == 'true'
# uses: actions/download-artifact@v2.0.7
# with:
# name: wheel
# path: dist/
# - name: Publish distribution 📦 to Test PyPI
# if: needs.release-required.outputs.result == 'true'
# uses: pypa/gh-action-pypi-publish@v1.4.1
# with:
# password: ${{ secrets.SECRET_PUBLISH_AS_TELSTRA_TEST_PYPI_ORG }}
# repository_url: https://test.pypi.org/legacy/
# test-production-test-pypi:
# runs-on: ubuntu-latest
# needs:
# - release-test-pypi
# - release-required
# steps:
# - uses: actions/checkout@v2
# - name: Set up Python
# uses: actions/setup-python@v2
# with:
# python-version: "3.10"
# - name: install pipenv
# run: |
# python -m pip install --upgrade pip
# pip install pipenv
# - name: install dependencies
# env:
# PYPI_MIRROR: https://test.pypi.org/simple/
# VERSION: ${{ needs.release-required.outputs.project-version }}
# working-directory: production-test
# run: |
# pipenv install --dev || sleep 30 && pipenv install --dev || sleep 30 && pipenv install --dev || sleep 30 && pipenv install --dev
# - name: run tests
# working-directory: production-test
# env:
# TELSTRA_CLIENT_ID: ${{ secrets.PR_TEST_CLIENT_ID_MESSAGING }}
# TELSTRA_CLIENT_SECRET: ${{ secrets.PR_TEST_CLIENT_SECRET_MESSAGING }}
# run: |
# pipenv run test
release-pypi:
runs-on: ubuntu-latest
needs:
# - test-production-test-pypi
- test
- build
- pre-commit
- release-required
steps:
- name: Retrieve packages
if: needs.release-required.outputs.result == 'true'
uses: actions/download-artifact@v2.0.7
with:
name: wheel
path: dist/
- name: Publish distribution 📦 to PyPI
if: needs.release-required.outputs.result == 'true'
uses: pypa/gh-action-pypi-publish@v1.4.1
with:
password: ${{ secrets.SECRET_PUBLISH_AS_TELSTRA_PYPI_ORG }}
# test-production-pypi:
# runs-on: ubuntu-latest
# needs:
# - release-pypi
# - release-required
# steps:
# - uses: actions/checkout@v2
# - name: Set up Python
# uses: actions/setup-python@v2
# with:
# python-version: "3.10"
# - name: install pipenv
# run: |
# python -m pip install --upgrade pip
# pip install pipenv
# - name: install dependencies
# env:
# PYPI_MIRROR: https://pypi.org/simple/
# VERSION: ${{ needs.release-required.outputs.project-version }}
# working-directory: production-test
# run: |
# pipenv install --dev || sleep 30 && pipenv install --dev || sleep 30 && pipenv install --dev || sleep 30 && pipenv install --dev
# - name: run tests
# working-directory: production-test
# env:
# TELSTRA_CLIENT_ID: ${{ secrets.PR_TEST_CLIENT_ID_MESSAGING }}
# TELSTRA_CLIENT_SECRET: ${{ secrets.PR_TEST_CLIENT_SECRET_MESSAGING }}
# run: |
# pipenv run test