|
a |
|
b/.github/workflows/pythonpackage.yml |
|
|
1 |
name: Python package |
|
|
2 |
|
|
|
3 |
on: [push, pull_request] |
|
|
4 |
|
|
|
5 |
jobs: |
|
|
6 |
build: |
|
|
7 |
name: Build Job |
|
|
8 |
|
|
|
9 |
runs-on: ubuntu-latest |
|
|
10 |
strategy: |
|
|
11 |
max-parallel: 4 |
|
|
12 |
matrix: |
|
|
13 |
python-version: [3.7, 3.8] |
|
|
14 |
|
|
|
15 |
steps: |
|
|
16 |
- uses: actions/checkout@v2 |
|
|
17 |
- name: Set up Python ${{ matrix.python-version }} |
|
|
18 |
uses: actions/setup-python@v2 |
|
|
19 |
with: |
|
|
20 |
python-version: ${{ matrix.python-version }} |
|
|
21 |
- name: Install python package locally |
|
|
22 |
run: | |
|
|
23 |
python3 -m pip install --upgrade pip |
|
|
24 |
pip3 install --editable src |
|
|
25 |
- name: Lint with flake8 |
|
|
26 |
run: | |
|
|
27 |
pip3 install flake8 |
|
|
28 |
# stop the build if there are Python syntax errors or undefined names |
|
|
29 |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
|
|
30 |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
|
|
31 |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
|
|
32 |
- name: Test with pytest |
|
|
33 |
env: |
|
|
34 |
ARCH: "linux/amd64" |
|
|
35 |
TAG_SUFFIX: "amd64" |
|
|
36 |
run: | |
|
|
37 |
pip3 install pytest |
|
|
38 |
pwd |
|
|
39 |
ls -al |
|
|
40 |
echo GITHUB_WORKSPACE=${GITHUB_WORKSPACE} |
|
|
41 |
echo "ARCH=${ARCH}" |
|
|
42 |
${GITHUB_WORKSPACE}/install_requirements.sh |
|
|
43 |
${GITHUB_WORKSPACE}/tests/run-tests.sh |
|
|
44 |
|
|
|
45 |
|
|
|
46 |
release: |
|
|
47 |
name: Release Job |
|
|
48 |
needs: [build] |
|
|
49 |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' |
|
|
50 |
runs-on: ubuntu-latest |
|
|
51 |
steps: |
|
|
52 |
- uses: actions/checkout@v2 |
|
|
53 |
- name: Install Node.js 12 |
|
|
54 |
uses: actions/setup-node@v2 |
|
|
55 |
with: |
|
|
56 |
node-version: lts/* |
|
|
57 |
- name: Install Python 3 |
|
|
58 |
uses: actions/setup-python@v2 |
|
|
59 |
with: |
|
|
60 |
python-version: '3.x' |
|
|
61 |
- name: Run Semantic Release |
|
|
62 |
id: semrel |
|
|
63 |
uses: cycjimmy/semantic-release-action@v2 |
|
|
64 |
with: |
|
|
65 |
extra_plugins: | |
|
|
66 |
@semantic-release/changelog |
|
|
67 |
@semantic-release/git |
|
|
68 |
@semantic-release/exec |
|
|
69 |
branches: | |
|
|
70 |
[ |
|
|
71 |
'master', 'main' |
|
|
72 |
] |
|
|
73 |
env: |
|
|
74 |
GITHUB_TOKEN: ${{ secrets.GH_PAT }} |
|
|
75 |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
|
|
76 |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
|
|
77 |
- name: Semantic release completed |
|
|
78 |
run: echo Semantic release flow completed |