diff --git a/.github/workflows/netsukefile-test.yml b/.github/workflows/netsukefile-test.yml new file mode 100644 index 00000000..edb726d1 --- /dev/null +++ b/.github/workflows/netsukefile-test.yml @@ -0,0 +1,44 @@ +name: Netsukefile Build Test + +on: + pull_request: + branches: [main] + push: + branches: [main] + +jobs: + netsukefile: + runs-on: ubuntu-22.04 + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + - name: Setup Rust + uses: leynos/shared-actions/.github/actions/setup-rust@c6559452842af6a83b83429129dccaf910e34562 + - name: Cache Cargo + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + - name: Build Netsuke + run: make build + - name: Create Netsukefile + run: | + cat <<-'MANIFEST' > Netsukefile + netsuke_version: "1.0.0" + targets: + - name: generated.txt + recipe: + kind: command + command: "touch generated.txt" + MANIFEST + - name: Run Netsuke + run: ./target/debug/netsuke build generated.txt + - name: Assert artefact exists + run: scripts/assert-file-exists.sh generated.txt diff --git a/docs/roadmap.md b/docs/roadmap.md index 22038c39..0260dda1 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -66,9 +66,9 @@ compilation pipeline from parsing to execution. - **Success Criterion:** - - [ ] Netsuke can successfully take a Netsukefile without any Jinja syntax, + - [x] Netsuke can successfully take a Netsukefile without any Jinja syntax, compile it to a `build.ninja` file, and execute it via the ninja subprocess - to produce the correct build artifacts. + to produce the correct build artefacts. *(validated via CI workflow)* ## Phase 2: The Dynamic Engine ✨ diff --git a/scripts/assert-file-exists.sh b/scripts/assert-file-exists.sh new file mode 100755 index 00000000..82c9d2ed --- /dev/null +++ b/scripts/assert-file-exists.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Ensures the Netsuke build produced the expected artefact. +# Fails fast if the given file is missing. +set -euo pipefail + +if [[ $# -ne 1 ]]; then + echo "Usage: $(basename "$0") " >&2 + exit 64 # EX_USAGE +fi + +file="$1" + +if [[ ! -f "$file" ]]; then + echo "Expected build artefact '$file' to exist." >&2 + exit 1 +fi