Skip to content

🔧 chore(repo): align basic-cli examples, docs, and CI validation #8

🔧 chore(repo): align basic-cli examples, docs, and CI validation

🔧 chore(repo): align basic-cli examples, docs, and CI validation #8

Workflow file for this run

name: "CI - Tests"
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
concurrency:
group: ci-tests-${{ github.ref }}
cancel-in-progress: true
jobs:
host:
name: host
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: host
- name: Build host crate
run: cargo build --manifest-path host/Cargo.toml
- name: Run host tests
run: cargo test --manifest-path host/Cargo.toml
spore:
name: spore
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v6
with:
repository: spore-lang/spore
path: _spore
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: _spore
- name: Build spore compiler
run: cargo build --release --manifest-path _spore/Cargo.toml --bin spore
- name: Format Spore files
run: |
paths=(examples platform)
if [ -d tests ]; then
paths+=(tests)
fi
find "${paths[@]}" -name '*.sp' -type f | sort | xargs _spore/target/release/spore format
# Temporary: current spore/main formatter still emits unbracketed top-level error sets.
# Normalize back to parser-compatible `! [Err]` syntax until the upstream formatter fix merges.
find "${paths[@]}" -name '*.sp' -type f | sort | xargs ruby -e 'pattern = /! ((?:[A-Z][A-Za-z0-9_]*)(?: \| [A-Z][A-Za-z0-9_]*)*) (?=uses|cost|where|\{|$)/; ARGV.each do |name|; text = File.read(name); normalized = text.gsub(pattern) { "! [" + Regexp.last_match(1).split(" | ").join(", ") + "] " }; File.write(name, normalized) if normalized != text; end'
git diff --exit-code -- "${paths[@]}"
- name: Check Spore files
run: |
paths=(examples platform)
if [ -d tests ]; then
paths+=(tests)
fi
find "${paths[@]}" -name '*.sp' -type f | sort | xargs -n 1 _spore/target/release/spore check
- name: Build Spore files
run: |
paths=(examples platform)
if [ -d tests ]; then
paths+=(tests)
fi
find "${paths[@]}" -name '*.sp' -type f | sort | xargs -n 1 _spore/target/release/spore build
- name: Run Spore spec tests
run: |
if [ ! -d tests ]; then
echo "No Spore spec tests yet; skipping spore test."
exit 0
fi
find tests -name '*.sp' -type f | sort | xargs -r -n 1 _spore/target/release/spore test