`install.sh` asked the release API for the latest tag. That API allows 60 requests an hour per IP without a token, which one office behind a NAT or a CI runner exhausts — and a throttled response has no `tag_name`, so the installer reported "could not resolve latest release tag" and gave no hint that rate limiting was the cause. It now follows the `/releases/latest` redirect, which carries no such limit and which Gitea implements identically, and keeps the API as the fallback for the wget path that cannot read the effective URL. Verified against the real release: resolves v26.8.0-beta.0, verifies the checksum, and the installed binary runs. Releases with a hyphen in the tag are now flagged as prereleases. Nothing set the flag, so every beta answered `/releases/latest` — the very thing the installer resolves by default. That is harmless while every release is a beta and wrong the moment a stable one exists, because the next beta published after it would silently displace it for everyone installing without MATCHA_VERSION. `test_install.sh` has existed since the installer landed and no workflow ever ran it — the same shape as the starter gap: a check that exists, passes, and guards nothing. CI runs it now on Linux and macOS with shellcheck alongside, and it covers a third case, since the branch this commit changes fails by producing a message: an unresolvable `latest` must name MATCHA_VERSION and must leave no binary behind. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
94 lines
3.5 KiB
YAML
94 lines
3.5 KiB
YAML
name: CI
|
|
|
|
# Rust gate. Lives in .github/workflows so both Gitea and GitHub run it.
|
|
on:
|
|
pull_request:
|
|
branches: [develop, main]
|
|
push:
|
|
branches: [develop, main]
|
|
# Weekly, so a core release that breaks the starter or leaves the pin behind
|
|
# shows up here rather than in somebody's `matcha new`.
|
|
schedule:
|
|
- cron: '0 6 * * 1'
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Rust
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
|
|
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
|
- name: Add clippy + rustfmt
|
|
run: rustup component add clippy rustfmt
|
|
- run: cargo fmt --check
|
|
- run: cargo clippy --all-targets -- -D warnings
|
|
- run: cargo test --locked
|
|
|
|
# `cargo test` proves the CLI writes the files it means to write. It cannot
|
|
# prove those files describe a project the current @green-tea/core will run —
|
|
# which is how the templates sat two core releases behind for two months with
|
|
# a green build the whole time. This job scaffolds, installs, type-checks,
|
|
# boots and introspects a real starter, per runtime.
|
|
starter:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
runtime: [node, deno, bun, edge]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Rust
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
|
|
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
|
- run: cargo build
|
|
- name: Install Deno
|
|
if: matrix.runtime == 'deno'
|
|
run: |
|
|
curl -fsSL https://deno.land/install.sh | sh -s -- --yes
|
|
echo "$HOME/.deno/bin" >> "$GITHUB_PATH"
|
|
- name: Install Bun
|
|
if: matrix.runtime == 'bun'
|
|
run: |
|
|
curl -fsSL https://bun.sh/install | bash
|
|
echo "$HOME/.bun/bin" >> "$GITHUB_PATH"
|
|
- run: scripts/starter-smoke.sh ${{ matrix.runtime }}
|
|
|
|
# The pin in src/template.rs is exact because core is prerelease-only and no
|
|
# caret range can move off its first matching prerelease. Exact pins go stale
|
|
# silently, so this is the thing that notices. Scheduled only: a core release
|
|
# should nag on Monday, not redden an unrelated pull request.
|
|
core-freshness:
|
|
if: github.event_name == 'schedule'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Compare the scaffold pin against the beta dist-tag
|
|
run: |
|
|
pinned=$(grep -oP 'CORE_VERSION: &str = "\K[^"]+' src/template.rs)
|
|
latest=$(npm view @green-tea/core dist-tags.beta)
|
|
echo "pinned=$pinned latest=$latest"
|
|
if [ "$pinned" != "$latest" ]; then
|
|
echo "::error::matcha scaffolds @green-tea/core@$pinned but the beta tag is $latest."
|
|
echo "Bump CORE_VERSION in src/template.rs and let the starter job prove it still boots."
|
|
exit 1
|
|
fi
|
|
|
|
# install.sh has had a test since the installer landed, and no workflow ever
|
|
# ran it. It exercises the script against a file:// fixture — no network — and
|
|
# checks both halves that matter: a good archive installs, and a bad checksum
|
|
# aborts without leaving a binary behind.
|
|
installer:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, macos-14]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: shellcheck install.sh test_install.sh
|
|
if: matrix.os == 'ubuntu-latest'
|
|
- run: ./test_install.sh
|