🤖 Optimize bundle size - reduce packaged app by 56% #2488
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: ["**"] | |
merge_group: | |
workflow_dispatch: | |
jobs: | |
static-check: | |
name: Static Checks (lint + typecheck + fmt) | |
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required for git describe to find tags | |
- uses: ./.github/actions/setup-cmux | |
- name: Generate version file | |
run: ./scripts/generate-version.sh | |
- name: Cache shfmt | |
id: cache-shfmt | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local/bin/shfmt | |
# We install latest via webinstall; reflect that in the cache key to avoid pinning mismatches | |
key: ${{ runner.os }}-shfmt-latest | |
restore-keys: | | |
${{ runner.os }}-shfmt- | |
- name: Install and setup shfmt | |
run: | | |
# Install shfmt if not cached or if cached binary is broken | |
if [[ ! -f "$HOME/.local/bin/shfmt" ]] || ! "$HOME/.local/bin/shfmt" --version >/dev/null 2>&1; then | |
curl -sS https://webinstall.dev/shfmt | bash | |
fi | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
# Verify shfmt is available | |
"$HOME/.local/bin/shfmt" --version | |
- name: Install Nix | |
uses: cachix/install-nix-action@v27 | |
with: | |
extra_nix_config: | | |
experimental-features = nix-command flakes | |
- name: Install uv | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Add uv to PATH | |
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Run static checks | |
run: make -j3 static-check | |
test: | |
name: Unit Tests | |
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required for git describe to find tags | |
- uses: ./.github/actions/setup-cmux | |
- name: Run tests with coverage | |
run: bun test --coverage --coverage-reporter=lcov src | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage/lcov.info | |
flags: unit-tests | |
fail_ci_if_error: false | |
integration-test: | |
name: Integration Tests | |
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required for git describe to find tags | |
- uses: ./.github/actions/setup-cmux | |
- name: Run integration tests with coverage | |
run: TEST_INTEGRATION=1 bun x jest --coverage tests | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage/lcov.info | |
flags: integration-tests | |
fail_ci_if_error: false | |
storybook-test: | |
name: Storybook Interaction Tests | |
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required for git describe to find tags | |
- uses: ./.github/actions/setup-cmux | |
- name: Install Playwright browsers | |
run: bun x playwright install --with-deps | |
- name: Build Storybook | |
run: make storybook-build | |
- name: Serve Storybook | |
run: | | |
bun x http-server storybook-static -p 6006 & | |
sleep 5 | |
- name: Run Storybook tests | |
run: make test-storybook | |
e2e-test: | |
name: End-to-End Tests | |
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required for git describe to find tags | |
- uses: ./.github/actions/setup-cmux | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y xvfb | |
- name: Install Playwright runtime dependencies | |
run: bun x playwright install-deps | |
- name: Install Playwright browsers | |
run: bun x playwright install --with-deps | |
- name: Run e2e tests | |
run: xvfb-run -a make test-e2e | |
env: | |
ELECTRON_DISABLE_SANDBOX: 1 | |
check-codex-comments: | |
name: Check Codex Comments | |
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }} | |
if: github.event_name == 'pull_request' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required for git describe to find tags | |
- name: Check for unresolved Codex comments | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
./scripts/check_codex_comments.sh ${{ github.event.pull_request.number }} | |
# Trigger CI run |