fix docs #197
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: ['main**'] | |
release: | |
types: [created] | |
env: | |
BUILD_TYPE: Debug | |
jobs: | |
test_linux: | |
name: Test on Linux | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'True' | |
path: 'NGSTrefftz' | |
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: install ngstrefftz | |
run: cd NGSTrefftz && pip install . && pip install numpy | |
- name: run test | |
run: cd $GITHUB_WORKSPACE/NGSTrefftz/test && python3 -m doctest -v *.py | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
needs: [ test_linux ] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-13] | |
include: | |
- os: windows-2019 | |
cibw-arch: AMD64 | |
cmake-generator: "Visual Studio 16 2019" | |
cmake_generator_platform: "x64" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'True' | |
fetch-tags: 'true' | |
fetch-depth: 0 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.19.0 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
needs: [ test_linux ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'True' | |
fetch-tags: 'true' | |
fetch-depth: 0 | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-sdist | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
environment: pypi | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
if: github.ref == 'refs/heads/main' || github.event_name == 'release' | |
with: | |
skip-existing: true | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
# To test: repository-url: https://test.pypi.org/legacy/ | |
docker: | |
needs: [upload_pypi] | |
runs-on: ubuntu-latest | |
steps: | |
- name: clear cache | |
run: rm -rf /opt/hostedtoolcache | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
# list of Docker images to use as base name for tags | |
images: paulstdocker/ngstrefftz | |
# generate Docker tags based on the following events/attributes | |
tags: type=semver,pattern={{version}} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/#-action@v3 | |
if: github.event_name == 'release' && github.event.action == 'created' | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: "Dockerfile" | |
push: ${{ github.event_name == 'release' && github.event.action == 'created' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
#labels: ${{ steps.meta.outputs.labels }} | |
pyodide: | |
#needs: [publish-pypi] | |
if: false | |
runs-on: ubuntu-latest | |
steps: | |
- name: clear cache | |
run: rm -rf /opt/hostedtoolcache | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
submodules: 'True' | |
path: 'NGSTrefftz' | |
- name: install pkgs | |
run: sudo apt-get update && DEBIAN_FRONTEND="noninteractive" sudo apt-get -y install docker | |
- name: build docker | |
run: cd $GITHUB_WORKSPACE/NGSTrefftz && docker build -t ngstpyodide -f .github/workflows/pyodide/Dockerfile . | |
- name: retrieve tar | |
run: id=$(docker create ngstpyodide) && docker cp $id:/root/output/ngstrefftz_pyodide.tar.bz2 $GITHUB_WORKSPACE/ | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Build the JupyterLite site | |
run: | | |
cd $GITHUB_WORKSPACE/NGSTrefftz/.github/workflows/pyodide && python -m pip install -r requirements.txt | |
cd $GITHUB_WORKSPACE && jupyter lite build --pyodide ngstrefftz_pyodide.tar.bz2 --contents ./NGSTrefftz/docs/notebooks/ --output-dir ngst-pyodide | |
#- name: upload | |
#uses: actions/upload-pages-artifact@v3 | |
- name: Store the sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ngst-pyodide | |
path: ./ngst-pyodide | |
docs: | |
needs: [upload_pypi] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
submodules: 'True' | |
path: 'NGSTrefftz' | |
- name: install pkgs | |
run: sudo apt-get update && DEBIAN_FRONTEND="noninteractive" sudo apt-get -y install libxmu-dev tk-dev tcl-dev git libglu1-mesa-dev libblas-dev liblapack-dev python3 python3-pip python3-distutils python3-tk libpython3-dev python3-testresources npm nodejs pandoc -y | |
#- name: pip pkgs | |
#run: python3 -m pip list | |
- name: pip install requirements | |
run: pip install --user -r $GITHUB_WORKSPACE/NGSTrefftz/docs/requirements.txt | |
- name: set path | |
run: | | |
echo "NETGENDIR=/usr/bin/" >> $GITHUB_ENV | |
echo "LD_LIBRARY_PATH=${{ env.LD_LIBRARY_PATH }}:/home/runner/.local/lib:/usr/local/lib/" >> $GITHUB_ENV | |
- name: Build and Commit | |
uses: sphinx-notes/pages@v2 | |
with: | |
repository_path: 'NGSTrefftz' | |
publish: false | |
#requirements_path: ./docs/requirements.txt | |
- name: Download pyodide stuff | |
if: false | |
uses: actions/download-artifact@v4 | |
with: | |
name: ngst-pyodide | |
path: NGSTrefftz/ngst-pyodide | |
- run: tree -d . | |
- name: Upload | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: 'NGSTrefftz/' | |
deploy-docs: | |
needs: docs | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
#if: github.event_name == 'release' && github.event.action == 'created' | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
paper: | |
runs-on: ubuntu-latest | |
name: Paper Draft | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build draft PDF | |
uses: openjournals/openjournals-draft-action@master | |
with: | |
journal: joss | |
paper-path: docs/paper/paper.md | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: joss_paper | |
path: docs/paper/paper.pdf |