186 lines
4.6 KiB
YAML
186 lines
4.6 KiB
YAML
name: CLI Tests
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "cli/**"
|
|
- "backend/migrations/**"
|
|
- ".github/workflows/cli-tests.yml"
|
|
pull_request:
|
|
branches: [main]
|
|
paths:
|
|
- "cli/**"
|
|
- "backend/migrations/**"
|
|
- ".github/workflows/cli-tests.yml"
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
SQLX_OFFLINE: true
|
|
|
|
jobs:
|
|
build-check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Generate Windmill client
|
|
working-directory: cli
|
|
run: ./gen_wm_client.sh
|
|
|
|
- name: Run CLI build
|
|
working-directory: cli
|
|
run: ./build.sh
|
|
|
|
test-linux:
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: changeme
|
|
POSTGRES_DB: windmill
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
ports:
|
|
- 5432:5432
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
cache: true
|
|
cache-workspaces: backend
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Symlink Bun to /usr/bin/bun
|
|
run: sudo ln -sf $(which bun) /usr/bin/bun
|
|
|
|
- name: Symlink Node to /usr/bin/node
|
|
run: sudo ln -sf $(which node) /usr/bin/node
|
|
|
|
- name: Install dependencies
|
|
working-directory: cli
|
|
run: bun install
|
|
|
|
- name: Generate Windmill clients
|
|
working-directory: cli
|
|
run: |
|
|
./gen_wm_client.sh
|
|
./windmill-utils-internal/gen_wm_client.sh
|
|
|
|
- name: Run CLI tests
|
|
working-directory: cli
|
|
env:
|
|
DATABASE_URL: postgres://postgres:changeme@localhost:5432
|
|
CI_MINIMAL_FEATURES: "true"
|
|
run: bun test --timeout 120000 test/
|
|
|
|
test-windows:
|
|
runs-on: blacksmith-16vcpu-windows-2025
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup PostgreSQL
|
|
uses: ikalnytskyi/action-setup-postgres@v6
|
|
with:
|
|
username: postgres
|
|
password: changeme
|
|
database: windmill
|
|
port: 5432
|
|
|
|
- name: Setup Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
cache: true
|
|
cache-workspaces: backend
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Get Bun and Node paths
|
|
id: runtime-paths
|
|
shell: pwsh
|
|
run: |
|
|
$bunPath = (Get-Command bun).Source
|
|
$nodePath = (Get-Command node).Source
|
|
echo "BUN_PATH=$bunPath" >> $env:GITHUB_OUTPUT
|
|
echo "NODE_BIN_PATH=$nodePath" >> $env:GITHUB_OUTPUT
|
|
|
|
- name: Install dependencies
|
|
working-directory: cli
|
|
run: bun install
|
|
|
|
- name: Generate Windmill clients
|
|
working-directory: cli
|
|
shell: bash
|
|
run: |
|
|
./gen_wm_client.sh
|
|
./windmill-utils-internal/gen_wm_client.sh
|
|
|
|
- name: Run CLI tests
|
|
working-directory: cli
|
|
shell: pwsh
|
|
env:
|
|
DATABASE_URL: postgres://postgres:changeme@localhost:5432
|
|
CI_MINIMAL_FEATURES: "true"
|
|
BUN_PATH: ${{ steps.runtime-paths.outputs.BUN_PATH }}
|
|
NODE_BIN_PATH: ${{ steps.runtime-paths.outputs.NODE_BIN_PATH }}
|
|
run: bun test --timeout 120000 test/
|
|
|
|
# Combined summary job for branch protection
|
|
test-summary:
|
|
runs-on: ubuntu-latest
|
|
needs: [build-check, test-linux, test-windows]
|
|
if: always()
|
|
steps:
|
|
- name: Check test results
|
|
run: |
|
|
if [ "${{ needs.build-check.result }}" != "success" ]; then
|
|
echo "Build check failed"
|
|
exit 1
|
|
fi
|
|
if [ "${{ needs.test-linux.result }}" != "success" ] || [ "${{ needs.test-windows.result }}" != "success" ]; then
|
|
echo "Some tests failed"
|
|
exit 1
|
|
fi
|
|
echo "All checks passed"
|