Skip to content

Commit

Permalink
Merge pull request #4 from geneontology/issue-2-cleanup-and-publish
Browse files Browse the repository at this point in the history
Clean up Python code and GitHub Actions
  • Loading branch information
pkalita-lbl authored Jul 12, 2024
2 parents a4862ed + e5eebb4 commit af77c59
Show file tree
Hide file tree
Showing 21 changed files with 416 additions and 1,828 deletions.
23 changes: 11 additions & 12 deletions .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,22 @@ jobs:
id-token: write # to verify the deployment originates from an appropriate source

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
fetch-depth: 0 # otherwise, it will fail to push refs to dest repo

- name: Set up Python.
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install Poetry.
- name: Install Poetry
run: pipx install poetry

- name: Install dependencies.
run: poetry install -E docs
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'poetry'

- name: Install dependencies
run: poetry install

- name: Build documentation.
- name: Build documentation
run: |
mkdir -p docs
touch docs/.nojekyll
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,21 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10"]
python-version: ["3.9", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Check out repository
uses: actions/checkout@v3
- name: Install Poetry
run: pipx install poetry

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

- name: Install Poetry
run: pipx install poetry
cache: 'poetry'

- name: Install dependencies
run: poetry install --no-interaction --no-root

- name: Install project
run: poetry install --no-interaction
run: poetry install

- name: Run test suite
run: make test
35 changes: 22 additions & 13 deletions .github/workflows/pypi-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,37 @@ jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/gocam
permissions:
# this permission is mandatory for trusted publishing
id-token: write

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: actions/checkout@v4

- name: Install Poetry
run: |
pipx install poetry
poetry self add "poetry-dynamic-versioning[plugin]"
pipx inject poetry "poetry-dynamic-versioning[plugin]"
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'poetry'

# - name: Install dependencies
# run: poetry install --no-interaction
- name: Install dependencies
run: poetry install

- name: Generate project files
run: make clean all

- name: Test project
run: make test

- name: Build source and wheel archives
run: poetry build

- name: Publish distribution 📦 to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
uses: pypa/gh-action-pypi-publish@release/v1
15 changes: 7 additions & 8 deletions .github/workflows/test_pages_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,20 @@ jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install Poetry
run: pipx install poetry

- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'poetry'

- name: Install dependencies
run: poetry install -E docs
run: poetry install

- name: Build documentation
run: |
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ create-data-harmonizer:
npm init data-harmonizer $(SOURCE_SCHEMA_PATH)

all: site
site: gen-project gendoc
site: gen-project gendoc $(PYDANTIC)
%.yaml: gen-project
deploy: all mkd-gh-deploy

Expand Down Expand Up @@ -143,7 +143,7 @@ test-schema:
$(RUN) gen-project ${CONFIG_YAML} -d tmp $(SOURCE_SCHEMA_PATH)

test-python:
$(RUN) python -m unittest discover
$(RUN) pytest tests

lint:
$(RUN) linkml-lint $(SOURCE_SCHEMA_PATH)
Expand Down Expand Up @@ -219,6 +219,6 @@ clean:
rm -rf $(DEST)
rm -rf tmp
rm -fr docs/*
rm -fr $(PYMODEL)/*
rm -fr $(PYDANTIC)

include project.Makefile
Loading

0 comments on commit af77c59

Please sign in to comment.