Fix build issues #289
Workflow file for this run
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 Documentation | |
on: | |
push: | |
branches: [master] | |
paths: | |
- docs/* | |
- src/fiat/* | |
- .testdata/* | |
- pyproject.toml | |
- .github/workflows/docs.yml | |
pull_request: | |
branches: [master] | |
paths: | |
- docs/* | |
- src/fiat/* | |
- .testdata/* | |
- pyproject.toml | |
- .github/workflows/docs.yml | |
jobs: | |
docs: | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest"] #, "macos-latest", "windows-latest"] | |
python-version: ["3.12"] # fix tests to support older versions | |
include: | |
- os: ubuntu-latest | |
label: linux-64 | |
prefix: /home/runner/miniconda3/envs/fiat_test | |
name: ${{ matrix.label }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Generate env yaml | |
run: | | |
pip install tomli | |
python make_env.py docs -p ${{ matrix.python-version }}.* | |
- name: Load cache | |
id: cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
/home/runner/miniconda3 | |
~/pycache | |
# the below two settings mean we'll alway srestore the cache | |
# but the cache hit output can tell us if we have to update afterwards | |
key: docs-${{ hashFiles('environment.yml') }} | |
restore-keys: | | |
docs | |
- name: Cache failed | |
if: steps.cache.outputs.cache-matched-key == '' | |
run: | | |
echo "Failed to restore any cache. exiting..." | |
exit 1 | |
- name: Update environment | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
export PATH=/home/runner/miniconda3/bin:$PATH | |
mamba env update -n fiat_docs -f environment.yml | |
- name: Setup quarto | |
run: | | |
sudo apt install -y curl | |
sudo apt install -y gdebi-core | |
mkdir tmp | |
curl -L https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.450/quarto-1.3.450-linux-amd64.deb --output tmp/quarto.deb | |
chmod +x tmp/quarto.deb | |
sudo gdebi -n tmp/quarto.deb | |
- name: Install quarto extensions | |
run: | | |
sudo apt install -y expect | |
cd docs | |
chmod u+x _scripts/add_packages.sh | |
_scripts/add_packages.sh | |
- name: Setup api & testdata | |
run: | | |
export PATH=/home/runner/miniconda3/bin:$PATH | |
mamba run -n fiat_docs python -m pip install tomli-w | |
mamba run -n fiat_docs python .testdata/create_test_data.py | |
mamba run -n fiat_docs python docs/_scripts/api.py docs/_quarto.yml | |
mamba run -n fiat_docs python docs/_scripts/inv.py interlinks docs/_quarto.yml | |
- name: Generate docs | |
run: | | |
export PATH=/home/runner/miniconda3/bin:$PATH | |
source /home/runner/miniconda3/etc/profile.d/conda.sh | |
conda activate fiat_docs | |
quarto render docs/ --execute | |
echo "DOC_VERSION=$(mamba run -n fiat_docs python -c 'from fiat import __version__ as v; print("dev" if "dev" in v else "v"+v.replace(".dev",""))')" >> $GITHUB_ENV | |
- name: Upload to GitHub Pages | |
if: ${{ github.event_name != 'pull_request' && !github.event.act }} | |
uses: peaceiris/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/_site | |
destination_dir: ./${{ env.DOC_VERSION }} | |
keep_files: false | |
full_commit_message: Deploy ${{ env.DOC_VERSION }} to GitHub Pages | |
- name: Trigger Dispatch | |
if: ${{ github.event_name != 'pull_request' && !github.event.act }} | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
event-type: docs-updated |