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
31 changes: 12 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ on:
type: string

jobs:
build-and-validate:
build:
runs-on: ubuntu-latest
environment:
name: test
permissions:
contents: write
steps:
Expand All @@ -38,23 +36,18 @@ jobs:
source .venv/bin/activate
npm run dist
shell: bash
- name: Validate distribution
env:
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
CLERK_DOMAIN: ${{ secrets.CLERK_DOMAIN }}
CLERK_PUBLISHABLE_KEY: ${{ secrets.CLERK_PUBLISHABLE_KEY }}
CLERK_TEST_USER: ${{ secrets.CLERK_TEST_USER }}
CLERK_TEST_PASSWORD: ${{ secrets.CLERK_TEST_PASSWORD }}
run: |
uv venv test-dist
source test-dist/bin/activate
WHL_FILE=$(ls dist/*.whl)
uv pip install "${WHL_FILE}"
uv pip install -r dev-requirements.txt
pytest --headless
shell: bash
- name: Upload Python distributions
uses: actions/upload-artifact@v4
with:
name: python-distributions
path: dist/
path: dist/

validate:
needs: build
permissions:
contents: read
uses: ./.github/workflows/test-runner.yml
with:
python-version: ${{ inputs.python-version }}
test-distribution: true
secrets: inherit
55 changes: 18 additions & 37 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,57 +12,38 @@ on:
branches: [main]

jobs:
test:
test-python-310:
uses: ./.github/workflows/test-runner.yml
with:
python-version: "3.10"
secrets: inherit

test-python-312:
uses: ./.github/workflows/test-runner.yml
with:
python-version: "3.12"
secrets: inherit

lint:
runs-on: ubuntu-latest

environment:
name: test
strategy:
matrix:
python-version: ["3.10", "3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: 'Setup Chrome and chromedriver'
uses: nanasess/setup-chromedriver@v2
- name: 'Setup chromedriver environment'
run: |
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
- name: Start XVFB
run: Xvfb :99 &
python-version: "3.10"

- name: Setup uv
- name: Setup uv and dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv

- name: Install dependencies
run: |
npm ci
source .venv/bin/activate
uv pip install --upgrade pip
uv pip install wheel
uv pip install -r dev-requirements.txt
npm ci

- name: Lint
run: |
source .venv/bin/activate
npm run lint

- name: Run tests
env:
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
CLERK_DOMAIN: ${{ secrets.CLERK_DOMAIN }}
CLERK_PUBLISHABLE_KEY: ${{ secrets.CLERK_PUBLISHABLE_KEY }}
CLERK_TEST_USER: ${{ secrets.CLERK_TEST_USER }}
CLERK_TEST_PASSWORD: ${{ secrets.CLERK_TEST_PASSWORD }}
run: |
source .venv/bin/activate
pytest --headless
86 changes: 86 additions & 0 deletions .github/workflows/test-runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Test Runner

on:
workflow_call:
inputs:
python-version:
required: true
type: string
test-distribution:
required: false
type: boolean
default: false
distribution-artifact:
required: false
type: string
default: 'python-distributions'

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
environment:
name: test
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- name: 'Setup Chrome and chromedriver'
uses: nanasess/setup-chromedriver@v2

- name: 'Setup chromedriver environment'
run: |
export DISPLAY=:99
chromedriver --url-base=/wd/hub &

- name: Start XVFB
run: Xvfb :99 &

- name: Setup uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv

- name: Download distribution (if testing built package)
if: ${{ inputs.test-distribution }}
uses: actions/download-artifact@v4
with:
name: ${{ inputs.distribution-artifact }}
path: dist/

- name: Install dependencies from source
if: ${{ !inputs.test-distribution }}
run: |
source .venv/bin/activate
uv pip install --upgrade pip
uv pip install wheel
uv pip install -r dev-requirements.txt

- name: Install dependencies from distribution
if: ${{ inputs.test-distribution }}
run: |
source .venv/bin/activate
WHL_FILE=$(find dist -name '*.whl' -type f | head -1)
if [ -z "$WHL_FILE" ]; then
echo "Error: No wheel file found in dist/"
exit 1
fi
uv pip install "${WHL_FILE}"
uv pip install -r dev-requirements.txt

- name: Run tests
env:
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
CLERK_DOMAIN: ${{ secrets.CLERK_DOMAIN }}
CLERK_PUBLISHABLE_KEY: ${{ secrets.CLERK_PUBLISHABLE_KEY }}
CLERK_TEST_USER: ${{ secrets.CLERK_TEST_USER }}
CLERK_TEST_PASSWORD: ${{ secrets.CLERK_TEST_PASSWORD }}
run: |
source .venv/bin/activate
pytest --headless