diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..2a9f11c9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: Python package +on: + push: {} + schedule: + - cron: "0 0 * * 1-5" +jobs: + test: + name: "Test Python ${{ matrix.python-version }}" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: "Install hatch" + run: "pip install hatch" + - name: "Run tests" + run: "hatch -v run test.py$(echo ${{ matrix.python-version }} | tr -d '.'):pytest" + + lint-style: + name: "Style linter" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.12 + - name: "Install hatch" + run: "pip install hatch" + - name: "Run style linter" + run: "hatch -v run lint:style" + + lint-typing: + name: "Typing linter" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.12 + - name: "Install hatch" + run: "pip install hatch" + - name: "Run typing linter" + run: "hatch -v run lint:typing" + + lint-git: + name: "Git linter (Lintje)" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch depth is required + - uses: lintje/action@v0.11 diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml deleted file mode 100644 index 999aaaf3..00000000 --- a/.semaphore/semaphore.yml +++ /dev/null @@ -1,65 +0,0 @@ -version: v1.0 -name: AppSignal for Python -auto_cancel: - running: - when: branch != 'main' AND branch != 'develop' -agent: - machine: - type: e1-standard-2 - os_image: ubuntu2004 -global_job_config: - prologue: - commands: - - checkout -blocks: -- name: Linters - dependencies: [] - task: - jobs: - - name: Style - commands: - - "sem-version python 3.11" - - "pip install hatch" - - "hatch -v run lint:style" - - name: Typing - commands: - - "sem-version python 3.11" - - "pip install hatch" - - "hatch -v run lint:typing" - - name: Git Lint (Lintje) - commands: - - script/lint_git -- name: Tests - dependencies: [] - task: - jobs: - - name: Diagnose tests - env_vars: - - name: LANGUAGE - value: python - commands: - - "sem-version python 3.11" - - "pip install hatch" - - git submodule init - - git submodule update - - ./tests/diagnose/bin/test - - name: Python 3.8 - commands: - - "sem-version python 3.8" - - "pip install hatch" - - "hatch -v run test.py38:pytest" - - name: Python 3.9 - commands: - - "sem-version python 3.9" - - "pip install hatch" - - "hatch -v run test.py39:pytest" - - name: Python 3.10 - commands: - - "sem-version python 3.10" - - "pip install hatch" - - "hatch -v run test.py310:pytest" - - name: Python 3.11 - commands: - - "sem-version python 3.11" - - "pip install hatch" - - "hatch -v run test.py311:pytest" diff --git a/pyproject.toml b/pyproject.toml index 72b93bde..887b3bc6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", # Application version @@ -72,7 +73,7 @@ dependencies = [ ] [[tool.hatch.envs.test.matrix]] -python = ["38", "39", "310", "311"] +python = ["38", "39", "310", "311", "312"] [tool.hatch.envs.lint] detached = true diff --git a/script/lint_git b/script/lint_git deleted file mode 100755 index 11cf375b..00000000 --- a/script/lint_git +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -set -eu - -LINTJE_VERSION="0.11.3" - -mkdir -p "$HOME/bin" -cache_key=v1-lintje-$LINTJE_VERSION -cache restore $cache_key - -# File exists and is executable -if [ -x "$HOME/bin/lintje" ]; then - echo "Restored Lintje $LINTJE_VERSION from cache" -else - echo "Downloading Lintje $LINTJE_VERSION" - curl -L \ - https://github.com/lintje/lintje/releases/download/v$LINTJE_VERSION/x86_64-unknown-linux-gnu.tar.gz | \ - tar -xz --directory "$HOME/bin" - cache store $cache_key "$HOME/bin/lintje" -fi - -"$HOME/bin/lintje" "$SEMAPHORE_GIT_COMMIT_RANGE"