Skip to content

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mbsantiago committed Jan 31, 2024
1 parent 71c7519 commit f7aee9f
Show file tree
Hide file tree
Showing 8 changed files with 243 additions and 42 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build_frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build Frontend

on:
workflow_call:

jobs:
build-frontend:
name: Build Frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 21
- name: Install dependencies
run: |
cd front
npm install
- name: Build app
run: |
cd front
npm run build
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: frontend
path: front/out
27 changes: 27 additions & 0 deletions .github/workflows/build_user_guide.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build Frontend

on:
workflow_call:

jobs:
build-user-guide:
name: Build User Guide
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
cd back
pip install -r guide_requirements.txt
- name: Build Guide
run: |
cd back
mkdocs build -d mkdocs-guide.yml -d site
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: user_guide
path: back/site
48 changes: 33 additions & 15 deletions .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,28 @@ on:
types: [published]

jobs:
build-user-guide:
uses: mbsantiago/whombat/.github/workflows/build_user_guide.yml@dev

build-frontend:
uses: mbsantiago/whombat/.github/workflows/build_frontend.yml@dev

build-windows:
runs-on: windows-latest
needs: [build-user-guide, build-frontend]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: actions/setup-node@v4
- uses: actions/download-artifact@v4
with:
node-version: 21
- shell: pwsh
run: scripts/update_front.ps1
- shell: pwsh
run: scripts/update_guide.ps1
name: frontend
path: back/src/whombat/statics/
- uses: actions/download-artifact@v4
with:
name: user_guide
path: back/src/whombat/user_guide/
- shell: pwsh
run: scripts/bundle_windows.ps1
- run: |
Expand All @@ -30,17 +38,20 @@ jobs:

build-ubuntu:
runs-on: ubuntu-20.04
needs: [build-user-guide, build-frontend]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: actions/setup-node@v4
- uses: actions/download-artifact@v4
with:
node-version: 21
- run: npm cache clean --force
- run: make build-frontend
- run: make build-guide
name: frontend
path: back/src/whombat/statics/
- uses: actions/download-artifact@v4
with:
name: user_guide
path: back/src/whombat/user_guide/
- run: bash scripts/bundle_linux.sh
- run: |
mkdir dist/
Expand All @@ -52,16 +63,23 @@ jobs:

build-macos:
runs-on: macos-11
needs: [build-user-guide, build-frontend]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: actions/setup-node@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: actions/download-artifact@v4
with:
name: frontend
path: back/src/whombat/statics/
- uses: actions/download-artifact@v4
with:
node-version: 21
- run: make build-frontend
- run: make build-guide
name: user_guide
path: back/src/whombat/user_guide/
- run: bash scripts/bundle_macos.sh
- run: |
mkdir dist/
Expand Down
60 changes: 37 additions & 23 deletions .github/workflows/bundle_test.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
name: Test Bundle App

on:
on:
workflow_dispatch:
push:
branches:
- workflows


jobs:
build-user-guide:
uses: mbsantiago/whombat/.github/workflows/build_user_guide.yml@dev

build-frontend:
uses: mbsantiago/whombat/.github/workflows/build_frontend.yml@dev

build-windows-test:
runs-on: windows-latest
needs: [build-user-guide, build-frontend]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/setup-node@v4
- uses: actions/download-artifact@v4
with:
node-version: 21
- shell: pwsh
run: scripts/update_front.ps1
- shell: pwsh
run: scripts/update_guide.ps1
name: frontend
path: back/src/whombat/statics/
- uses: actions/download-artifact@v4
with:
name: user_guide
path: back/src/whombat/user_guide/
- shell: pwsh
run: scripts/bundle_windows.ps1
- run: |
Expand All @@ -34,17 +41,20 @@ jobs:

build-ubuntu-test:
runs-on: ubuntu-20.04
needs: [build-user-guide, build-frontend]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/setup-node@v4
- uses: actions/download-artifact@v4
with:
node-version: 21
- run: npm cache clean --force
- run: make build-frontend
- run: make build-guide
name: frontend
path: back/src/whombat/statics/
- uses: actions/download-artifact@v4
with:
name: user_guide
path: back/src/whombat/user_guide/
- run: bash scripts/bundle_linux.sh
- run: |
mkdir dist/
Expand All @@ -56,16 +66,20 @@ jobs:

build-macos-test:
runs-on: macos-11
needs: [build-user-guide, build-frontend]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/setup-node@v4
- uses: actions/download-artifact@v4
with:
name: frontend
path: back/src/whombat/statics/
- uses: actions/download-artifact@v4
with:
node-version: 21
- run: make build-frontend
- run: make build-guide
name: user_guide
path: back/src/whombat/user_guide/
- run: bash scripts/bundle_macos.sh
- run: |
mkdir dist/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v3
with:
Expand Down
108 changes: 108 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Publish PyPI
on:
workflow_dispatch:
release:
types: [published]

jobs:
build-user-guide:
uses: mbsantiago/whombat/.github/workflows/build_user_guide.yml@dev

build-frontend:
uses: mbsantiago/whombat/.github/workflows/build_frontend.yml@dev

build:
runs-on: ubuntu-latest
needs: [build-user-guide, build-frontend]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: actions/download-artifact@v4
with:
name: frontend
path: back/src/whombat/statics/
- uses: actions/download-artifact@v4
with:
name: user_guide
path: back/src/whombat/user_guide/
- name: Install pypa/build
run: pip install build
- name: Build a binary wheel and source tarball
run: |
cd back
python -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: back/dist/

publish-to-pypi:
name: Publish to PyPI
needs: [build]
runs-on: ubuntu-latest

if: github.event_name == 'release'

environment:
name: pypi
url: https://pypi.org/p/whombat

permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: Upload to GitHub release
needs: [publish-to-pypi]
runs-on: ubuntu-latest

if: github.event_name == 'release'

permissions:
contents: write
id-token: write

steps:
- name: Download the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Upload artifact to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release upload '${{ github.ref_name }}' dist/** --repo '${{github.repository }}'
publish-to-testpypi:
name: Publish to TestPyPI
needs: [build]
runs-on: ubuntu-latest

if: github.event_name == 'workflow_dispatch'

environment:
name: testpypi
url: https://test.pypi.org/p/whombat

permissions:
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
11 changes: 9 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v3
with:
Expand All @@ -24,4 +24,11 @@ jobs:
- name: Run tests
run: |
cd back
pdm run pytest tests/
pdm run coverage run --source whombat -m pytest
pdm run coverage report -m
pdm run coverage html
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

0 comments on commit f7aee9f

Please sign in to comment.