Fixed doc build error by specifying DISPLAY, other workflow improvements #3536
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: Documentation | ||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: '*' | ||
pull_request: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
# Install binary dependencies needed for GLMakie to run in a headless environment | ||
# xvfb: Creates a virtual frame buffer to simulate a display | ||
# libgl1, mesa-utils, freeglut3-dev, xorg-dev, libxrandr-dev, libxinerama-dev, libxcursor-dev, libxi-dev, libxext-dev: Required libraries for OpenGL rendering | ||
- name: Install binary dependencies | ||
run: sudo apt-get update && sudo apt-get install -y xvfb libgl1 mesa-utils freeglut3-dev xorg-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev | ||
- name: Install Julia | ||
uses: julia-actions/setup-julia@latest | ||
with: | ||
version: '1' | ||
# Cache compiled artifacts and precompiled packages to speed up subsequent runs | ||
# This caching configuration targets the most computationally expensive parts of Julia's environment: | ||
# 1. ~/.julia/artifacts - Stores binary dependencies (e.g., external libraries) needed by Julia packages. | ||
# 2. ~/.julia/compiled - Contains precompiled code for faster loading of Julia packages. | ||
# We do not cache ~/.julia/environments or ~/.julia/packages to avoid caching potential outdated package sources. | ||
- uses: julia-actions/cache@v2 | ||
with: | ||
key: "julia-deps-${{ runner.os }}-${{ hashFiles('**/Project.toml') }}-${{ hashFiles('**/Manifest.toml') }}" | ||
restore-keys: | | ||
julia-deps-${{ runner.os }}- | ||
paths: | ||
- ~/.julia/artifacts | ||
- ~/.julia/compiled | ||
# Install Julia package dependencies for the documentation project | ||
- name: Install dependencies | ||
run: julia --project=docs/ -e 'ENV["JULIA_PKG_SERVER"] = ""; using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' | ||
# Build and deploy the documentation using xvfb to simulate a display for GLMakie | ||
# xvfb-run: Runs Julia with a virtual display to support OpenGL rendering | ||
# --server-args: Configures the virtual display resolution and color depth | ||
- name: Build and deploy | ||
env: | ||
GKSwstype: "100" # Specifies the workstation type for GR framework rendering, https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/7 | ||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key | ||
run: > | ||
DISPLAY=:0 xvfb-run --server-args="-screen 0 1024x768x24" \ | ||
julia --project=docs/ --code-coverage=user docs/make.jl | ||
- name: Upload site as artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Docs build | ||
path: ./docs/__site | ||
- uses: julia-actions/julia-processcoverage@v1 | ||
- uses: codecov/codecov-action@v4 | ||
with: | ||
file: lcov.info | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: false | ||