Skip to content

Instantly share code, notes, and snippets.

@apr-1985
Created November 1, 2022 15:57
Show Gist options
  • Save apr-1985/ed2aa076d2c9502848582c3af4872416 to your computer and use it in GitHub Desktop.
Save apr-1985/ed2aa076d2c9502848582c3af4872416 to your computer and use it in GitHub Desktop.
Test-Results-on-Actions-Summary-Page-example
name: Python Testing
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests responses flake8 pytest boto3
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
echo "# Flake8" >> $GITHUB_STEP_SUMMARY
# stop the build if there are Python syntax errors or undefined names
echo "## Build Stopping Errors" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
echo "## Build Warnings" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
- name: Test with pytest
run: |
echo "" >> $GITHUB_STEP_SUMMARY
echo "# Pytest" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
pytest >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment