Skip to content

Test query truthiness #316

Test query truthiness

Test query truthiness #316

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Package
on:
push:
branches:
- "*"
tags:
- "*.*.*"
pull_request:
types: [opened, reopened]
defaults:
run:
shell: bash
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Ruff
run: pip install ruff
- name: Ruff Check
run: ruff check . --output-format=github
- name: Ruff Format
run: ruff format . --check
mypy:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Setup Python ${{ matrix.python-version }}
with:
python-version: ${{ matrix.python-version }}
- name: Install package
run: pip install -e ".[test]"
- name: Mypy
uses: liskin/gh-problem-matcher-wrap@v3
with:
linters: mypy
run: mypy --show-column-numbers --python-version ${{ matrix.python-version }}
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Setup Python ${{ matrix.python-version }}
with:
python-version: ${{ matrix.python-version }}
- name: Install package
run: pip install -e ".[test]"
- name: Run tests
run: pytest --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
build-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install build
run: pip install build
- name: Build package
run: python -m build
- uses: actions/upload-artifact@v4
with:
name: python-dist
path: dist/*
if-no-files-found: error
retention-days: 1
compression-level: 0
deploy:
needs: [build-dist]
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/tcod-ecs/${{ github.ref_name }}/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: python-dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
release:
if: github.ref_type == 'tag'
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate body
run: scripts/get_release_description.py | tee release_body.md
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
bodyFile: release_body.md