Skip to content

chore: split test runs in CI #1277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Integration Tests

env:
TELEMETRY_TRACKING_TOKEN: ${{ secrets.TELEMETRY_TRACKING_TOKEN }}
DO_NOT_TRACK: '1'

on:
merge_group:
push:
branches:
- main
- dev
- release/*
- v2
pull_request:
branches:
- main
- dev
- release/*
- v2

permissions:
contents: read

jobs:
build-test:
runs-on: buildjet-8vcpu-ubuntu-2204

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: abc123
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

strategy:
matrix:
node-version: [20.x]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: ^7.15.0

- name: Use Node.js ${{ matrix.node-version }}
uses: buildjet/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- name: Setup pnpm cache
uses: buildjet/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1.1.0

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2.4.2
with:
gradle-home-cache-cleanup: true

- name: Build
run: DEFAULT_NPM_TAG=latest pnpm run build

# install again for internal dependencies
- name: Install internal dependencies
run: pnpm install --frozen-lockfile

- name: Integration Test
run: pnpm run test-scaffold && pnpm run test-integration
104 changes: 104 additions & 0 deletions .github/workflows/regression-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Regression Tests

env:
TELEMETRY_TRACKING_TOKEN: ${{ secrets.TELEMETRY_TRACKING_TOKEN }}
DO_NOT_TRACK: '1'

on:
merge_group:
push:
branches:
- main
- dev
- release/*
- v2
pull_request:
branches:
- main
- dev
- release/*
- v2

permissions:
contents: read

jobs:
build-test:
runs-on: buildjet-8vcpu-ubuntu-2204

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: abc123
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

strategy:
matrix:
node-version: [20.x]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: ^7.15.0

- name: Use Node.js ${{ matrix.node-version }}
uses: buildjet/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- name: Setup pnpm cache
uses: buildjet/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1.1.0

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2.4.2
with:
gradle-home-cache-cleanup: true

- name: Build
run: DEFAULT_NPM_TAG=latest pnpm run build

# install again for internal dependencies
- name: Install internal dependencies
run: pnpm install --frozen-lockfile

- name: Regression Test
run: pnpm run test-scaffold && pnpm run test-regression
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"build": "pnpm -r build",
"lint": "pnpm -r lint",
"test": "pnpm -r --parallel run test --silent --forceExit",
"test-ci": "pnpm -r --parallel run test --silent --forceExit",
"test-ci": "pnpm -r --parallel run --filter=\"./packages/**\" test --silent --forceExit",
"test-integration": "pnpm run --filter=integration test --silent --forceExit",
"test-regression": "pnpm run --filter=regression test --silent --forceExit",
"test-scaffold": "tsx script/test-scaffold.ts",
"publish-all": "pnpm --filter \"./packages/**\" -r publish --access public",
"publish-preview": "pnpm --filter \"./packages/**\" -r publish --force --registry https://preview.registry.zenstack.dev/",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { format } from 'util';
import { isPrismaClientKnownRequestError } from '@zenstackhq/runtime';

Expand Down
Loading