rewrite of testdata communication, and other improvements #725
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: code quality | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
linting: | |
runs-on: ubuntu-latest | |
env: | |
PYTHONPATH: . | |
steps: | |
- name: checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
- name: setup python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
- name: install python dependencies | |
id: pip | |
run: python -m pip install -e .[dev,docs] | |
- name: run ruff | |
id: ruff | |
run: python -m ruff check grizzly/ grizzly_extras/ tests/ example/ | |
- name: run mypy | |
id: mypy | |
run: python -m mypy grizzly/ grizzly_extras/ tests/ example/ | |
- name: gevent poison check | |
id: gevent-poison | |
run: | | |
find grizzly_extras/ -type f -name '*.py' -exec grep -nHE '^\s?(import|from) grizzly\.' {} \; | |
find grizzly_extras/ -type f -name '*.py' -exec grep -nHE '^\s*(import|from) grizzly\.' {} \; | awk '/(import|from) grizzly\./ {exit 1}' | |
test-and-coverage: | |
name: "test-and-coverage / ${{ matrix.runs-on }} / python-${{ matrix.python-version }}" | |
runs-on: ${{ matrix.runs-on }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.9', '3.10', '3.11', '3.12'] | |
runs-on: ['ubuntu-latest'] | |
include: | |
- python-version: '3.12' | |
runs-on: windows-latest | |
env: | |
PYTHONPATH: . | |
steps: | |
- name: timezone | |
id: timezone | |
uses: MathRobin/[email protected] | |
with: | |
timezoneLinux: 'Europe/Stockholm' | |
timezoneWindows: 'W. Europe Standard Time' | |
- name: checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
- name: setup python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: install python dependencies | |
id: pip | |
run: python -m pip install -e .[dev,docs] | |
- name: pytest | |
id: pytest | |
run: python -m pytest --ignore=tests/e2e | |
- name: coverage | |
id: coverage | |
run: | | |
python -m coverage report -i --omit=**/*messagequeue*,**/mq/*,**/__version__.py --fail-under=89 || python -m coverage debug data | |
test-e2e: | |
name: 'e2e tests ${{ matrix.run_mode }}' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
run_mode: ['local', 'dist'] | |
env: | |
E2E_RUN_MODE: "${{ matrix.run_mode }}" | |
steps: | |
- name: checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: setup python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
- name: setup environment | |
id: setup-environment | |
run: | | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
echo PYTHONPATH=$PWD >> $GITHUB_ENV | |
- name: install python dependencies | |
id: pip | |
run: python -m pip install -e .[dev] | |
- name: install docker-compose | |
id: install-docker-compose | |
if: matrix.run_mode == 'dist' | |
uses: KengoTODA/actions-setup-docker-compose@main | |
with: | |
version: '2.20.3' | |
- name: ssh agent | |
id: ssh-agent | |
run: | | |
ssh-agent -a /tmp/ssh_auth_sock | |
- name: 'pytest (e2e ${{ matrix.run_mode }})' | |
id: pytest-e2e | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_auth_sock | |
run: python -m pytest tests/e2e | |
- name: 'grizzly logs' | |
id: grizzly-logs | |
if: failure() | |
continue-on-error: true | |
run: cat /tmp/grizzly.log | |
pre-documentation-scripts: | |
name: 'documentation / script inventory' | |
runs-on: 'ubuntu-latest' | |
steps: | |
- name: checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
- name: create script matrix | |
id: create-script-matrix | |
run: | | |
echo "matrix=$(ls -1 script/docs-* | awk 'BEGIN {printf "["} {printf "\""$0"\", "} END {print "]"}' | sed -r 's|", \]$|"\]|')" >> $GITHUB_OUTPUT | |
- name: validate script matrix | |
run: | | |
echo '${{ steps.create-script-matrix.outputs.matrix }}' | |
outputs: | |
matrix: ${{ steps.create-script-matrix.outputs.matrix }} | |
documentation-scripts: | |
name: "documentation / ${{ matrix.script }}" | |
runs-on: 'ubuntu-latest' | |
needs: pre-documentation-scripts | |
strategy: | |
fail-fast: false | |
matrix: | |
script: ${{ fromJson(needs.pre-documentation-scripts.outputs.matrix) }} | |
steps: | |
- name: checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
- name: setup python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
- name: install python dependencies | |
id: pip | |
run: python -m pip install -e .[docs] | |
- name: exists | |
run: test -e ${{ matrix.script }} | |
- name: executable | |
run: test -x ${{ matrix.script }} | |
- name: runnable | |
run: ./${{ matrix.script }} | |
documentation-build: | |
name: "documentation / build" | |
runs-on: 'ubuntu-latest' | |
needs: documentation-scripts | |
steps: | |
- name: checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
- name: setup python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
- name: setup node | |
id: setup-node | |
uses: actions/setup-node@v4 | |
- name: install python dependencies | |
id: pip | |
run: python -m pip install -e .[docs] | |
- name: build | |
working-directory: ./docs/ | |
run: | | |
git checkout -b v0.0.0 | |
novella --site-dir "$PWD/_build" --base-url grizzly/ 2>&1 | awk '/WARNING/ && !/Image file.*referenced in.*not found/ {print $0; exit 1} /ERROR/ {print $0; exit 1} {print $0}' | |
- name: check for unresolved pydoc-markdown tags | |
working-directory: ./docs/_build | |
run: find . -type f -name '*.html' | xargs -- grep -nHE '\{\@.*\}' | awk 'BEGIN{rc=0} !/^$/ {rc=1; print} END{exit rc}' | |
- name: check for @TODO annotations | |
working-directory: ./docs/_build | |
run: find . -type f -name '*.html' | xargs -- grep -nHE '@TODO' | awk 'BEGIN{rc=0} !/^$/ {rc=1; print} END{exit rc}' | |
- name: check for unclosed code blocks | |
working-directory: ./docs/_build | |
run: for file in $(find . -type f -name '*.md'); do awk 'BEGIN{count=0} /```/ {count+=1} END{if (count % 2 != 0) { print FILENAME ", contains uneven number of code-block markers"; exit 1;}}' $file || break; done | |
- name: check code block format | |
working-directory: ./docs/_build | |
run: for file in $(find . -type f -name '*.md'); do awk 'BEGIN{count=0} /``` / {print FILENAME " " $0; count+=1} END{if (count > 0) { print FILENAME ", there should not be a space between code-block and language specification"; exit 1;}}' $file || break; done | |
release-quality: | |
name: releasable | |
runs-on: 'ubuntu-latest' | |
if: always() | |
needs: | |
- linting | |
- test-and-coverage | |
- test-e2e | |
- documentation-build | |
steps: | |
- uses: technote-space/workflow-conclusion-action@v3 | |
- run: | | |
[[ "${{ env.WORKFLOW_CONCLUSION }}" == "success" ]] || exit 1 |