Skip to content

Use CLI wrapper to initialize project #2505

Use CLI wrapper to initialize project

Use CLI wrapper to initialize project #2505

Workflow file for this run

name: tests
on:
push:
branches:
- master
- ci
pull_request:
jobs:
test:
# Skip tests when doing a release to avoid the workflow race
# when the release PR gets merged by the bot.
if: needs.prep.outputs.version == 0
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.edgedb-version == 'nightly' }}
strategy:
matrix:
node-version: ["18", "20", "22"]
os: [ubuntu-latest]
edgedb-version: ["stable"]
include:
- os: ubuntu-latest
node-version: "20"
edgedb-version: "nightly"
- os: ubuntu-latest
node-version: "20"
edgedb-version: "4"
- os: ubuntu-latest
node-version: "20"
edgedb-version: "3"
- os: ubuntu-latest
node-version: "20"
edgedb-version: "2"
# XXX: macOS is currently unsupported by setup-edgedb
# - os: macos-latest
# node-version: "20"
# edgedb-version: "stable"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 50
submodules: true
- name: Setup WSL
if: ${{ matrix.os == 'windows-2019' }}
uses: vampire/setup-wsl@v1
with:
wsl-shell-user: edgedb
additional-packages: ca-certificates
curl
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Set up Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Install dev deps
run: |
yarn --frozen-lockfile
- name: Lint
run: |
yarn lint
- name: Check format
run: |
yarn run format:check
- name: ESLint (ignore failures for now)
run: |
yarn eslint || echo "ESLint still failing... Fine for now!"
- name: Build
run: |
yarn workspace edgedb build
yarn workspace @edgedb/generate build
yarn workspace @edgedb/auth-core build
yarn workspace @edgedb/ai build
- name: Typecheck
run: |
yarn workspaces run typecheck
# - name: Compile for Deno
# run: |
# yarn build:deno
- name: Install EdgeDB
uses: edgedb/setup-edgedb@6763b6de72782d9c2e5ecc1095986a1c707da68f
with:
instance-name: test
server-version: ${{ matrix.edgedb-version }}
- name: Show actual EdgeDB server version
run: |
echo ACTIVE_EDGEDB_VERSION=$(edgedb query 'select sys::get_version_as_str()' -I test) >> $GITHUB_ENV
- name: Run query builder tests
run: |
yarn workspace @edgedb/generate test:ci
- name: Run query builder integration tests legacy
if: ${{ matrix.edgedb-version == '2' }}
run: |
yarn workspace @edgedb/integration-legacy test:ci
- name: Run query builder integration tests lts
if: ${{ matrix.edgedb-version == '3' || matrix.edgedb-version == '4' || matrix.edgedb-version == 'stable' || matrix.edgedb-version == 'nightly' }}
run: |
yarn workspace @edgedb/integration-lts test:ci
yarn workspace @edgedb/integration-lts run bench:types || echo "Benchmark types script failed, proceeding anyway."
- name: Run query builder integration tests stable
if: ${{ matrix.edgedb-version == 'stable' || matrix.edgedb-version == 'nightly' }}
run: |
yarn workspace @edgedb/integration-stable test:ci
- name: Run query builder integration tests nightly
if: ${{ matrix.edgedb-version == 'nightly' }}
run: |
yarn workspace @edgedb/integration-nightly test:ci
- name: Run functional tests
run: |
yarn workspace edgedb test
- name: Run create-app tests
run: |
yarn workspace @edgedb/create test
- name: Run @edgedb/ai tests
run: |
yarn workspace @edgedb/ai test
# This job exists solely to act as the test job aggregate to be
# targeted by branch policies.
regression-tests:
name: "Regression Tests"
needs: [test]
runs-on: ubuntu-latest
steps:
- run: echo OK
test-cli-wrapper:
name: "Test CLI Wrapper"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Set up Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Install EdgeDB
uses: edgedb/setup-edgedb@6763b6de72782d9c2e5ecc1095986a1c707da68f
with:
cli-version: stable
server-version: none
- name: Install dev deps
run: |
yarn --frozen-lockfile
- name: Build and pack CLI wrapper
run: |
yarn workspace edgedb run build
yarn workspace edgedb pack --filename=${{ github.workspace }}/edgedb-cli.tar.gz
- name: Test CLI wrapper with npm
run: |
mkdir temp-npm
cd temp-npm
npm init -y
npm install ${{ github.workspace }}/edgedb-cli.tar.gz
npm exec edgedb -- --version
- name: Test CLI wrapper with yarn
run: |
mkdir temp-yarn
cd temp-yarn
yarn init -y
yarn add ${{ github.workspace}}/edgedb-cli.tar.gz
yarn edgedb --version
- uses: threeal/setup-yarn-action@ec8c075e62bc497968de40011c2b766f5e8f1ac5
with:
version: latest
cache: false
- name: Test CLI wrapper with yarn-berry
run: |
mkdir temp-yarn-berry
cd temp-yarn-berry
yarn set version berry
yarn init -y
touch yarn.lock
yarn add ${{ github.workspace }}/edgedb-cli.tar.gz
yarn edgedb --version
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d
with:
version: latest
run_install: false
- name: Test CLI wrapper with pnpm
run: |
mkdir temp-pnpm
cd temp-pnpm
pnpm init
pnpm add ${{ github.workspace }}/edgedb-cli.tar.gz
pnpm exec edgedb --version
- uses: oven-sh/setup-bun@8f24390df009a496891208e5e36b8a1de1f45135
- name: Test CLI wrapper with bun
run: |
mkdir temp-bun
cd temp-bun
bun init
bun add ${{ github.workspace }}/edgedb-cli.tar.gz
bun edgedb --version