Skip to content

Commit

Permalink
ci: separate smarteole_example workflow
Browse files Browse the repository at this point in the history
GitHub Action Workflow to execute Smarteole example notebook and pushes
a new commit on merge to main
  • Loading branch information
samuelwnaylor committed Nov 18, 2024
1 parent 3f6bfac commit 667fb1f
Show file tree
Hide file tree
Showing 5 changed files with 1,359 additions and 16 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/lint-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@ on:
push:
branches:
- main
paths-ignore:
- 'examples/smarteole_example.ipynb'
pull_request:
branches:
- main
paths-ignore:
- 'examples/smarteole_example.ipynb'
workflow_dispatch:


permissions:
contents: read


jobs:
lint-and-test:
runs-on: ${{ matrix.os }}
Expand All @@ -37,14 +44,14 @@ jobs:
run: |
python -m venv .venv
source .venv/bin/activate
pip install .[dev]
pip install .[all]
- name: 'update dependencies'
if: steps.cache-venv.outputs.cache-hit == 'true'
run: |
source .venv/bin/activate
pip install -U .[dev]
- name: "lint check & test"
pip install -U .[all]
- name: 'lint check & test'
run: |
source .venv/bin/activate
poe lint-check
poe test
poe test
71 changes: 71 additions & 0 deletions .github/workflows/smarteole_example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Execute Smarteole Example notebook

on:
push:
branches:
- main
paths-ignore:
- 'examples/smarteole_example.ipynb'
pull_request:
workflow_dispatch:


permissions:
contents: write

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
lint-and-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.x"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_NAME }}
- name: "set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
id: cache-venv
with:
path: ./.venv/
key: ${{ matrix.python-version }}-venv-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ matrix.python-version }}-venv
- name: 'add examples to pyproject.toml as a module so notebook imports work in CI'
run: |
sed -i 's!\["wind_up\*"\]!\["wind_up\*", "examples"\]!' pyproject.toml
- name: 'create environment and install dependencies'
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
python -m venv .venv
source .venv/bin/activate
pip install .[all]
- name: 'update dependencies'
if: steps.cache-venv.outputs.cache-hit == 'true'
run: |
source .venv/bin/activate
pip install -U .[all]
- name: 'lint check & test'
run: |
source .venv/bin/activate
poe lint-check
poe test
- name: 'execute smarteole example notebook and push changes'
run: |
source .venv/bin/activate
poe smarteole-nb
git add -A
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
if git status | grep -q modified; then
git commit -m "Update smarteole example notebook"
git push
fi
Loading

0 comments on commit 667fb1f

Please sign in to comment.