Compare commits
No commits in common. "main" and "@emigrate/reporter-pino@0.6.5" have entirely different histories.
main
...
@emigrate/
6 changed files with 27 additions and 84 deletions
23
.github/workflows/ci.yaml
vendored
23
.github/workflows/ci.yaml
vendored
|
|
@ -15,6 +15,18 @@ jobs:
|
||||||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||||
DO_NOT_TRACK: 1
|
DO_NOT_TRACK: 1
|
||||||
|
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:8.0
|
||||||
|
env:
|
||||||
|
MYSQL_ROOT_PASSWORD: root
|
||||||
|
MYSQL_DATABASE: emigrate
|
||||||
|
MYSQL_USER: emigrate
|
||||||
|
MYSQL_PASSWORD: emigrate
|
||||||
|
ports:
|
||||||
|
- 3306:3306
|
||||||
|
options: --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -32,5 +44,16 @@ jobs:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
|
||||||
|
- name: Wait for MySQL to be ready
|
||||||
|
run: |
|
||||||
|
for i in {1..30}; do
|
||||||
|
nc -z localhost 3306 && echo "MySQL is up!" && break
|
||||||
|
echo "Waiting for MySQL..."
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
- name: Checks
|
- name: Checks
|
||||||
|
env:
|
||||||
|
MYSQL_HOST: localhost
|
||||||
|
MYSQL_PORT: 3306
|
||||||
run: pnpm checks
|
run: pnpm checks
|
||||||
|
|
|
||||||
62
.github/workflows/integration.yaml
vendored
62
.github/workflows/integration.yaml
vendored
|
|
@ -1,62 +0,0 @@
|
||||||
name: Integration Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: ['main', 'changeset-release/main']
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
mysql_integration:
|
|
||||||
name: Emigrate MySQL integration tests
|
|
||||||
timeout-minutes: 15
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
||||||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
|
||||||
DO_NOT_TRACK: 1
|
|
||||||
|
|
||||||
services:
|
|
||||||
mysql:
|
|
||||||
image: mysql:8.0
|
|
||||||
env:
|
|
||||||
MYSQL_ROOT_PASSWORD: root
|
|
||||||
MYSQL_DATABASE: emigrate
|
|
||||||
MYSQL_USER: emigrate
|
|
||||||
MYSQL_PASSWORD: emigrate
|
|
||||||
ports:
|
|
||||||
- 3306:3306
|
|
||||||
options: --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Check out code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 2
|
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v4.0.0
|
|
||||||
|
|
||||||
- name: Setup Node.js environment
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 22.15.0
|
|
||||||
cache: 'pnpm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Wait for MySQL to be ready
|
|
||||||
run: |
|
|
||||||
for i in {1..30}; do
|
|
||||||
nc -z localhost 3306 && echo "MySQL is up!" && break
|
|
||||||
echo "Waiting for MySQL..."
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Build package
|
|
||||||
run: pnpm build --filter @emigrate/mysql
|
|
||||||
|
|
||||||
- name: Integration Tests
|
|
||||||
env:
|
|
||||||
MYSQL_HOST: '127.0.0.1'
|
|
||||||
MYSQL_PORT: 3306
|
|
||||||
run: pnpm --filter @emigrate/mysql integration
|
|
||||||
|
|
@ -62,10 +62,7 @@
|
||||||
},
|
},
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"files": [
|
"files": "packages/**/*.test.ts",
|
||||||
"packages/**/*.test.ts",
|
|
||||||
"packages/**/*.integration.ts"
|
|
||||||
],
|
|
||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/no-floating-promises": 0,
|
"@typescript-eslint/no-floating-promises": 0,
|
||||||
"max-params": 0
|
"max-params": 0
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@
|
||||||
"build": "tsc --pretty",
|
"build": "tsc --pretty",
|
||||||
"build:watch": "tsc --pretty --watch",
|
"build:watch": "tsc --pretty --watch",
|
||||||
"lint": "xo --cwd=../.. $(pwd)",
|
"lint": "xo --cwd=../.. $(pwd)",
|
||||||
"integration": "glob -c \"node --import tsx --test-reporter spec --test\" \"./src/**/*.integration.ts\"",
|
"test-disabled": "glob -c \"node --import tsx --test-reporter spec --test\" \"./src/**/*.test.ts\"",
|
||||||
"integration:watch": "glob -c \"node --watch --import tsx --test-reporter spec --test\" \"./src/**/*.integration.ts\""
|
"test:watch": "glob -c \"node --watch --import tsx --test-reporter spec --test\" \"./src/**/*.test.ts\""
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"emigrate",
|
"emigrate",
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@ import { createMysqlStorage } from './index.js';
|
||||||
|
|
||||||
let db: { port: number; host: string };
|
let db: { port: number; host: string };
|
||||||
|
|
||||||
const toEnd = new Set<{ end: () => Promise<void> }>();
|
|
||||||
|
|
||||||
describe('emigrate-mysql', async () => {
|
describe('emigrate-mysql', async () => {
|
||||||
before(
|
before(
|
||||||
async () => {
|
async () => {
|
||||||
|
|
@ -19,12 +17,6 @@ describe('emigrate-mysql', async () => {
|
||||||
|
|
||||||
after(
|
after(
|
||||||
async () => {
|
async () => {
|
||||||
for (const storage of toEnd) {
|
|
||||||
// eslint-disable-next-line no-await-in-loop
|
|
||||||
await storage.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
toEnd.clear();
|
|
||||||
await stopDatabase();
|
await stopDatabase();
|
||||||
},
|
},
|
||||||
{ timeout: 10_000 },
|
{ timeout: 10_000 },
|
||||||
|
|
@ -45,9 +37,6 @@ describe('emigrate-mysql', async () => {
|
||||||
|
|
||||||
const [storage1, storage2] = await Promise.all([initializeStorage(), initializeStorage()]);
|
const [storage1, storage2] = await Promise.all([initializeStorage(), initializeStorage()]);
|
||||||
|
|
||||||
toEnd.add(storage1);
|
|
||||||
toEnd.add(storage2);
|
|
||||||
|
|
||||||
const migrations = toMigrations('/emigrate', 'migrations', [
|
const migrations = toMigrations('/emigrate', 'migrations', [
|
||||||
'2023-10-01-01-test.js',
|
'2023-10-01-01-test.js',
|
||||||
'2023-10-01-02-test.js',
|
'2023-10-01-02-test.js',
|
||||||
|
|
@ -6,15 +6,11 @@ let container: StartedTestContainer | undefined;
|
||||||
|
|
||||||
export const startDatabase = async (): Promise<{ port: number; host: string }> => {
|
export const startDatabase = async (): Promise<{ port: number; host: string }> => {
|
||||||
if (process.env['CI']) {
|
if (process.env['CI']) {
|
||||||
const config = {
|
return {
|
||||||
port: process.env['MYSQL_PORT'] ? Number.parseInt(process.env['MYSQL_PORT'], 10) : 3306,
|
port: process.env['MYSQL_PORT'] ? Number.parseInt(process.env['MYSQL_PORT'], 10) : 3306,
|
||||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||||
host: process.env['MYSQL_HOST'] || 'localhost',
|
host: process.env['MYSQL_HOST'] || 'localhost',
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(`Connecting to MySQL from environment variables: ${JSON.stringify(config)}`);
|
|
||||||
|
|
||||||
return config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!container) {
|
if (!container) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue