Skip to content

Commit 5b5e33e

Browse files
committed
test on all platforms
1 parent 2f1b5c6 commit 5b5e33e

File tree

3 files changed

+119
-28
lines changed

3 files changed

+119
-28
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Poetry Install
2+
description: Installs Python dependencies using Poetry
3+
4+
inputs:
5+
poetry-version:
6+
description: The version of Poetry to install
7+
type: string
8+
required: true
9+
python-version:
10+
description: The version of Python to use
11+
type: string
12+
required: true
13+
14+
defaults:
15+
run:
16+
shell: bash
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- name: Install Poetry
22+
shell: bash
23+
run: |
24+
pipx install poetry==${{ inputs.poetry-version}}
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ inputs.python-version }}
30+
cache: 'poetry'
31+
cache-dependency-path: poetry.lock
32+
33+
- name: Set Poetry environment
34+
shell: bash
35+
run: |
36+
poetry env use ${{ inputs.python-version }}
37+
38+
- name: Install project dependencies
39+
shell: bash
40+
run: |
41+
poetry install --no-interaction --no-root
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Reusable workflow consumed by ci.yml; used to share a single matrix across jobs.
2+
on:
3+
workflow_call:
4+
inputs:
5+
runner:
6+
required: true
7+
type: string
8+
python-version:
9+
required: true
10+
type: string
11+
poetry-version:
12+
required: true
13+
type: string
14+
15+
defaults:
16+
run:
17+
shell: bash
18+
19+
jobs:
20+
tests:
21+
name: Run tests (Python ${{ matrix.python-version }}), Poetry ${{ matrix.poetry-version }}, Platform ${{ matrix.runner }})
22+
runs-on: ${{ inputs.runner }}
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- uses: ./.github/actions/poetry-install
28+
with:
29+
python-version: ${{ inputs.python-version }}
30+
poetry-version: ${{ inputs.poetry-version }}
31+
32+
- name: Run unit tests
33+
run: |
34+
poetry run pytest spotify_sync/tests

.github/workflows/ci.yml

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,58 @@
11
name: CI
22
on:
33
push:
4-
branches: [main]
4+
branches:
5+
- main
56
pull_request:
7+
branches:
8+
- main
9+
10+
defaults:
11+
run:
12+
shell: bash
613

714
jobs:
8-
build-and-test:
9-
name: Build and test
15+
lint:
16+
name: Lint
1017
runs-on: ubuntu-latest
11-
strategy:
12-
matrix:
13-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.11']
14-
1518
steps:
1619
- name: Checkout code
1720
uses: actions/checkout@v4
1821

19-
- name: Install Poetry
20-
run: |
21-
pipx install poetry==1.8.4
22-
23-
- name: Set up Python
24-
uses: actions/setup-python@v5
22+
- uses: ./.github/actions/poetry-install
2523
with:
26-
python-version: ${{ matrix.python-version }}
27-
cache: 'poetry'
28-
cache-dependency-path: poetry.lock
29-
30-
- name: Set Poetry environment
31-
run: |
32-
poetry env use ${{ matrix.python-version }}
33-
34-
- name: Install project dependencies
35-
run: |
36-
poetry install --no-interaction --no-root
24+
python-version: '3.12'
25+
poetry-version: '1.8.4'
3726

3827
- name: Code Quality
39-
run: poetry run black . --check
40-
41-
- name: Unit Tests
42-
run: poetry run pytest spotify_sync/tests
28+
run: |
29+
poetry install black
30+
poetry run black . --check
31+
32+
unit-tests:
33+
name: "Unit tests (Python ${{ matrix.python-version }}, Poetry ${{ matrix.poetry-version }}, Platform ${{ matrix.os.name }})"
34+
uses: ./.github/workflows/_tests-matrix.yml
35+
needs: lint
36+
with:
37+
runner: ${{ matrix.os.image }}
38+
python-version: ${{ matrix.python-version }}
39+
poetry-version: '1.8.4'
40+
strategy:
41+
matrix:
42+
os:
43+
- name: Ubuntu
44+
image: ubuntu-22.04
45+
- name: macOS x86_64
46+
image: macos-13
47+
- name: Windows
48+
image: windows-2022
49+
- name: macOS aarch64
50+
image: macos-14
51+
python-version:
52+
- '3.8'
53+
- '3.9'
54+
- '3.10'
55+
- '3.11'
56+
- '3.11'
57+
- '3.12'
58+
fail-fast: false

0 commit comments

Comments
 (0)