HSPC-179: Fix tests for hs-test-python #160
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
- release | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: Lint with ruff | |
runs-on: arc-runners-small | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Get Python version | |
id: python_version | |
run: echo "python_version=$(head -n 1 .python-version)" >> $GITHUB_OUTPUT | |
shell: bash | |
- uses: ./.github/workflows/actions/prepare | |
with: | |
python-version: ${{ steps.python_version.outputs.python_version }} | |
- name: Check files using the ruff formatter | |
run: | | |
poetry run ruff check --fix --unsafe-fixes --preview . | |
shell: bash | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
fetch: false | |
default_author: github_actions | |
message: 'Backend: Auto format' | |
add: '.' | |
mypy: | |
name: Static Type Checking | |
needs: lint | |
runs-on: arc-runners-small | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Python version | |
id: python_version | |
run: echo "python_version=$(head -n 1 .python-version)" >> $GITHUB_OUTPUT | |
shell: bash | |
- uses: ./.github/workflows/actions/prepare | |
with: | |
python-version: ${{ steps.python_version.outputs.python_version }} | |
- name: Mypy | |
run: poetry run mypy . | |
shell: bash | |
test: | |
name: Run unit test on ${{ matrix.os }} with Python ${{ matrix.python-version }} | |
needs: lint | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ "ubuntu-latest", "windows-latest", "macos-14" ] | |
python-version: [ "3.10", "3.11", "3.12" ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/workflows/actions/prepare | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Set environment variables for Windows | |
- name: Configure Windows environment | |
if: runner.os == 'Windows' | |
run: | | |
echo "PYTHONIOENCODING=utf-8" >> $GITHUB_ENV | |
echo "PYTHONUTF8=1" >> $GITHUB_ENV | |
echo "PYTHONLEGACYWINDOWSSTDIO=0" >> $GITHUB_ENV | |
shell: bash | |
- name: Run Tests | |
run: poetry run python tests/testing.py | |
shell: bash | |
env: | |
PYTHONIOENCODING: utf-8 | |
PYTHONUTF8: 1 | |
PYTHONLEGACYWINDOWSSTDIO: 0 |