Skip to content

Commit

Permalink
build(wrappers/python): add python build scripts for GH Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
SKalt committed Aug 24, 2024
1 parent ecdb22c commit d329dd0
Show file tree
Hide file tree
Showing 19 changed files with 195 additions and 357 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,67 @@ jobs:
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

publish-pypi-packages:
name: Publish PyPi packages
runs-on: ubuntu-latest # ok since none of the scripts depend on version-specific features
defaults:
run:
shell: bash
needs: publish-github-release
steps:
- name: Clone
uses: actions/checkout@v4
- name: Download CLI binaries
uses: actions/download-artifact@v4
with:
pattern: release-*
merge-multiple: true
path: ./wrappers/python/vendor
- name: Set up python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up poetry
run: bash ./wrappers/python/scripts/ci/github/setup_poetry.sh
- name: cache venv
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-poetry-3.12-${{ hashFiles('**/poetry.lock') }}
- name: Install dev dependencies
run: bash ./wrappers/python/scripts/ci/github/install_dev_dependencies.sh
working-directory: ./wrappers/python
- name: debug
run: |
set -x
echo "$PATH" | tr ':' '\n'
command -v python
command -v python3
command -v poetry || echo "missing poetry"
stat .venv/bin/python
.venv/bin/python --version
- name: package binaries
working-directory: ./wrappers/python
run: |
export PATH="$PWD/.venv/bin:$PATH"
python3 -m scripts.build.all ./vendor # should take ~30s
- name: package python api
run: |
export PATH="$PWD/.venv/bin:$PATH"
python3 -m scripts.build.api_package
- name: Archive dist
uses: actions/upload-artifact@v4
with:
path: dist
name: python-packages
if-no-files-found: error
# TODO: once we have a TEST_PYPI_TOKEN, test publishing the packages.
# - name: Publish python packages
# working-directory: ./wrappers/python
# run: |
# export PATH="$PWD/.venv/bin:$PATH"
# ./scripts/publish_to_test_pypi.sh

publish-npm-package:
name: Publish NPM packages
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -145,6 +206,7 @@ jobs:
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}


publish-binary-npm-packages:
name: Publish NPM binaries
runs-on: ubuntu-20.04
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,41 @@ jobs:

- name: Test CLI
run: ./test_ci.sh "release"

- name: Set up python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
# NOTE: ^this strategy leaves older python versions intentionally
# without test coverage to keep CI fast.

- name: Set up poetry
run: ./wrappers/python/scripts/ci/github/setup_poetry.sh

- name: cache venv
uses: actions/cache@v4
with:
path: wrappers/python/.venv
key: ${{ runner.os }}-poetry-3.12-${{ hashFiles('**/poetry.lock') }}

- name: Install dev dependencies
run: ./wrappers/python/scripts/ci/github/install_dev_dependencies.sh

- name: debug python paths
run: ./wrappers/python/scripts/ci/github/debug_python_paths.sh

- name: Lint python
working-directory: ./wrappers/python
run: |
export VIRTUAL_ENV="$PWD/.venv"
export PATH="$VIRTUAL_ENV/bin:$PATH"
bash ./scripts/ci/python_lints.sh
- name: ensure cog up-to-date
working-directory: ./wrappers/python
run: ./scripts/ci/github/cog/check.sh

- name: Test python API
timeout-minutes: 1
run: ./wrappers/python/scripts/ci/github/integration_tests.sh

2 changes: 1 addition & 1 deletion wrappers/python/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `pagefind_python`
# `pagefind`
An async python API for the [pagefind](https://pagefind.app) binary.

## Installation
Expand Down
239 changes: 0 additions & 239 deletions wrappers/python/build_binary_only_wheel.py

This file was deleted.

Loading

0 comments on commit d329dd0

Please sign in to comment.