Skip to content

change context variables during runtime via SetVariableTask #579

change context variables during runtime via SetVariableTask

change context variables during runtime via SetVariableTask #579

Workflow file for this run

name: code quality
on:
pull_request:
branches:
- main
jobs:
linting:
runs-on: ubuntu-latest
env:
PYTHONPATH: .
steps:
- name: checkout
id: checkout
uses: actions/checkout@v3
- name: setup python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: '3.11'
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 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.8', '3.9', '3.10', '3.11']
runs-on: ['ubuntu-latest']
include:
- python-version: '3.11'
runs-on: windows-latest
env:
PYTHONPATH: .
steps:
- name: timezone
id: timezone
uses: szenius/[email protected]
with:
timezoneLinux: 'Europe/Stockholm'
timezoneWindows: 'W. Europe Standard Time'
- name: checkout
id: checkout
uses: actions/checkout@v3
- name: setup python
id: setup-python
uses: actions/setup-python@v4
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 (not windows)
if: runner.os != 'Windows'
id: coverage-not-windows
run: python -m coverage report --omit=**/*messagequeue*,**/mq/* --fail-under=90
- name: coverage (windows)
if: runner.os == 'Windows'
id: coverage-windows
run: python -m coverage report --omit=**/*messagequeue*,**/mq/* --fail-under=89
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@v3
with:
fetch-depth: 0
- name: setup python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: '3.11'
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
pre-documentation-scripts:
name: 'documentation / script inventory'
runs-on: 'ubuntu-latest'
steps:
- name: checkout
id: checkout
uses: actions/checkout@v3
- 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@v3
- name: setup python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: '3.11'
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@v3
- name: setup python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: setup node
id: setup-node
uses: actions/setup-node@v3
- 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