Skip to content

Externalize Fluent localization; Windows test context refactor + audit #1032

Externalize Fluent localization; Windows test context refactor + audit

Externalize Fluent localization; Windows test context refactor + audit #1032

name: Netsukefile Build Test
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
netsukefile:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
rust: [stable, '1.89.0']
permissions:
contents: read
env:
RUSTUP_TOOLCHAIN: ${{ matrix.rust }}
steps:
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Setup Rust
uses: leynos/shared-actions/.github/actions/setup-rust@7f4cc57326d14b55f7eea300e0454653636fb6a1
with:
toolchain: ${{ matrix.rust }}
- name: Show rustc version
run: |
rustup show
rustc --version
cargo --version
- name: Cache Cargo
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
# Do not cache build outputs when running make clean
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.rust }}-
${{ runner.os }}-cargo-
- name: Clean build artefacts
run: make clean
- name: Build Netsuke
run: make build
- name: Create Netsukefile
run: |
cat <<- 'MANIFEST' > Netsukefile
netsuke_version: "1.0.0"
targets:
- name: base.txt
command: "touch base.txt"
- name: dependent.txt
command: "cp base.txt dependent.txt"
sources: ["base.txt"]
- name: inline-command.txt
command: "touch inline-command.txt"
- name: inline-script.txt
script: |
#!/bin/sh
touch inline-script.txt
- foreach:
- a
- skip
- b
when: item != 'skip'
name: "{{ item }}-foreach.txt"
command: "touch {{ item }}-foreach.txt"
actions:
- name: say-hello
command: "touch action-called.txt"
- name: unused-action
command: "touch unused.txt"
MANIFEST
- name: Build dependent, inline, and foreach targets
run: ./target/debug/netsuke --verbose build --emit build.ninja dependent.txt inline-command.txt inline-script.txt a-foreach.txt b-foreach.txt
- name: Assert dependent artefacts exist
env:
NINJA_MANIFEST: build.ninja
run: |
scripts/assert-file-exists.sh base.txt
scripts/assert-file-exists.sh dependent.txt
- name: Assert inline command artefact exists
env:
NINJA_MANIFEST: build.ninja
run: scripts/assert-file-exists.sh inline-command.txt
- name: Assert inline script artefact exists
env:
NINJA_MANIFEST: build.ninja
run: scripts/assert-file-exists.sh inline-script.txt
- name: Assert foreach artefacts exist
env:
NINJA_MANIFEST: build.ninja
run: |
scripts/assert-file-exists.sh a-foreach.txt
scripts/assert-file-exists.sh b-foreach.txt
- name: Assert skipped foreach artefact absent
env:
NINJA_MANIFEST: build.ninja
run: scripts/assert-file-absent.sh skip-foreach.txt
- name: Run action target
run: ./target/debug/netsuke --verbose build --emit action.ninja say-hello
- name: Assert action artefact exists
env:
NINJA_MANIFEST: action.ninja
run: scripts/assert-file-exists.sh action-called.txt
- name: Assert unused action artefact absent
env:
NINJA_MANIFEST: action.ninja
run: scripts/assert-file-absent.sh unused.txt