1+
12name : Build and Push Docs
23
34on :
910 - master
1011
1112jobs :
12- # TODO [#2]: refactor docs workflow once Github Actions improves
13- #
14- # Entire jobs are getting copied between workflow files due to limitations in Github Actions
15- #
16- # Possible changes to Github Actions that would allow the docs workflow to be refactored:
17- # - reuse jobs
18- # - reuse steps
19- # - trigger workflow from within action/workflow
2013 test :
2114 runs-on : ubuntu-latest
2215 strategy :
@@ -25,38 +18,11 @@ jobs:
2518 python-version : [3.8]
2619
2720 steps :
28- - uses : actions/checkout@v1
29- - name : Set up Python ${{ matrix.python-version }}
30- uses : actions/setup-python@v1
21+ - uses : actions/checkout@v3
22+ - uses : ./.github/actions/install-dependencies
3123 with :
3224 python-version : ${{ matrix.python-version }}
33- - name : Install Pipenv
34- uses : dschep/install-pipenv-action@v1
35- - name : Install dependencies
36- run : |
37- pipenv sync
38- - name : Lint with flake8
39- run : |
40- pip install flake8
41- # stop the build if there are Python syntax errors or undefined names
42- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
43- # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
44- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
45- - name : Test with pytest
46- run : |
47- pipenv run python -m pytest --cov=./ --cov-report=xml
48- - name : Upload coverage to Codecov
49- if : github.ref == 'refs/heads/master'
50- uses : codecov/codecov-action@v1
51- with :
52- token : ${{ secrets.CODECOV_TOKEN }}
53- file : ./coverage.xml
54- flags : unittests
55- name : codecov-pytest
56- yml : ./codecov.yml
57- - name : Static Typing Checks with mypy
58- run : |
59- pipenv run mypy $(python directory.py)
25+ - uses : ./.github/actions/lint-and-test
6026
6127 deploy :
6228 needs : test
@@ -68,32 +34,27 @@ jobs:
6834 python-version : [3.8]
6935
7036 steps :
71- - uses : actions/checkout@v1
72- - name : Set up Python ${{ matrix.python-version }}
73- uses : actions/setup-python@v1
37+ - uses : actions/checkout@v3
38+ - uses : ./.github/actions/install-dependencies
7439 with :
7540 python-version : ${{ matrix.python-version }}
76- - name : Install Pipenv
77- uses : dschep/install-pipenv-action@v1
78- - name : Install dependencies
79- run : |
80- pipenv sync
81- sudo apt-get install pandoc -y
82- # Need to set Git committer to run terminal examples in docs
83- - name : Set Git Committer
84- run : |
85- git config --global user.email "flexlate-git@nickderobertis.com"
86- git config --global user.name "flexlate-git"
87- git config --global init.defaultBranch main
88- - name : Build Documentation
89- run : |
90- cd docsrc
91- pipenv run make github
92- cd ..
93- echo "" > docs/.nojekyll
94- - name : Deploy Documentation
95- uses : peaceiris/actions-gh-pages@v2.5.0
96- env :
97- GITHUB_TOKEN : ${{ secrets.gh_token }}
98- PUBLISH_BRANCH : gh-pages
99- PUBLISH_DIR : ./docs
41+ - uses : ./.github/actions/build-and-deploy-docs
42+ with :
43+ gh-token : ${{ secrets.GH_TOKEN }}
44+
45+ coverage :
46+ needs : deploy
47+ runs-on : ubuntu-latest
48+ strategy :
49+ max-parallel : 1
50+ matrix :
51+ python-version : [3.8]
52+ steps :
53+ - uses : actions/checkout@v3
54+ - uses : ./.github/actions/install-dependencies
55+ with :
56+ python-version : ${{ matrix.python-version }}
57+ - name : Run coverage and upload to Codecov.io
58+ uses : ./.github/actions/test-coverage
59+ with :
60+ codecov-token : ${{ secrets.CODECOV_TOKEN }}
0 commit comments