Skip to content

Commit

Permalink
Add python install and test to main actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sgreenbury committed Mar 5, 2024
1 parent 593684b commit 6ea94d2
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
58 changes: 57 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Rust build and Python install/test
on: [push]
jobs:
build:
Expand Down Expand Up @@ -35,3 +35,59 @@ jobs:

- name: Build
run: cargo check

python:
name: Install and test SPC toolkit for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, macos]
include:
- build: linux
os: ubuntu-latest
- build: macos
os: macos-latest

defaults:
run:
working-directory: ./python

steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.10"

- name: Bootstrap poetry
shell: bash
run: |
python -m ensurepip
python -m pip install --upgrade pip
python -m pip install poetry
- name: Configure poetry
shell: bash
run: |
python -m poetry config virtualenvs.in-project true
- name: Set up cache
uses: actions/cache@v2
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
shell: bash
run: |
python -m poetry install --extras "dev examples"
- name: Run tests
shell: bash
run: |
poetry run pytest
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
files: ^python/
files: "^python/|.github"
exclude: synthpop_pb2.py$
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down

0 comments on commit 6ea94d2

Please sign in to comment.