|
6 | 6 | pull_request: |
7 | 7 | branches: [ main ] |
8 | 8 |
|
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
9 | 16 | jobs: |
10 | 17 | build: |
11 | | - |
12 | | - runs-on: ${{ matrix.os }} |
| 18 | + timeout-minutes: 30 |
13 | 19 | strategy: |
| 20 | + fail-fast: false |
14 | 21 | matrix: |
15 | 22 | os: [ubuntu-latest, windows-latest, macos-latest] |
16 | 23 | python-version: ['3.10', '3.11', '3.12', '3.13'] |
17 | | - defaults: |
18 | | - run: |
19 | | - shell: bash |
| 24 | + runs-on: ${{ matrix.os }} |
20 | 25 |
|
21 | 26 | 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