Skip to content

Commit

Permalink
Add linting checks in github actions; adapt README.rst with additiona…
Browse files Browse the repository at this point in the history
…l configuration information for pipelines; remove --instafail flag for pytest
  • Loading branch information
zhiwei2017 committed Sep 7, 2021
1 parent abdfb73 commit 04e5ead
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 32 deletions.
63 changes: 35 additions & 28 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,34 +169,34 @@ You can find all the configuration files of GitHub Actions in ``.github/workflow
Content
:::::::

+-------------+-------------------------------+--------------------------------------------------+------------------------------------------------------------------------+
| Config File | Steps | Trigger Rules | Requisite CI/CD Variables |
+=============+===============================+==================================================+========================================================================+
| | mypy check | | |
| +-------------------------------+ | |
| | flake8 check | + **Pushes** to *master/develop* branches | |
| +-------------------------------+ | |
| test.yml | bandit check | + **Pull Requests** to *master/develop* branches | |
| +-------------------------------+ | |
| | test with python 3.6 | | |
| +-------------------------------+ | |
| | test with python 3.7 | | |
| +-------------------------------+ | |
| | test with python 3.8 | | |
+-------------+-------------------------------+--------------------------------------------------+------------------------------------------------------------------------+
| build.yml | twine check the built package | **Pull Requests** to *master/develop* branches | |
+-------------+-------------------------------+--------------------------------------------------+------------------------------------------------------------------------+
| | | | TWINE_USERNAME |
| | | +------------------------------------------------------------------------+
| release.yml | deploy to PyPi | **Pushes** to tags matching *vXX.XX.XX* | TWINE_PASSWORD |
| | | +------------------------------------------------------------------------+
| | | | TWINE_REPOSITORY_URL |
| | | | |
| | | | * https://test.pypi.org/legacy/ for uploading to test version PyPi |
| | | | * https://upload.pypi.org/legacy/ for uploading to test version PyPi |
+-------------+-------------------------------+--------------------------------------------------+------------------------------------------------------------------------+
| sphinx.yml | deploy GitHub pages | **Pushes** to *master* branch | |
+-------------+-------------------------------+--------------------------------------------------+------------------------------------------------------------------------+
+-------------+----------------------------------------------+--------------------------------------------------+------------------------------------------------------------------------+
| Config File | Steps | Trigger Rules | Requisite CI/CD Variables |
+=============+==============================================+==================================================+========================================================================+
| | mypy check | | |
| +----------------------------------------------+ | |
| | flake8 check | + **Pushes** to *master/develop* branches | |
| +----------------------------------------------+ | |
| main.yml | bandit check | + **Pull Requests** to *master/develop* branches | |
| +----------------------------------------------+ | |
| | test with python 3.6 (Ubuntu/Mac OS/Windows) | | |
| +----------------------------------------------+ | |
| | test with python 3.7 (Ubuntu/Mac OS/Windows) | | |
| +----------------------------------------------+ | |
| | test with python 3.8 (Ubuntu/Mac OS/Windows) | | |
+-------------+----------------------------------------------+--------------------------------------------------+------------------------------------------------------------------------+
| build.yml | twine check the built package | **Pull Requests** to *master/develop* branches | |
+-------------+----------------------------------------------+--------------------------------------------------+------------------------------------------------------------------------+
| | | | TWINE_USERNAME |
| | | +------------------------------------------------------------------------+
| release.yml | deploy to PyPi | **Pushes** to tags matching *vXX.XX.XX* | TWINE_PASSWORD |
| | | +------------------------------------------------------------------------+
| | | | TWINE_REPOSITORY_URL |
| | | | |
| | | | * https://test.pypi.org/legacy/ for uploading to test version PyPi |
| | | | * https://upload.pypi.org/legacy/ for uploading to test version PyPi |
+-------------+----------------------------------------------+--------------------------------------------------+------------------------------------------------------------------------+
| sphinx.yml | deploy GitHub pages | **Pushes** to *master* branch | |
+-------------+----------------------------------------------+--------------------------------------------------+------------------------------------------------------------------------+

**Note**:

Expand Down Expand Up @@ -258,6 +258,11 @@ Setup Steps
4. Click **Add variable** button.
5. Input the name and value of a CI/CD variable.

By default, the flag **protected** is checked, which means the added variable can only be used for protected branches/tags.
If you want to keep your variable protected, please add wildcards **v*** as protected tags in **Settings** -> **Repository** -> **Protected tags**.

Or you can uncheck the box to use the variable for all branches and tags.

Bitbucket Pipelines
~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -301,6 +306,8 @@ Setup Steps
3. Click **add** button.
4. Input the name and value of a CI/CD variable.

You need to enable pipelines before adding a new variable for the first time.

Acknowledgements
----------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,25 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
# This workflow contains two jobs "linting" and "test"
linting:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Run flake8 check
run: make flake8
- name: Run mypy check
run: make mypy
- name: Run bandit check
run: make bandit
test:
needs: linting
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
Expand All @@ -35,13 +52,11 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/dev.txt
pip install -e .
- name: Test with pytest
run: |
pytest
2 changes: 2 additions & 0 deletions {{cookiecutter.project_slug}}/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ build:
- echo "Uploading the package to nexus via twine..."
- twine check dist/*.whl
only:
- master
- develop
- merge_requests
############# END BUILD STAGE ##############

Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ flake8:
test:
python -m pip install -r requirements/dev.txt
python -m pip install -e .
pytest --instafail
pytest

# build wheel package
build_whl:
Expand Down

0 comments on commit 04e5ead

Please sign in to comment.