Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github deployment workflow for PyPI #337

Merged
merged 6 commits into from
Jan 24, 2025
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
101 changes: 101 additions & 0 deletions .github/workflows/foxpuppet_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Publish to PyPI

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

env:
PYTHON_VERSION: '3.12'

jobs:
test-and-publish:
name: Publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 - --version 1.8.5
export PATH="$HOME/.local/bin:$PATH"

- name: Setup Firefox
id: setup-firefox
uses: ./.github/actions/setup_firefox/
with:
firefox-version: latest

- name: Verify Firefox Installation
run: |
echo Installed Firefox version:
firefox --version

- name: Build the Package
run: poetry build

- name: Install and Test the Wheel
run: |
python -m venv wheel-env
source wheel-env/bin/activate
pip install dist/*.whl
mkdir -p results
make test
deactivate

- name: Upload Wheel Test Artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: wheel-test-results
path: |
results/report.html
results/geckodriver.log
retention-days: 14

- name: Install and Test the Tarball
run: |
python -m venv tarball-env
source tarball-env/bin/activate
pip install dist/*.tar.gz
pip install pytest pytest-selenium pytest-cov pytest-html
mkdir -p results
make test
deactivate

- name: Upload Tarball Test Artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: tarball-test-results
path: |
results/report.html
results/geckodriver.log
retention-days: 14

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

create-release:
name: Create GitHub Release
needs: test-and-publish
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${GITHUB_REF_NAME}" dist/*.whl dist/*.tar.gz \
--title "Release ${GITHUB_REF_NAME}" \
--notes "Automated release of version ${GITHUB_REF_NAME}"
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
export MOZ_HEADLESS = 1
export GECKODRIVER_LOG = $(shell pwd)/results/geckodriver.log
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're exporting these we should capture them as an artifact, it could help with future debugging.


BLACK_CHECK = black -l 90 --check --diff .
BLACK_FIX = black -l 90 .
MINIMUM_COVERAGE = 95
Expand Down
Loading