Skip to content

Commit

Permalink
workflow: Use build-and-inspect-python-package
Browse files Browse the repository at this point in the history
  • Loading branch information
alcarney committed Oct 18, 2023
1 parent 1f1622c commit 69b3a9b
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 36 deletions.
71 changes: 45 additions & 26 deletions .github/workflows/sphinx-ext-pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Sphinx Extensions PR
name: 'PR: esbonio-extensions'
on:
pull_request:
branches:
Expand All @@ -8,7 +8,43 @@ on:
- 'lib/esbonio-extensions/**'

jobs:
sphinx-exts:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-ext-pr-pip-deps-3.11

- run: |
python --version
python -m pip install --upgrade pip
python -m pip install --upgrade tox hatch towncrier
name: Setup Environment
- run: |
set -e
./scripts/make_release.py extensions
name: Set Version
- name: Prepare Package Resources
run: |
cd lib/esbonio-extensions
python -m tox run -e pkg
- uses: hynek/build-and-inspect-python-package@v1
with:
path: lib/esbonio-extensions

test:
name: "Python v${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
Expand All @@ -22,36 +58,19 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-ext-pr-pip-deps-${{ matrix.python-version }}

- run: |
python --version
python -m pip install --upgrade pip
python -m pip install --upgrade tox bump2version
python -m pip install --upgrade tox
name: Setup Environment
- run: |
set -e
# Despite the script's name, this is only used to obtain a
# dev version number e.g. v1.2.3-dev4
./scripts/make-release.sh extensions
name: Set Version
id: info
if: matrix.python-version == '3.10'
- run: |
cd lib/esbonio-extensions
python -m tox -e py`echo ${{ matrix.python-version }} | tr -d .`
name: Test
- name: Package
run: |
cd lib/esbonio-extensions
python -m tox -e pkg
if: matrix.python-version == '3.10'

- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: 'dist'
path: lib/esbonio-extensions/dist
if: matrix.python-version == '3.10'
11 changes: 3 additions & 8 deletions .github/workflows/sphinx-ext-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,18 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"

- run: |
sudo apt update
sudo apt install pandoc
python --version
python -m pip install --upgrade pip
python -m pip install --upgrade tox bump2version towncrier docutils
python -m pip install --upgrade tox hatch towncrier docutils
name: Setup Environment
- run: |
set -e
./scripts/make-release.sh extensions
./scripts/make_release.py extensions
name: Set Version
id: info
- name: Package
run: |
Expand Down
4 changes: 2 additions & 2 deletions lib/esbonio-extensions/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ commands =
pytest --cov=esbonio

[testenv:pkg]
description = Prepare the resources to be shipped with the package
deps =
build
../esbonio
sphinx-design
usedevelop = True
usedevelop = true
allowlist_externals =
cp
mkdir
commands =

sphinx-build -b tutorial ../../docs/ ../../docs/_build/tutorial
mkdir esbonio/tutorial_demo
cp -r ../../docs/_build/tutorial/extensions esbonio/tutorial_demo/extensions
Expand Down

0 comments on commit 69b3a9b

Please sign in to comment.