Skip to content

Commit 9e5f718

Browse files
committed
Fix basic workflow
1 parent 97b6a46 commit 9e5f718

File tree

1 file changed

+46
-37
lines changed

1 file changed

+46
-37
lines changed

.github/workflows/test.yml

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,57 @@ on:
66
pull_request:
77
branches: [ main ]
88

9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
916
jobs:
1017
build:
11-
12-
runs-on: ${{ matrix.os }}
18+
timeout-minutes: 30
1319
strategy:
20+
fail-fast: false
1421
matrix:
1522
os: [ubuntu-latest, windows-latest, macos-latest]
1623
python-version: ['3.10', '3.11', '3.12', '3.13']
17-
defaults:
18-
run:
19-
shell: bash
24+
runs-on: ${{ matrix.os }}
2025

2126
steps:
22-
- uses: actions/checkout@v3
23-
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v3
25-
with:
26-
python-version: ${{ matrix.python-version }}
27-
- name: Get full Python version
28-
id: full-python-version
29-
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
30-
- name: Install poetry
31-
run: |
32-
curl -sL https://install.python-poetry.org | python - -y
33-
- name: Update path
34-
if: ${{ matrix.os != 'windows-latest' }}
35-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
36-
- name: Update Windows path
37-
if: ${{ matrix.os == 'windows-latest' }}
38-
run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH
39-
- name: Configure poetry
40-
run: poetry config virtualenvs.in-project true
41-
- name: Set up cache
42-
uses: actions/cache@v3
43-
id: cache
44-
with:
45-
path: .venv
46-
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
47-
- name: Ensure cache is healthy
48-
if: steps.cache.outputs.cache-hit == 'true'
49-
run: timeout 10s poetry run pip --version || rm -rf .venv
50-
- name: Install dependencies
51-
run: poetry install
52-
- name: Run tests
53-
run: poetry run pytest
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Python ${{ matrix.python-version }}
31+
id: setup-python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
cache: 'poetry'
36+
37+
# Install Poetry via pipx
38+
- name: Install Poetry
39+
run: |
40+
python -m pip install --upgrade pip
41+
python -m pip install --upgrade pipx
42+
pipx ensurepath
43+
pipx install "poetry>=1.8"
44+
shell: bash
45+
46+
# Ensure pipx bin dir is on PATH for this job
47+
- name: Add pipx to PATH
48+
if: runner.os != 'Windows'
49+
run: echo "$HOME/.local/bin" >> "$GITHUB_PATH"
50+
- name: Add pipx to PATH (Windows)
51+
if: runner.os == 'Windows'
52+
run: echo "$Env:USERPROFILE\.local\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
53+
shell: powershell
54+
55+
- name: Configure Poetry
56+
run: poetry config virtualenvs.in-project true
57+
58+
- name: Install dependencies
59+
run: poetry install --no-interaction --no-ansi
60+
61+
- name: Run tests
62+
run: poetry run pytest -q

0 commit comments

Comments
 (0)