From 10e35fa6f1d0fa4c0fb6927eb10d170e2f40c4cb Mon Sep 17 00:00:00 2001 From: David Perl Date: Thu, 2 Jul 2026 13:03:47 +0200 Subject: [PATCH] ci: move setup to action and add format ci step --- .gitea/actions/install/action.yml | 29 ++++++++++++++++++++++++ .gitea/workflows/ci.yml | 37 ++++++++++++++----------------- 2 files changed, 46 insertions(+), 20 deletions(-) create mode 100644 .gitea/actions/install/action.yml diff --git a/.gitea/actions/install/action.yml b/.gitea/actions/install/action.yml new file mode 100644 index 0000000..ddd1f94 --- /dev/null +++ b/.gitea/actions/install/action.yml @@ -0,0 +1,29 @@ +name: "Install" +description: "Setup system and python environment and install repo" +inputs: + python_version: + required: false + default: "3.12" + description: "Python version to use" + +runs: + using: "composite" + steps: + - name: Install Libraries + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y libgl1 libegl1 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python_version }} + + - name: Install repo + shell: bash + run: | + pip install uv + uv venv + source .venv/bin/activate + uv pip install -e .[test] diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index bd1019d..1aeac78 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -7,41 +7,38 @@ on: jobs: lint: runs-on: ubuntu-latest + steps: - - name: Setup Python - uses: actions/setup-python@v5 + - name: Checkout code + uses: actions/checkout@v5 + + - name: Setup + uses: ./.gitea/actions/install with: - python-version: "3.12" + python_version: "3.12" + + - name: Format + run: | + source .venv/bin/activate + ruff format --check test: runs-on: ubuntu-latest + needs: "lint" strategy: matrix: python-version: ["3.11", "3.12", "3.13"] steps: - - name: Install Libraries - run: | - sudo apt-get update - sudo apt-get install -y libgl1 libegl1 - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Checkout code uses: actions/checkout@v5 - - name: Install - run: | - pip install uv - uv venv - source .venv/bin/activate - uv pip install -e .[test] + - name: Setup + uses: ./.gitea/actions/install + with: + python_version: ${{ matrix.python_version }} - name: Run Pytest with Coverage - id: coverage run: | source .venv/bin/activate pytest --random-order --cov=./ --cov-config=./pyproject.toml --cov-branch --cov-report=xml --no-cov-on-fail ./tests/