Skip to content

Commit

Permalink
test on all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
b4ird committed Oct 31, 2024
1 parent 2f1b5c6 commit 5b5e33e
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 28 deletions.
41 changes: 41 additions & 0 deletions .github/actions/poetry-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Poetry Install
description: Installs Python dependencies using Poetry

inputs:
poetry-version:
description: The version of Poetry to install
type: string
required: true
python-version:
description: The version of Python to use
type: string
required: true

defaults:
run:
shell: bash

runs:
using: composite
steps:
- name: Install Poetry
shell: bash
run: |
pipx install poetry==${{ inputs.poetry-version}}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: 'poetry'
cache-dependency-path: poetry.lock

- name: Set Poetry environment
shell: bash
run: |
poetry env use ${{ inputs.python-version }}
- name: Install project dependencies
shell: bash
run: |
poetry install --no-interaction --no-root
34 changes: 34 additions & 0 deletions .github/workflows/_tests-matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Reusable workflow consumed by ci.yml; used to share a single matrix across jobs.
on:
workflow_call:
inputs:
runner:
required: true
type: string
python-version:
required: true
type: string
poetry-version:
required: true
type: string

defaults:
run:
shell: bash

jobs:
tests:
name: Run tests (Python ${{ matrix.python-version }}), Poetry ${{ matrix.poetry-version }}, Platform ${{ matrix.runner }})
runs-on: ${{ inputs.runner }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: ./.github/actions/poetry-install
with:
python-version: ${{ inputs.python-version }}
poetry-version: ${{ inputs.poetry-version }}

- name: Run unit tests
run: |
poetry run pytest spotify_sync/tests
72 changes: 44 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,58 @@
name: CI
on:
push:
branches: [main]
branches:
- main
pull_request:
branches:
- main

defaults:
run:
shell: bash

jobs:
build-and-test:
name: Build and test
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.11']

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

- name: Install Poetry
run: |
pipx install poetry==1.8.4
- name: Set up Python
uses: actions/setup-python@v5
- uses: ./.github/actions/poetry-install
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
cache-dependency-path: poetry.lock

- name: Set Poetry environment
run: |
poetry env use ${{ matrix.python-version }}
- name: Install project dependencies
run: |
poetry install --no-interaction --no-root
python-version: '3.12'
poetry-version: '1.8.4'

- name: Code Quality
run: poetry run black . --check

- name: Unit Tests
run: poetry run pytest spotify_sync/tests
run: |
poetry install black
poetry run black . --check
unit-tests:
name: "Unit tests (Python ${{ matrix.python-version }}, Poetry ${{ matrix.poetry-version }}, Platform ${{ matrix.os.name }})"
uses: ./.github/workflows/_tests-matrix.yml
needs: lint
with:
runner: ${{ matrix.os.image }}
python-version: ${{ matrix.python-version }}
poetry-version: '1.8.4'
strategy:
matrix:
os:
- name: Ubuntu
image: ubuntu-22.04
- name: macOS x86_64
image: macos-13
- name: Windows
image: windows-2022
- name: macOS aarch64
image: macos-14
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.11'
- '3.12'
fail-fast: false

0 comments on commit 5b5e33e

Please # to comment.