cleanup. fix tests #563
Workflow file for this run
This file contains 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: Build and Test | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- '**' | |
jobs: | |
test-service-container-build: | |
name: Build and Test PowerSync Service | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Test Build Docker Image | |
uses: docker/build-push-action@v5 | |
with: | |
cache-from: type=registry,ref=stevenontong/${{vars.DOCKER_REGISTRY}}:cache | |
context: . | |
platforms: linux/amd64 | |
push: false | |
file: ./service/Dockerfile | |
run-core-tests: | |
name: Core Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: '6.0' | |
mongodb-replica-set: test-rs | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
shell: bash | |
run: pnpm build | |
- name: Test | |
run: pnpm test --filter '!./modules/*' | |
run-postgres-tests: | |
name: Postgres Test | |
runs-on: ubuntu-latest | |
needs: run-core-tests | |
strategy: | |
fail-fast: false | |
matrix: | |
postgres-version: [11, 12, 13, 14, 15, 16] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Start PostgreSQL | |
run: | | |
docker run \ | |
--health-cmd pg_isready \ | |
--health-interval 10s \ | |
--health-timeout 5s \ | |
--health-retries 5 \ | |
-e POSTGRES_PASSWORD=postgres \ | |
-e POSTGRES_DB=powersync_test \ | |
-p 5432:5432 \ | |
-d postgres:${{ matrix.postgres-version }} \ | |
-c wal_level=logical | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: '6.0' | |
mongodb-replica-set: test-rs | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
shell: bash | |
run: pnpm build | |
- name: Test | |
run: pnpm test --filter='./modules/module-postgres' | |
run-mysql-tests: | |
name: MySQL Test | |
runs-on: ubuntu-latest | |
needs: run-core-tests | |
strategy: | |
fail-fast: false | |
matrix: | |
mysql-version: [5.7, 8.0, 8.4] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Start MySQL | |
run: | | |
docker run \ | |
--name MySQLTestDatabase \ | |
-e MYSQL_ROOT_PASSWORD=mypassword \ | |
-e MYSQL_DATABASE=mydatabase \ | |
-p 3306:3306 \ | |
-d mysql:${{ matrix.mysql-version }} \ | |
--log-bin=/var/lib/mysql/mysql-bin.log \ | |
--gtid_mode=ON \ | |
--enforce_gtid_consistency=ON \ | |
--server-id=1 | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: '6.0' | |
mongodb-replica-set: test-rs | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
shell: bash | |
run: pnpm build | |
- name: Test | |
run: pnpm test --filter='./modules/module-mysql' | |
run-mongodb-tests: | |
name: MongoDB Test | |
runs-on: ubuntu-latest | |
needs: run-core-tests | |
strategy: | |
fail-fast: false | |
matrix: | |
mongodb-version: ['6.0', '7.0', '8.0'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: ${{ matrix.mongodb-version }} | |
mongodb-replica-set: test-rs | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
shell: bash | |
run: pnpm build | |
- name: Test | |
run: pnpm test --filter='./modules/module-mongodb' |