Skip to content

Rebase website from techdoc template #123

Rebase website from techdoc template

Rebase website from techdoc template #123

Workflow file for this run

name: CI
on:
pull_request:
branches: [main]
env:
MIN_COVERAGE: ${{ vars.MIN_COVERAGE }}
jobs:
website:
name: Website Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: ${{ vars.DART_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: website/package-lock.json
- name: Install dependencies
working-directory: website
run: npm ci
- name: Get Playwright version
id: playwright-version
working-directory: website
run: echo "version=$(npm ls @playwright/test --json | jq -r '.dependencies["@playwright/test"].version')" >> $GITHUB_OUTPUT
- name: Cache Playwright browsers
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
- name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
working-directory: website
run: npx playwright install --with-deps chromium
- name: Install Playwright deps only (cached)
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: npx playwright install-deps chromium
- name: Build website
working-directory: website
run: npm run build
- name: Run tests
working-directory: website
run: npm test
packages:
name: Lint, Test & Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
dart-version: ${{ vars.DART_VERSION }}
- name: Install tools
run: |
npm install -g cspell
dart pub global activate coverage
- name: Get all dependencies
run: |
for dir in packages/* examples/* tools/build; do
if [ -d "$dir" ] && [ -f "$dir/pubspec.yaml" ]; then
echo "::group::$dir"
cd $dir && dart pub get && cd - > /dev/null
echo "::endgroup::"
fi
done
- name: Install npm dependencies
run: |
for dir in packages/* examples/*; do
if [ -d "$dir" ] && [ -f "$dir/package.json" ]; then
echo "::group::npm install $dir"
cd $dir && npm install && cd - > /dev/null
echo "::endgroup::"
fi
done
- name: Spell check
run: cspell "**/*.md" "**/*.dart" "**/*.ts" --no-progress
- name: Check formatting
run: |
dart format --set-exit-if-changed packages/
dart format --set-exit-if-changed examples/
dart format --set-exit-if-changed tools/build
- name: Analyze
run: |
for dir in packages/* examples/* tools/build; do
if [ -d "$dir" ] && [ -f "$dir/pubspec.yaml" ]; then
echo "::group::Analyzing $dir"
cd $dir && dart analyze --no-fatal-warnings && cd - > /dev/null
echo "::endgroup::"
fi
done
- name: Test Tier 1
run: ./tools/test.sh --tier 1
- name: Test Tier 2
run: ./tools/test.sh --tier 2
- name: Test Tier 3
run: ./tools/test.sh --tier 3
- name: Upload test logs
if: always()
uses: actions/upload-artifact@v4
with:
name: test-logs
path: logs/
retention-days: 7
too-many-cooks-mcp:
name: Too Many Cooks MCP Server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: ${{ vars.DART_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: examples/too_many_cooks/package-lock.json
- name: Get tools/build dependencies
working-directory: tools/build
run: dart pub get
- name: Get MCP server dependencies
working-directory: examples/too_many_cooks
run: |
dart pub get
npm ci
- name: Compile MCP server
run: |
set -e
dart compile js -o examples/too_many_cooks/build/bin/server.js examples/too_many_cooks/bin/server.dart
dart run tools/build/add_preamble.dart \
examples/too_many_cooks/build/bin/server.js \
examples/too_many_cooks/build/bin/server_node.js \
--shebang
- name: Verify server exists
run: |
set -e
test -f examples/too_many_cooks/build/bin/server_node.js || (echo "Server build failed!" && exit 1)
echo "MCP server built successfully"
vscode-extension:
name: VSCode Extension Tests
runs-on: ubuntu-latest
needs: too-many-cooks-mcp
steps:
- uses: actions/checkout@v4
- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: ${{ vars.DART_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: examples/too_many_cooks_vscode_extension/package-lock.json
- name: Get tools/build dependencies
working-directory: tools/build
run: dart pub get
- name: Build Too Many Cooks MCP server
run: |
set -e
cd examples/too_many_cooks
dart pub get
npm ci
dart compile js -o build/bin/server.js bin/server.dart
cd ../..
dart run tools/build/add_preamble.dart \
examples/too_many_cooks/build/bin/server.js \
examples/too_many_cooks/build/bin/server_node.js \
--shebang
- name: Get dart_node_vsix dependencies
working-directory: packages/dart_node_vsix
run: dart pub get
- name: Get extension dependencies (Dart)
working-directory: examples/too_many_cooks_vscode_extension
run: dart pub get
- name: Get extension dependencies (npm)
working-directory: examples/too_many_cooks_vscode_extension
run: npm ci
- name: Compile extension and tests
working-directory: examples/too_many_cooks_vscode_extension
run: |
set -e
npm run pretest
- name: Run VSCode extension tests
uses: coactions/setup-xvfb@v1
with:
run: npm test
working-directory: examples/too_many_cooks_vscode_extension