Skip to content

Commit 5ce6ac8

Browse files
sdenton4copybara-github
authored andcommitted
Add PyPI publishing workflow.
PiperOrigin-RevId: 707288205
1 parent ab53168 commit 5ce6ac8

File tree

5 files changed

+2396
-492
lines changed

5 files changed

+2396
-492
lines changed

.github/workflows/ci_poetry.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: ci_poetry
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
# Allows to run this workflow manually from the Actions tab on GitHub.
9+
workflow_dispatch:
10+
11+
jobs:
12+
test-ubuntu:
13+
name: "test on ${{ matrix.python-version }} on ${{ matrix.os }}"
14+
runs-on: "${{ matrix.os }}"
15+
strategy:
16+
matrix:
17+
python-version: ["3.10", "3.11"]
18+
os: [ubuntu-latest]
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Poetry
22+
run: pipx install poetry
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
cache: 'poetry'
28+
- name: Install Hoplite and its dependencies
29+
run: |
30+
sudo apt-get update
31+
sudo apt-get install libsndfile1 ffmpeg
32+
poetry install
33+
- name: Test db with unittest
34+
run: poetry run python -m unittest discover -s hoplite/db/tests -p "*test.py"
35+
- name: Test taxonomy with unittest
36+
run: poetry run python -m unittest discover -s hoplite/taxonomy -p "*test.py"
37+
- name: Test zoo with unittest
38+
run: poetry run python -m unittest discover -s hoplite/zoo -p "*test.py"
39+
- name: Test zoo tensorflow models with unittest
40+
run: poetry run python -m unittest discover -s hoplite/zoo/tests_tf -p "*test.py"
41+
- name: Test agile with unittest
42+
run: poetry run python -m unittest discover -s hoplite/agile/tests -p "*test.py"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: ci_poetry
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
# Allows to run this workflow manually from the Actions tab on GitHub.
9+
workflow_dispatch:
10+
11+
jobs:
12+
test-ubuntu:
13+
name: "test on ${{ matrix.python-version }} on ${{ matrix.os }}"
14+
runs-on: "${{ matrix.os }}"
15+
strategy:
16+
matrix:
17+
python-version: ["3.10", "3.11"]
18+
os: [ubuntu-latest]
19+
steps:
20+
- uses: actions/checkout@v3
21+
- name: Set up Poetry
22+
run: pipx install poetry
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
cache: 'poetry'
28+
- name: Install Hoplite and its dependencies
29+
run: |
30+
sudo apt-get update
31+
sudo apt-get install libsndfile1 ffmpeg
32+
poetry install --with jax
33+
- name: Test db with unittest
34+
run: poetry run python -m unittest discover -s hoplite/db/tests -p "*test.py"
35+
- name: Test taxonomy with unittest
36+
run: poetry run python -m unittest discover -s hoplite/taxonomy -p "*test.py"
37+
- name: Test zoo with unittest
38+
run: poetry run python -m unittest discover -s hoplite/zoo -p "*test.py"
39+
- name: Test zoo tensorflow models with unittest
40+
run: poetry run python -m unittest discover -s hoplite/zoo/tests_tf -p "*test.py"
41+
- name: Test agile with unittest
42+
run: poetry run python -m unittest discover -s hoplite/agile/tests -p "*test.py"

.github/workflows/publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Upload Hoplite Python Package to PyPI when a release is Created
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
pypi-publish:
9+
name: Publish Hoplite release to PyPI
10+
runs-on: ubuntu-latest
11+
environment:
12+
name: pypi
13+
url: https://pypi.org/p/perch-hoplite
14+
permissions:
15+
id-token: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Poetry
19+
run: pipx install poetry
20+
- name: Set up Python
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: "3.11"
24+
cache: 'poetry'
25+
- name: Install Hoplite and its dependencies
26+
run: |
27+
sudo apt-get update
28+
sudo apt-get install libsndfile1 ffmpeg
29+
poetry install
30+
- name: Build package
31+
run: |
32+
poetry build
33+
- name: Publish package distributions to PyPI
34+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)