Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
Hatch, doc updates and adapting to new aoe2.net api (endpoints removals)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsoubelet authored Jul 29, 2024
2 parents 91298aa + aa540be commit 4eb2d19
Show file tree
Hide file tree
Showing 31 changed files with 1,334 additions and 3,168 deletions.
85 changes: 18 additions & 67 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,79 +13,30 @@ on: # Runs on all push events to master branch and any push related to a pull r

jobs:
coverage:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix: # only lowest supported python on ubuntu-latest
os: [ubuntu-latest]
python-version: [3.7]
runs-on: ubuntu-latest
env:
python-version: 3.12

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ env.python-version }}
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'

- name: Get full Python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Install poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.1.4

- name: Configure Poetry
run: |
echo "PATH=$HOME/.poetry/bin:$PATH" >> $GITHUB_ENV
poetry config virtualenvs.in-project true
- name: Set up cache
uses: actions/cache@v2
id: cache
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: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv

- name: Upgrade pip, setuptools and wheel
run: poetry run python -m pip install --upgrade pip setuptools wheel

- name: Install dependencies
run: poetry install -v -E dataframe

- name: Set up env for CodeClimate (push)
run: |
echo "GIT_BRANCH=$GITHUB_REF" >> $GITHUB_ENV
echo "GIT_COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV
if: github.event_name == 'push'

- name: Set up env for CodeClimate (pull_request)
env:
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
echo "GIT_BRANCH=$GITHUB_HEAD_REF" >> $GITHUB_ENV
echo "GIT_COMMIT_SHA=$PR_HEAD_SHA" >> $GITHUB_ENV
if: github.event_name == 'pull_request'

- name: Prepare CodeClimate binary
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
curl -LSs 'https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64' >./cc-test-reporter;
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: Install package with test dependencies
run: python -m pip install ".[test]"

- name: Run all tests
run: poetry run python -m pytest
run: python -m pytest

- name: Push Coverage to CodeClimate
if: ${{ success() }} # only if tests were successful
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: ./cc-test-reporter after-build
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
46 changes: 12 additions & 34 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,47 +15,25 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9] # crons should always run latest python hence 3.x
os: [ubuntu-22.04, ubuntu-24.04, macos-latest, windows-latest]
python-version: ["3.10", 3.11, 3.12, 3.x] # crons should always run latest python hence 3.x
fail-fast: false

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'

- name: Get full Python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Set up cache
uses: actions/cache@v2
id: cache
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: pip --version >/dev/null 2>&1 || rm -rf .venv

- name: Install poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.1.4

- name: Configure Poetry
run: |
echo "PATH=$HOME/.poetry/bin:$PATH" >> $GITHUB_ENV
poetry config virtualenvs.in-project true
- name: Upgrade pip, setuptools and wheel
run: poetry run python -m pip install --upgrade pip setuptools wheel

- name: Install dependencies
run: poetry install -v -E dataframe
- name: Install package with test dependencies
run: python -m pip install ".[test]"

- name: Run Tests
run: poetry run python -m pytest
run: python -m pytest
72 changes: 28 additions & 44 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,59 +12,43 @@ on: # Runs on any push event to master

jobs:
documentation:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix: # only lowest supported python on ubuntu-latest
os: [ubuntu-latest]
python-version: [3.7]
runs-on: ubuntu-latest
env:
python-version: 3.12

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ env.python-version }}
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'

- name: Get full Python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Install poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.1.4
- name: Install package with doc dependencies
run: python -m pip install ".[docs]"

- name: Configure Poetry
run: |
echo "PATH=$HOME/.poetry/bin:$PATH" >> $GITHUB_ENV
poetry config virtualenvs.in-project true
- name: Build documentation
run: portray as_html -o doc_build

- name: Set up cache
uses: actions/cache@v2
id: cache
# Upload artifacts if in PR so reviewers can have a quick look without building documentation from the branch locally
- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: success() && github.event_name == 'pull_request' # only for pushes in PR
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: pip --version >/dev/null 2>&1 || rm -rf .venv

- name: Upgrade pip, setuptools and wheel
run: poetry run python -m pip install --upgrade pip setuptools wheel

- name: Install dependencies
run: poetry install -v -E docs -E dataframe

- name: Build documentation
run: poetry run portray as_html -o doc_build
name: site-build
path: doc_build
retention-days: 5

# Upload the doc to github pages branch and publish if from a push to master
- name: Upload documentation to gh-pages
if: ${{ success() }}
uses: JamesIves/github-pages-deploy-action@3.7.1
if: success() && github.ref == 'refs/heads/master' # only for pushes to master
uses: JamesIves/github-pages-deploy-action@v4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: doc_build
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: doc_build
60 changes: 13 additions & 47 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,22 @@ on: # Runs everytime a release is added to the repository

jobs:
deploy:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix: # only lowest supported python on ubuntu-latest
os: [ubuntu-latest]
python-version: [3.7]

runs-on: ubuntu-latest
env:
python-version: 3.12

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Get full Python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")

- name: Install poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.1.4
- uses: actions/checkout@v4

- name: Configure Poetry
run: |
echo "PATH=$HOME/.poetry/bin:$PATH" >> $GITHUB_ENV
poetry config virtualenvs.in-project true
- name: Set up cache
uses: actions/cache@v2
id: cache
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: pip --version >/dev/null 2>&1 || rm -rf .venv

- name: Upgrade pip, setuptools and wheel
run: poetry run python -m pip install --upgrade pip setuptools wheel
- name: Install hatch
run: pipx install hatch

- name: Build wheels and sdist
run: poetry build
run: hatch build

- name: Publish package to PyPI
if: ${{ success() }}
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: poetry publish -u "$PYPI_USERNAME" -p "$PYPI_PASSWORD"
- name: Publish Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
print-hash: true
password: ${{ secrets.PYPI_API_TOKEN }}
57 changes: 20 additions & 37 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,41 @@
name: Tests
# Runs all tests
name: All Tests

defaults:
run:
shell: bash

on: [push]
on: # Runs on any push event to any branch except master (the coverage workflow takes care of that)
push:
branches-ignore:
- 'master'


jobs:
tests:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9]
os: [ubuntu-22.04, ubuntu-24.04, macos-latest, windows-latest]
python-version: ["3.10", 3.11, 3.12]
fail-fast: false

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'

- name: Get full Python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")

- name: Install poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.1.4

- name: Configure Poetry
run: |
echo "PATH=$HOME/.poetry/bin:$PATH" >> $GITHUB_ENV
poetry config virtualenvs.in-project true
- name: Set up cache
uses: actions/cache@v2
id: cache
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: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv

- name: Upgrade pip, setuptools and wheel
run: poetry run python -m pip install --upgrade pip setuptools wheel
- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Install dependencies
run: poetry install -v -E dataframe
- name: Install package with test dependencies
run: python -m pip install ".[test]"

- name: Run Tests
run: poetry run python -m pytest
- name: Run all tests
run: python -m pytest
Loading

0 comments on commit 4eb2d19

Please sign in to comment.