Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# Automatically update versions for pip
# Keeps dependencies up to date

version: 2
updates:

# Maintain dependencies for Python
- package-ecosystem: "pip"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "weekly"
day: "friday"
time: "00:00"

# Maintain dependencies for Github Actions
- package-ecosystem: "github-actions"
directory: "/"
Expand Down
77 changes: 35 additions & 42 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,38 @@
name: Docs

on: [push, pull_request]

jobs:
pre_job:
name: Path match check
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
github_token: ${{ github.token }}
paths: '["docs/**", "requirements/docs.txt"]'
docs:
name: Checking docs build
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: 3.9
- name: pip cache
uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-docs-${{ hashFiles('requirements/docs.txt') }}
restore-keys: |
${{ runner.os }}-pip-docs
- name: Install system dependencies
run: |
sudo apt-get -y -qq update
sudo apt-get install -y swig openssl libssl-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/docs.txt
pip install -e .
- name: Check Docs build
run: make docs
pre_job:
name: Path match check
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
github_token: ${{ github.token }}
paths: '["docs/**", "pyproject.toml"]'
docs:
name: Checking docs build
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install system dependencies
run: |
sudo apt-get -y -qq update
sudo apt-get install -y swig openssl libssl-dev
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: 3.9
activate-environment: "true"
enable-cache: "true"
- name: Install dependencies
run: uv sync --extra docs
- name: Check Docs build
run: make docs
37 changes: 34 additions & 3 deletions .github/workflows/check_migrations_sqlite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,34 @@ jobs:
uses: fkirc/skip-duplicate-actions@master
with:
github_token: ${{ github.token }}
paths: '["morango/migrations/*.py", ".github/workflows/check_migrations_sqlite.yml", "setup.py", "requirements/*.txt"]'
paths: '["morango/migrations/*.py", ".github/workflows/check_migrations_sqlite.yml", "pyproject.toml"]'
build:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just want to see if i'm understanding this well from the reviewer guidance. so this part is new because it gives us more similarity (and.... therefore increased confidence?) to the build process for morango releases?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is the result of the complexity in that with older versions of python, we can't simply use pip install . for Morango having the more modern pyproject.toml. It needs more modern build tools that don't support older versions of python.

Morango's build and publish always uses python 3.9, so this mimics that to create a wheel file which CAN be installed later (line 88):

pip install $(ls dist/*.whl | head -n 1)[test]
  • $(ls dist/*.whl | head -n 1) this is just a subshell to use globbing since pip wants a full file name
  • [test] this tells pip to install the test extras defined in the pyproject.toml

So the result is that this is indeed more realistic tests by testing the wheel that we'd publish (built on 3.9) instead of building a wheel within each python version being tested.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting - this might make doing a parallel version in Kolibri slightly more challenging, because there we build the whl file in Python 3.6 to bundle the dependencies (I am sure we'll find a work around, but this is good extra context).

name: Build wheel
needs: pre_job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install uv
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: astral-sh/setup-uv@v7
with:
python-version: 3.9
enable-cache: "true"
- name: Build wheel
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
run: uv build --wheel
- name: Upload wheel artifact
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: actions/upload-artifact@v4
with:
name: wheel
path: dist/*.whl
retention-days: 1
migration_test:
name: SQLite migration tests
needs: pre_job
needs: [pre_job, build]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a concern in morango - but once concern I've had in Kolibri is that our workflows are overly granular.

I've experimented with having more top level "CI" in some repos recently - so that our CI checks become more of a cascade (make sure it builds first, then test kind of thing).

With no good way in Github Actions to group workflows better, I am tempted to do more of this - but morango doesn't have enough for this to be a concern!

runs-on: ubuntu-latest
container:
image: python:3.7-buster
Expand All @@ -32,6 +56,13 @@ jobs:
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
with:
lfs: true
fetch-depth: 0
- name: Download wheel artifact
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: actions/download-artifact@v4
with:
name: wheel
path: dist/
- name: Build SQLite 3.25.3
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
run: |
Expand All @@ -54,7 +85,7 @@ jobs:
${{ runner.os }}-pip-
- name: Install dependencies
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
run: pip install .
run: pip install $(ls dist/*.whl | head -n 1)[test]
- name: Run migrations
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
run: python tests/testapp/manage.py migrate
42 changes: 17 additions & 25 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will upload a Python Package using uv when a release is created
# uv provides fast, modern Python package building and publishing

name: Upload Python Package

on:
release:
types: [published]

jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: 3.9
activate-environment: "true"
enable-cache: "true"
- name: Build package
run: uv build
- name: Publish package
env:
UV_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: uv publish
Loading
Loading