Add bandit to pre-commit (#94) #672
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: govcookiecutter build | |
on: [ push, pull_request ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
python: [ 3.8, 3.9, '3.10', 3.11 ] | |
steps: | |
- name: Checkout the revision | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install dependencies | |
run: | | |
if [[ "$RUNNER_OS" == "Linux" || "$RUNNER_OS" == "macOS" || "$RUNNER_OS" == "Windows" ]]; then | |
make requirements | |
else | |
echo "$RUNNER_OS not supported" | |
exit 1 | |
fi; | |
shell: bash | |
- name: Run pre-commit hooks | |
run: pre-commit run --all-files | |
- name: Create documentation | |
run: | | |
if [[ "$RUNNER_OS" == "Linux" || "$RUNNER_OS" == "macOS" ]]; then | |
sphinx-build -W -b html ./docs ./docs/_build | |
elif [ "$RUNNER_OS" == "Windows" ]; then | |
# TODO: Investigate why Sphinx build raises a warning on Windows but not Unix | |
sphinx-build -b html ./docs ./docs/_build | |
else | |
echo "$RUNNER_OS not supported" | |
exit 1 | |
fi; | |
shell: bash | |
- name: Execute tests, and create coverage report | |
run: | | |
if [[ "$RUNNER_OS" == "Linux" || "$RUNNER_OS" == "macOS" ]]; then | |
make coverage_xml | |
elif [ "$RUNNER_OS" == "Windows" ]; then | |
coverage run -m pytest | |
coverage xml | |
else | |
echo "$RUNNER_OS not supported" | |
exit 1 | |
fi; | |
shell: bash | |
- name: Upload coverage report to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.xml | |
env_vars: OS=${{ matrix.os }},PYTHON=${{ matrix.python }} |