Test Python 3.9-3.13 on windows/mac/linux #933
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
lint: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repo | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
#---------------------------------------------- | |
# ----- install & configure poetry ----- | |
#---------------------------------------------- | |
- name: Install and configure Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.8.4 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Install dependencies | |
run: poetry install --no-interaction --no-root | |
#---------------------------------------------- | |
# install your root project | |
#---------------------------------------------- | |
- name: Install library | |
run: poetry install --no-interaction | |
- name: Run linters | |
run: | | |
make lint | |
tests: | |
# The type of runner that the job will run on | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# first list entry: lower bound, second list entry: upper bound | |
# of the supported python versions, versions in between are assumed | |
# to be supported as well without further testing | |
python-version: [3.9, 3.13] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: checkout repo | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.9 | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
#---------------------------------------------- | |
# ----- install & configure poetry ----- | |
#---------------------------------------------- | |
- name: Install and configure Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.8.4 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
#---------------------------------------------- | |
# load cached venv if cache exists | |
#---------------------------------------------- | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
#---------------------------------------------- | |
# install dependencies if cache does not exist | |
#---------------------------------------------- | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root | |
#---------------------------------------------- | |
# install your root project | |
#---------------------------------------------- | |
- name: Install library | |
run: poetry install --no-interaction | |
- name: Run all tests | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
make tests-parallel | |
- name: Run unit tests | |
if: matrix.os != 'ubuntu-latest' | |
run: | | |
make unit-tests | |
- name: Upload html coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-html-${{ runner.os }}-${{ matrix.python-version }} | |
path: htmlcov | |
include-hidden-files: true | |
if-no-files-found: error | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
# Do not upload/fail for PRs in forks | |
if: github.repository == 'michaelhly/solana-py' | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: ${{ runner.os }},${{ runner.arch }},${{ matrix.python-version }} | |
# Specify whether or not CI build should fail if Codecov runs into an error during upload | |
fail_ci_if_error: true | |
test: | |
# https://gh.neting.ccmunity/t/is-it-possible-to-require-all-github-actions-tasks-to-pass-without-enumerating-them/117957/4?u=graingert | |
runs-on: ubuntu-latest | |
needs: tests | |
steps: | |
- name: note that all tests succeeded | |
run: echo "🎉" |