Skip to content

Update codeql-analysis.yml to not run on schedule just on all pushes #270

Update codeql-analysis.yml to not run on schedule just on all pushes

Update codeql-analysis.yml to not run on schedule just on all pushes #270

Workflow file for this run

name: Python Test and Lint
on: [push, pull_request]
jobs:
test_and_lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8"]
steps:
- name: Checkout git repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install Pango
run: sudo apt-get install libsdl-pango-dev
- name: Install poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Set up cache
uses: actions/cache@v3
id: cache # name for referring later
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: |
# `timeout` is not available on macOS, so we define a custom function.
[ "$(command -v timeout)" ] || function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; }
# Using `timeout` is a safeguard against the Poetry command hanging for some reason.
timeout 10s poetry run pip --version || rm -rf .venv
- name: Install dependencies using poetry
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Add .scr folder to PythonPath
run: |
echo "PYTHONPATH=./src/" >> $GITHUB_ENV
- name: Lint with pylint
run: |
poetry run python -m pylint $(git ls-files '*.py' -x 'test_*.py')
- name: Test with pytest
run: |
poetry run python -m pytest -q tests/