Skip to content

Commit

Permalink
ci(py): split lint and test jobs across platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
pplmx committed Sep 30, 2024
1 parent e216c8c commit 836c72f
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions template/py/{{cookiecutter.project_slug}}/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,45 @@ on:
pull_request:
workflow_dispatch:

{% raw %}
jobs:
build-and-test:
name: python-${{ matrix.os }}
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up UV Environment
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Format Code
run: uvx ruff format --diff .

- name: Lint Code
run: uvx ruff check .

build-and-test:
runs-on: {{ "${{ matrix.os }}" }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest

os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up uv
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Set up UV Environment
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Set up uv
if: ${{ matrix.os == 'windows-latest' }}
run: irm https://astral.sh/uv/install.ps1 | iex
shell: powershell
- name: Synchronize Dependencies
run: uv sync

- name: Format
run: uvx ruff format --diff .

- name: Lint
run: uvx ruff check .
- name: Build Project
run: uvx hatch build

- name: Build & Test
run: |
uv sync
uvx hatch build
uvx hatch test
{% endraw -%}
- name: Run Tests
run: uvx hatch test

0 comments on commit 836c72f

Please sign in to comment.