Merge pull request #103 from victorskl/fix-gha-trufflehog-setting #148
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: Pull Request Build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# Actions Used: | |
# https://github.com/actions/checkout | |
# https://github.com/actions/setup-python | |
# https://github.com/marketplace/actions/codecov | |
# https://github.com/marketplace/actions/code-climate-coverage-action | |
# https://docs.codeclimate.com/docs/github-actions-test-coverage | |
# https://github.com/marketplace/actions/trufflehog-oss | |
jobs: | |
build: | |
# Default access (restricted) - https://docs.github.com/en/actions/security-guides/automatic-token-authentication | |
permissions: | |
contents: read | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ '3.9', '3.10', '3.11', '3.12' ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: TruffleHog OSS | |
uses: trufflesecurity/[email protected] | |
with: | |
extra_args: --only-verified | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get install xclip xvfb | |
python -m pip install --upgrade pip | |
pip install '.[test]' . | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with pytest | |
run: | | |
xvfb-run pytest --cov-report xml --cov=yawsso tests/ | |
- name: Publish coverage to to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
name: yawsso | |
- name: Publish coverage to CodeClimate | |
uses: paambaati/[email protected] | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
with: | |
coverageLocations: | | |
${{ github.workspace }}/coverage.xml:coverage.py | |
- name: Publish coverage to Coveralls | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
run: coveralls |