-
Notifications
You must be signed in to change notification settings - Fork 59
91 lines (77 loc) · 2.53 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# This workflow will run the tests for the awpy Python library
name: build
on:
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.10", "3.11"] # Add 3.12 when pxr updates
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: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
poetry.lock
pyproject.toml
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Setup a local virtual environment for poetry
shell: bash
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v4
name: Cache awpy dependencies
with:
path: ./.venv
key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install awpy
shell: bash
run: |
poetry install --no-interaction
- name: Formatting + Lint
shell: bash
run: |
poetry run ruff check .
poetry run ruff format --check .
- name: Run pyright
run: poetry run pyright
- name: Thorough check with pylint
run: poetry run pylint awpy
- name: Test
shell: bash
run: |
poetry run coverage run -m pytest --durations=10
poetry run coverage report -m
# - name: Archive code coverage results
# uses: actions/upload-artifact@v4
# with:
# name: code-coverage-report-${{ github.run_id }}
# path: htmlcov/