-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (78 loc) · 2.81 KB
/
build.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
# This workflow will install Python dependencies, run tests, lint, build the package and push to pypi (for tagged versions).
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: build
on:
push:
branches:
- '**'
tags:
- 'v**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: 3
- name: Set up Node 16
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install python3-venv, firefox and doctoc
run: |
sudo apt-get install python3-venv firefox
npm install -g doctoc
- name: Install poetry
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.2.0
- name: Poetry install
run: |
poetry install
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Generate README.md and update TOC
run: |
poetry run jupyter nbconvert README.ipynb --no-input --to markdown
doctoc --github --title "## Table of contents" README.md
- name: Commit README.md to git
continue-on-error: true
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
# Stage the file, commit and push
git add README.md
git commit -m "update README.md"
git push origin ${{ steps.extract_branch.outputs.branch }}
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Check style with black
run: |
poetry run black . --check
- name: Install latest gecko driver
run: |
pip install git+https://github.com/zaironjacobs/get-gecko-driver@main#egg=get_gecko_driver
get-gecko-driver --download-latest --extract
- name: Test with pytest
env:
KITCHENER_UTILITIES_USER: ${{ secrets.KITCHENER_UTILITIES_USER }}
KITCHENER_UTILITIES_PASSWORD: ${{ secrets.KITCHENER_UTILITIES_PASSWORD }}
run: |
poetry run pytest --cov
- name: Publish to PyPi
if: startsWith(github.ref, 'refs/tags/v')
env:
USERNAME: ${{ secrets.PYPI_USERNAME }}
PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install poetry-dynamic-versioning
poetry-dynamic-versioning
poetry publish --build -u $USERNAME -p $PASSWORD