Skip to content

Commit

Permalink
Add PyPI publishing workflow.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 707120818
  • Loading branch information
sdenton4 authored and copybara-github committed Dec 17, 2024
1 parent ab53168 commit 9da5ecf
Show file tree
Hide file tree
Showing 5 changed files with 2,396 additions and 492 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/ci_poetry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: ci_poetry

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:

jobs:
test-ubuntu:
name: "test on ${{ matrix.python-version }} on ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"
strategy:
matrix:
python-version: ["3.10", "3.11"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Poetry
run: pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install Hoplite and its dependencies
run: |
sudo apt-get update
sudo apt-get install libsndfile1 ffmpeg
poetry install
- name: Test db with unittest
run: poetry run python -m unittest discover -s hoplite/db/tests -p "*test.py"
- name: Test taxonomy with unittest
run: poetry run python -m unittest discover -s hoplite/taxonomy -p "*test.py"
- name: Test zoo with unittest
run: poetry run python -m unittest discover -s hoplite/zoo -p "*test.py"
- name: Test zoo tensorflow models with unittest
run: poetry run python -m unittest discover -s hoplite/zoo/tests_tf -p "*test.py"
- name: Test agile with unittest
run: poetry run python -m unittest discover -s hoplite/agile/tests -p "*test.py"
42 changes: 42 additions & 0 deletions .github/workflows/ci_poetry_with_jax.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: ci_poetry

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:

jobs:
test-ubuntu:
name: "test on ${{ matrix.python-version }} on ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"
strategy:
matrix:
python-version: ["3.10", "3.11"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Poetry
run: pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install Hoplite and its dependencies
run: |
sudo apt-get update
sudo apt-get install libsndfile1 ffmpeg
poetry install --with jax
- name: Test db with unittest
run: poetry run python -m unittest discover -s hoplite/db/tests -p "*test.py"
- name: Test taxonomy with unittest
run: poetry run python -m unittest discover -s hoplite/taxonomy -p "*test.py"
- name: Test zoo with unittest
run: poetry run python -m unittest discover -s hoplite/zoo -p "*test.py"
- name: Test zoo tensorflow models with unittest
run: poetry run python -m unittest discover -s hoplite/zoo/tests_tf -p "*test.py"
- name: Test agile with unittest
run: poetry run python -m unittest discover -s hoplite/agile/tests -p "*test.py"
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Upload Hoplite Python Package to PyPI when a release is Created

on:
release:
types: [created]

jobs:
pypi-publish:
name: Publish Hoplite release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/perch-hoplite
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'poetry'
- name: Install Hoplite and its dependencies
run: |
sudo apt-get update
sudo apt-get install libsndfile1 ffmpeg
poetry install
- name: Build package
run: |
poetry build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Loading

0 comments on commit 9da5ecf

Please sign in to comment.