Merge pull request #1 from XraySpectroscopy/revamp_nxxas #3
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: CI | |
on: | |
push: | |
branches: | |
- main # push commit to the main branch | |
pull_request: | |
branches: | |
- main # pull request to the main branch | |
workflow_dispatch: # allow manual triggering | |
inputs: | |
deploy: | |
description: 'Deploy documentation' | |
type: boolean | |
required: true | |
default: false | |
upload: | |
description: 'Upload documentation (pdfs in _static/)' | |
type: boolean | |
required: true | |
default: false | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build-linux: | |
name: CI py${{ matrix.python-version }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
max-parallel: 5 | |
env: | |
python_version: ${{ matrix.python-version }} | |
python_deploy_version: '3.8' # version to use for deployment | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Deploy Information | |
if: ${{ github.event.inputs.deploy && env.python_version == env.python_deploy_version }} | |
run: | | |
echo "The HTML NeXus User Manual will be pushed to" | |
echo " https://github.com/nexusformat/definitions/tree/gh-pages" | |
echo "The HTML NeXus User Manual will be deployed on" | |
echo " https://nexusformat.github.io/definitions/" | |
- name: Install Requirements | |
run: | | |
python3 -m pip install --upgrade pip setuptools | |
make install | |
python3 -m pip list | |
- name: Check Code Style | |
run: | | |
make style | |
- name: Run Tests | |
run: | | |
make test | |
- name: Install LaTeX | |
run: | | |
sudo apt-get update -y && \ | |
sudo apt-get install -y \ | |
latexmk \ | |
texlive-latex-recommended \ | |
texlive-latex-extra \ | |
texlive-fonts-recommended | |
tex --version | |
- name: Generate build files | |
env: | |
GH_TOKEN: ${{ (env.python_version == env.python_deploy_version && (github.event.inputs.deploy || github.event.inputs.upload)) && secrets.GITHUB_TOKEN || 'NONE' }} | |
run: | | |
make prepare | |
- name: Build Impatient Guide | |
run: | | |
make impatient-guide | |
ls -lAFgh build/impatient-guide/build/html/index.html | |
mkdir -p build/html | |
mv build/impatient-guide/build/html build/html/impatient | |
- name: Build User Manual | |
run: | | |
make pdf | |
make html | |
ls -lAFgh build/manual/build/html/index.html | |
mkdir -p build/html | |
mv build/manual/build/html/* build/html | |
- name: Deploy both the User Manual and the Impatient Guide | |
if: ${{ github.event.inputs.deploy && env.python_version == env.python_deploy_version }} | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
folder: build/html | |
- name: Upload the User Manual and the Impatient Guide | |
if: ${{ github.event.inputs.upload && env.python_version == env.python_deploy_version }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: nexus-definitions-docs | |
path: build/html |