mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-29 16:25:20 +00:00
ci: dynamically discover example directories for build-examples
Replace the hardcoded matrix list in the build-examples job with a dynamic list-examples job that discovers all subdirectories under example/ at runtime. This uses ls/jq to produce a JSON array and fromJSON() to feed it into the matrix, so new examples are picked up automatically without updating the workflow.
This commit is contained in:
31
.github/workflows/test.yml
vendored
31
.github/workflows/test.yml
vendored
@@ -167,23 +167,30 @@ jobs:
|
|||||||
- name: Build Benchmarks
|
- name: Build Benchmarks
|
||||||
run: nix develop -c zig build -Demit-bench
|
run: nix develop -c zig build -Demit-bench
|
||||||
|
|
||||||
|
list-examples:
|
||||||
|
if: github.repository == 'ghostty-org/ghostty' && needs.skip.outputs.skip != 'true'
|
||||||
|
needs: skip
|
||||||
|
runs-on: namespace-profile-ghostty-xsm
|
||||||
|
outputs:
|
||||||
|
dirs: ${{ steps.list.outputs.dirs }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
- id: list
|
||||||
|
name: List example directories
|
||||||
|
run: |
|
||||||
|
dirs=$(ls -d example/*/ | xargs -n1 basename | jq -R -s -c 'split("\n") | map(select(. != ""))')
|
||||||
|
echo "$dirs" | jq .
|
||||||
|
echo "dirs=$dirs" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
build-examples:
|
build-examples:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
dir:
|
dir: ${{ fromJSON(needs.list-examples.outputs.dirs) }}
|
||||||
[
|
|
||||||
c-vt,
|
|
||||||
c-vt-key-encode,
|
|
||||||
c-vt-paste,
|
|
||||||
c-vt-sgr,
|
|
||||||
zig-formatter,
|
|
||||||
zig-vt,
|
|
||||||
zig-vt-stream,
|
|
||||||
]
|
|
||||||
name: Example ${{ matrix.dir }}
|
name: Example ${{ matrix.dir }}
|
||||||
runs-on: namespace-profile-ghostty-sm
|
runs-on: namespace-profile-ghostty-xsm
|
||||||
needs: test
|
needs: [test, list-examples]
|
||||||
env:
|
env:
|
||||||
ZIG_LOCAL_CACHE_DIR: /zig/local-cache
|
ZIG_LOCAL_CACHE_DIR: /zig/local-cache
|
||||||
ZIG_GLOBAL_CACHE_DIR: /zig/global-cache
|
ZIG_GLOBAL_CACHE_DIR: /zig/global-cache
|
||||||
|
|||||||
Reference in New Issue
Block a user