Skip to content

Commit

Permalink
Awpy 2 (#301)
Browse files Browse the repository at this point in the history
AWPY TWO
  • Loading branch information
pnxenopoulos authored Jun 3, 2024
1 parent f0bbee8 commit 9b42803
Show file tree
Hide file tree
Showing 247 changed files with 4,410 additions and 129,734 deletions.
97 changes: 51 additions & 46 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ name: build
on:
push:
branches: [main, dev]
paths:
- "awpy/**"
- "tests/**"
- "pyproject.toml"
pull_request:
branches: [main]
paths:
- "awpy/**"
- "tests/**"
- "pyproject.toml"

jobs:
build:
Expand All @@ -15,75 +23,72 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11"] #, "3.12-dev"]
go-version: ["1.18", "1.19", "1.20"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
timeout-minutes: 15
steps:
- name: Checkout awpy library
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Cache test demos
id: cache-demos
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-demos
with:
# demos are downloaded to
# and looked for in `{repo}/tests`
# 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.
# 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!
# then this could cause issues. So do not do that!
restore-keys: cache-test-demos-

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: awpy/parser/go.sum

- name: Set up Python
uses: actions/setup-python@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
requirements.txt
tests/requirements.txt
poetry.lock
pyproject.toml
- name: Installation
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Setup a local virtual environment for poetry
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r tests/requirements.txt
- name: Check formatting with black
uses: psf/black@stable
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- name: Lint with ruff
uses: chartboost/ruff-action@v1
- uses: actions/cache@v4
name: Cache awpy dependencies
with:
version: 0.0.291
path: ./.venv
key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}

- name: Typecheck with pyright
uses: jakebailey/pyright-action@v1
with:
version: 1.1.329
- name: Install awpy
run: |
poetry install --no-interaction
- name: Thorough check with pylint
run: pylint awpy
- name: Formatting + Lint
run: |
poetry run ruff check . --fix --exit-zero
poetry run ruff check .
# - name: Run pyright
# run: poetry run pyright

- name: Test with pytest
# - name: Thorough check with pylint
# run: poetry run pylint awpy

- name: Test
run: |
coverage run -m pytest --durations=10
coverage report -m
coverage json
coverage html
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@v3
with:
name: code-coverage-report
path: htmlcov/
# - name: Archive code coverage results
# uses: actions/upload-artifact@v4
# with:
# name: code-coverage-report-${{ github.run_id }}
# path: htmlcov/
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/setup-python@v4
- uses: actions/checkout@master
- uses: actions/setup-python@v5
- uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Build and Commit
Expand Down
43 changes: 0 additions & 43 deletions .github/workflows/go_code.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and Publish to PyPI

on:
push:
tags:
- 'release-v*.*.*'

jobs:
build-and-release:
runs-on: ubuntu-latest
environment:
name: test-release-pypi
permissions:
id-token: write

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"

- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Setup a local virtual environment for poetry
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
poetry config repositories.testpypi https://test.pypi.org/legacy/
- name: Install awpy
run: |
poetry install --no-interaction
- name: Publish to test PyPI
run: |
poetry publish --repository testpypi --username __token__ --password ${{ secrets.TEST_PYPI_API_TOKEN }}
- name: Check that installation from test PyPI passes
run: |
poetry add awpy --source testpypi
- name: Publish to PyPI
run: |
poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
- name: Check that installation from PyPI passes
run: |
poetry add awpy
111 changes: 0 additions & 111 deletions .golangci.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,3 @@ repos:
"-rn", # Only display messages
"-sn", # Don't display the score
]
- repo: https://github.com/golangci/golangci-lint
rev: v1.54.2
hooks:
- id: golangci-lint
entry: bash -c 'cd awpy/parser && golangci-lint run --new-from-rev HEAD --fix'
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
os: ubuntu-22.04
tools:
python: "3.11"
# You can also specify other tool versions:
Expand Down
Loading

0 comments on commit 9b42803

Please sign in to comment.