Files
oh-my-opencode/.github/workflows/ci.yml
T
YeonGyu-Kim 3e0a975d1f test(dist-bundle): assert inlined prompt content survives bundling
After the prompts-core migration the TypeScript prompt sources were
deleted; the only mechanism delivering markdown prompts to npm users
is bun build inlining via bunfig.toml [loader] ".md" = "text"
and import attributes. bun test runs from src/index.ts, not from
dist/index.js, so a future Bun upgrade that silently regresses
markdown inlining would pass source tests green while the published
bundle is broken with Cannot find module ../prompts/atlas/default.md
at first agent load.

Add a smoke test that scans the built dist/index.js for unique
signature strings from each migrated prompt file (15 signatures:
3 ultrawork + 5 atlas + 3 prometheus + 4 mode prompts). Skips
gracefully if dist/index.js does not exist (local bun test before
build). Wire into the existing CI Verify dist bundle tests step in
.github/workflows/ci.yml so the regression catches in CI build.

Closes pre-publish blocker V1 and V33.
2026-05-25 01:33:06 +09:00

200 lines
5.6 KiB
YAML

name: CI
on:
push:
branches: [master, dev]
pull_request:
branches: [master, dev]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Block PRs targeting master branch
block-master-pr:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Check PR target branch
env:
BASE_REF: ${{ github.base_ref }}
run: |
if [ "$BASE_REF" = "master" ]; then
echo "::error::PRs to master branch are not allowed. Please target the 'dev' branch instead."
echo ""
echo "PULL REQUESTS TO MASTER ARE BLOCKED"
echo ""
echo "All PRs must target the 'dev' branch."
echo "Please close this PR and create a new one targeting 'dev'."
exit 1
else
echo "PR targets '${BASE_REF}' branch - OK"
fi
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build lsp-tools-mcp submodule
run: npm ci && npm run build
working-directory: packages/lsp-tools-mcp
- uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.12"
- uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-1.3.12-${{ hashFiles('bun.lock') }}
- name: Install dependencies
run: bun install --frozen-lockfile
env:
BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/cli @ast-grep/napi"
- name: Run tests
run: bun test
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build lsp-tools-mcp submodule
run: npm ci && npm run build
working-directory: packages/lsp-tools-mcp
- uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.12"
- uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-1.3.12-${{ hashFiles('bun.lock') }}
- name: Install dependencies
run: bun install --frozen-lockfile
env:
BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/cli @ast-grep/napi"
- name: Type check
run: bun run typecheck
- name: Type check script tooling
run: bun run typecheck:script
build:
runs-on: ubuntu-latest
needs: [test, typecheck]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
submodules: recursive
- name: Build lsp-tools-mcp submodule
run: npm ci && npm run build
working-directory: packages/lsp-tools-mcp
- uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.12"
- uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-1.3.12-${{ hashFiles('bun.lock') }}
- name: Install dependencies
run: bun install --frozen-lockfile
env:
BUN_INSTALL_ALLOW_SCRIPTS: "@ast-grep/cli @ast-grep/napi"
- name: Build
run: bun run build
- name: Verify build output
run: |
test -f dist/index.js || (echo "ERROR: dist/index.js not found!" && exit 1)
test -f dist/index.d.ts || (echo "ERROR: dist/index.d.ts not found!" && exit 1)
- name: Verify dist bundle tests
run: bun test src/shared/dist-bundle-bun-globals.test.ts src/shared/dist-bundle-prompt-content.test.ts
- name: Auto-commit schema changes
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
if git diff --quiet assets/oh-my-opencode.schema.json; then
echo "No schema changes to commit"
else
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add assets/oh-my-opencode.schema.json
git commit -m "chore: auto-update schema.json"
git push
fi
draft-release:
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Generate release notes
id: notes
run: |
NOTES=$(bun run script/generate-changelog.ts)
echo "notes<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create or update draft release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NOTES: ${{ steps.notes.outputs.notes }}
TARGET_SHA: ${{ github.sha }}
run: |
EXISTING_DRAFT=$(gh release list --json tagName,isDraft --jq '.[] | select(.isDraft == true and .tagName == "next") | .tagName')
if [ -n "$EXISTING_DRAFT" ]; then
echo "Updating existing draft release..."
gh release edit next \
--title "Upcoming Changes 🍿" \
--notes-file - \
--draft <<EOF
$NOTES
EOF
else
echo "Creating new draft release..."
gh release create next \
--title "Upcoming Changes 🍿" \
--notes-file - \
--draft \
--target "$TARGET_SHA" <<EOF
$NOTES
EOF
fi