|
7 | 7 | tags: '*'
|
8 | 8 | pull_request:
|
9 | 9 |
|
| 10 | +permissions: |
| 11 | + actions: write # Allows the workflow to delete old caches created by previous runs, ensuring efficient cache management and preventing the cache from growing indefinitely. https://github.com/julia-actions/cache?tab=readme-ov-file#cache-retention |
| 12 | + contents: read |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
10 | 18 | jobs:
|
11 | 19 | build:
|
12 | 20 | runs-on: ubuntu-latest
|
13 | 21 | steps:
|
14 |
| - - uses: actions/checkout@v4 |
15 |
| - - uses: julia-actions/setup-julia@latest |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + # Install binary dependencies needed for GLMakie to run in a headless environment |
| 26 | + # xvfb: Creates a virtual frame buffer to simulate a display |
| 27 | + # libgl1, mesa-utils, freeglut3-dev, xorg-dev, libxrandr-dev, libxinerama-dev, libxcursor-dev, libxi-dev, libxext-dev: Required libraries for OpenGL rendering |
| 28 | + - name: Install binary dependencies |
| 29 | + 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 |
| 30 | + |
| 31 | + - name: Install Julia |
| 32 | + uses: julia-actions/setup-julia@latest |
16 | 33 | with:
|
17 | 34 | version: '1'
|
18 |
| - - name: Install xvfb and OpenGL libraries |
19 |
| - run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev |
| 35 | + |
| 36 | + # Cache to speed up subsequent runs |
| 37 | + - uses: julia-actions/cache@v2 |
| 38 | + with: |
| 39 | + cache-name: docs-cache |
| 40 | + |
| 41 | + # Install Julia package dependencies for the documentation project |
20 | 42 | - name: Install dependencies
|
21 |
| - run: julia --project=docs/ -e 'ENV["JULIA_PKG_SERVER"] = ""; using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' |
| 43 | + run: > |
| 44 | + DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs/ -e 'ENV["JULIA_PKG_SERVER"] = ""; using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' |
| 45 | +
|
| 46 | + # Build and deploy the documentation using xvfb to simulate a display for GLMakie |
| 47 | + # xvfb-run: Runs Julia with a virtual display to support OpenGL rendering |
| 48 | + # --server-args: Configures the virtual display resolution and color depth |
22 | 49 | - name: Build and deploy
|
23 | 50 | env:
|
24 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token |
| 51 | + 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 |
| 52 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Required for permissions to deploy documentation |
25 | 53 | DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
|
26 |
| - GKSwstype: "100" # https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988 |
27 |
| - run: | |
28 |
| - DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=docs/ --code-coverage=user docs/make.jl |
| 54 | + run: > |
| 55 | + DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' |
| 56 | + julia --project=docs --color=yes --code-coverage=user docs/make.jl |
| 57 | +
|
| 58 | + - name: Upload site as artifact |
| 59 | + uses: actions/upload-artifact@v4 |
| 60 | + with: |
| 61 | + name: docs-artifact |
| 62 | + path: ./docs/build |
| 63 | + retention-days: 3 |
| 64 | + compression-level: 9 |
| 65 | + overwrite: true |
| 66 | + |
29 | 67 | - uses: julia-actions/julia-processcoverage@v1
|
| 68 | + |
30 | 69 | - uses: codecov/codecov-action@v4
|
31 | 70 | with:
|
32 | 71 | file: lcov.info
|
33 | 72 | token: ${{ secrets.CODECOV_TOKEN }}
|
34 | 73 | fail_ci_if_error: false
|
| 74 | + |
0 commit comments