Skip to content

Commit

Permalink
refactor(workflows): improved workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Feb 28, 2024
1 parent 07462f0 commit 3b62319
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 12 deletions.
47 changes: 43 additions & 4 deletions {{cookiecutter.project_name}}/.github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,76 @@ on:
push:
branches: [main]

# Allow one concurent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build-docs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest

# if running inside container, provide details here
# container: {}

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
contents: write # to let mkdocs write the new docs
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
id-token: write # to verify deployment is from an appropriate source

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

- name: Setup Pages
uses: actions/configure-pages@v1

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

- name: Install Poetry.
run: pipx install poetry
run: |
# run pip config here if required
# manage python3 version here if necessary
python3 -m pip install --user pipx
python3 -m pipx ensurepath
python3 -m pipx install poetry
- name: Install dependencies.
run: poetry install -E docs
run: |
${HOME}/.local/bin/poetry lock
${HOME}/.local/bin/poetry install -E docs
- name: Build documentation.
- name: Build documentation (gh-pages branch)
run: |
export PATH="${PATH}:${HOME}/.local/bin"
mkdir -p docs
touch docs/.nojekyll
make gendoc
([ ! -f docs/about.md ] && cp src/docs/about.md docs/) || true
make mkd-gh-deploy
## When your github organization does not use gh-pages branch,
## use custom upload/deploy steps illustrated below

# - name: Upload documentation (custom branch)
# uses: actions/upload-pages-artifact@v3
# with:
# path: "${HOME}/work/{{ cookiecutter.project_name }}/{{ cookiecutter.project_name }}/site"

# - name: Deploy documentation (custom branch)
# id: deployment
# uses: actions/deploy-pages@v4
# env:
# OPENSSL_CONF: ./openssl.cnf # if needed
# NODE_OPTIONS: "--openssl-shared-config"
22 changes: 18 additions & 4 deletions {{cookiecutter.project_name}}/.github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,27 @@ jobs:
python-version: ${{ "{{" }} matrix.python-version {{ "}}" }}

- name: Install Poetry
run: pipx install poetry
run: |
# run pip config here if required
python3 -m pip install --user pipx
python3 -m pipx ensurepath
python3 -m pipx install poetry
- name: Install dependencies
run: poetry install --no-interaction --no-root
run: |
${HOME}/.local/bin/poetry lock
${HOME}/.local/bin/poetry install --no-interaction --no-root
- name: Install project
run: poetry install --no-interaction
run: ${HOME}/.local/bin/poetry install --no-interaction

- name: Run Linters
run: |
${HOME}/.local/bin/poetry run linkml-lint src/{{cookiecutter.__project_slug}}/schema/{{cookiecutter.__project_slug}}.yaml --ignore-warnings
- name: Run test suite
run: make test
run: |
export PATH="${PATH}:${HOME}/.local/bin"
poetry add requests[security]
make test
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,19 @@ jobs:

- name: Install Poetry
run: |
pipx install poetry
poetry self add "poetry-dynamic-versioning[plugin]"
# run pip config here if needed
python3 -m pip install --user pipx
python3 -m pipx ensurepath
python3 -m pipx install poetry
${HOME}/.local/bin/poetry self add "poetry-dynamic-versioning[plugin]"
# - name: Install dependencies
# run: poetry install --no-interaction
# run: |
# ${HOME}/.local/bin/poetry lock
# ${HOME}/.local/bin/poetry install --no-interaction

- name: Build source and wheel archives
run: poetry build
run: ${HOME}/.local/bin/poetry build

- name: Publish distribution 📦 to PyPI
uses: pypa/[email protected]
Expand Down

0 comments on commit 3b62319

Please sign in to comment.