Skip to content

Awpy 2

Awpy 2 #891

Workflow file for this run

# This workflow will run the tests for the awpy Python library
name: build
on:
push:
branches: [main, dev]
paths:
- "awpy/**"
- "tests/**"
- "pyproject.toml"
pull_request:
branches: [main]
paths:
- "awpy/**"
- "tests/**"
- "pyproject.toml"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
timeout-minutes: 15
steps:
- name: Checkout awpy library
uses: actions/checkout@v4
- name: Cache test demos
id: cache-demos
uses: actions/cache@v4
env:
cache-name: cache-demos
with:
# demos are downloaded to and looked for in `{repo}/tests`
path: ${{ github.workspace }}/tests/*.dem
# Invalidate the cache if the file containing the demo urls has changed.
key: cache-test-demos-${{ hashFiles('**/test_data.json') }}
# Care with this: If a demo changes but the name remains the same
# then this could cause issues. So do not do that!
restore-keys: cache-test-demos-
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
poetry.lock
pyproject.toml
# Install Poetry
- uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
# # Cache your dependencies (i.e. all the stuff in your `pyproject.toml`). Note the cache
# # key: if you're using multiple Python versions, or multiple OSes, you'd need to include
# # them in the cache key. I'm not, so it can be simple and just depend on the poetry.lock.
# - name: cache deps
# id: cache-deps
# uses: actions/cache@v2
# with:
# path: .venv
# key: pydeps-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
# restore-keys: |
# pydeps-${{ runner.os }}-${{ matrix.python-version }}-
# pydeps-${{ runner.os }}-
- name: Install awpy
run: |
poetry install --no-interaction
- name: Check formatting and lint with ruff
run: |
poetry run ruff check . --fix --exit-zero
poetry run ruff check .
# - name: Run pyright
# run: poetry run pyright
- name: Thorough check with pylint
run: poetry run pylint awpy
- name: Test with pytest
run: |
poetry run coverage run -m pytest --durations=10
poetry run coverage report -m
poetry run coverage json
poetry run coverage html
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: htmlcov/