-
Notifications
You must be signed in to change notification settings - Fork 0
197 lines (154 loc) · 5.21 KB
/
01-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
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: 01_ci-cd
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: build
runs-on: ubuntu-latest
needs: [ i18n ]
permissions:
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pipenv
pipenv install --dev --ignore-pipfile
- name: Unit tests
run: |
pipenv run pytest -svv tests/ --junitxml=junit/unit-test-results-3.8.xml
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: unit-test-results-3.8
path: junit/unit-test-results-3.8.xml
- name: Publish Test Result
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: junit/unit-test-results-3.8.xml
check_name: Unit Tests
- uses: ./.github/actions/download-i18n
- name: build artifact
run: |
python -m pip install wheel
python setup.py sdist bdist_wheel
- uses: actions/upload-artifact@v3
with:
name: hexagon-${{ github.sha }}
path: dist/*.tar.gz
test:
name: test
runs-on: ubuntu-latest
needs: [ i18n, build ]
strategy:
fail-fast: false
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
permissions:
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v3
with:
name: hexagon-${{ github.sha }}
path: dist
- uses: ./.github/actions/download-i18n
- name: Setup e2e dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
python -m pip install --find-links=./dist hexagon
- name: e2e tests
uses: nick-fields/retry@v2
with:
timeout_minutes: 3
max_attempts: 3
retry_on: error
command: |
echo "Running e2e tests for Python ${{ matrix.python-version }}"
echo "COLUMNS: $COLUMNS, ROWS: $ROWS"
pytest -svv tests_e2e/ --junitxml=junit/e2e-test-results-${{ matrix.python-version }}.xml
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: e2e-test-results-${{ matrix.python-version }}
path: junit/e2e-test-results-${{ matrix.python-version }}.xml
- name: Publish Test Result
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: junit/e2e-test-results-${{ matrix.python-version }}.xml
check_name: E2E Tests Python${{ matrix.python-version }}
i18n:
name: i18n
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: install gettext
run: sudo apt-get install -y gettext
- name: add matcher
run: echo "::add-matcher::.github/i18n-problem-matcher.json"
- name: build locales
run: .github/scripts/i18n/build.sh
- name: validate translations
run: .github/scripts/i18n/check.sh
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: i18n
path: locales/**/*.mo
- name: remove matcher
run: echo "::remove-matcher owner=hexagon-i18n::"
release:
if: ${{ github.event_name != 'pull_request' && github.event_name != 'pull_request_target' }}
runs-on: ubuntu-latest
needs: [ build, test, i18n ]
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.USER_TOKEN }}
- uses: ./.github/actions/download-i18n
- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@v7.34.6
with:
github_token: ${{ secrets.USER_TOKEN }}
nightly:
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
runs-on: ubuntu-latest
needs: [ test ]
permissions:
pull-requests: write
steps:
- uses: marocchino/sticky-pull-request-comment@v2
with:
header: nightly
message: |
## Beta Available!
:rocket: see nightly build [details](https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}/hexagon-${{ github.sha }})
Install locally with:
```bash
python3 -m pip install https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}/hexagon-${{ github.sha }}.zip
```