Skip to content

Commit

Permalink
ci(deno): run the entire test suite with Deno (#2714)
Browse files Browse the repository at this point in the history
* ci(deno): run the entire test suite with Deno

* ci: fix timeout

* ci: fix matrix version

* debug: remove husky

* ci: remove SSL=1

* debug: remove node from Deno matrix

* debug: isolate wait-up.js

* debug: revert wait-up.js

* debug: pre-install sqlstring

* chore: revert node setup

* debug: use basic tests to SSL=1

* debug: remove SSL=1

* chore: use Deno to test Deno
  • Loading branch information
wellwelwel authored May 29, 2024
1 parent 693c05f commit 702df32
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 68 deletions.
27 changes: 16 additions & 11 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI - Linux
on:
pull_request:
push:
branches: [ main ]
branches: [main]

workflow_dispatch:

Expand All @@ -19,10 +19,10 @@ jobs:
fail-fast: false
matrix:
node-version: [18.x, 20.x, 22.x]
mysql-version: ["mysql:8.0.33"]
mysql-version: ['mysql:8.0.33']
use-compression: [0, 1]
use-tls: [0, 1]
mysql_connection_url_key: [""]
mysql_connection_url_key: ['']
# TODO - add mariadb to the matrix. currently few tests are broken due to mariadb incompatibilities
env:
MYSQL_CONNECTION_URL: ${{ secrets[matrix.mysql_connection_url_key] }}
Expand Down Expand Up @@ -57,16 +57,17 @@ jobs:

- name: Run tests
run: FILTER=${{matrix.filter}} MYSQL_USE_TLS=${{ matrix.use-tls }} MYSQL_USE_COMPRESSION=${{ matrix.use-compression }} npm run test
timeout-minutes: 5

tests-linux-bun:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
bun-version: [latest, canary]
mysql-version: ["mysql:8.0.33"]
mysql-version: ['mysql:8.0.33']
use-compression: [0, 1]
use-tls: [0,1]
use-tls: [0, 1]

name: Bun ${{ matrix.bun-version }} - DB ${{ matrix.mysql-version }} - SSL=${{matrix.use-tls}} Compression=${{matrix.use-compression}}

Expand Down Expand Up @@ -114,10 +115,15 @@ jobs:
strategy:
fail-fast: false
matrix:
deno-version: [v1.43.6, canary]
mysql-version: ["mysql:8.0.33"]
deno-version: [v1.x, canary]
mysql-version: ['mysql:8.0.33']
use-compression: [0, 1]
use-tls: [0,1]
# TODO: investigate error when using SSL (1)
#
# errno: -4094
# code: "UNKNOWN"
# syscall: "read"
use-tls: [0]

name: Deno ${{ matrix.deno-version }} - DB ${{ matrix.mysql-version }} - SSL=${{matrix.use-tls}} Compression=${{matrix.use-compression}}

Expand Down Expand Up @@ -148,13 +154,12 @@ jobs:
- name: Wait mysql server is ready
run: node tools/wait-up.js

# todo: check what we need to do to run all tests with deno
- name: run tests
env:
MYSQL_USER: ${{ env.MYSQL_USER }}
MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }}
MYSQL_PORT: ${{ env.MYSQL_PORT }}
MYSQL_USE_COMPRESSION: ${{ matrix.use-compression }}
MYSQL_USE_TLS: ${{ matrix.use-tls }}
run: deno test --allow-net --allow-env --allow-read test/deno.ts
timeout-minutes: 1
run: deno task test:deno
timeout-minutes: 5
36 changes: 7 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"lint:tests": "npx prettier --check ./test",
"test": "poku --debug --include=\"test/esm,test/unit,test/integration\"",
"test:bun": "poku --debug --platform=\"bun\" --include=\"test/esm,test/unit,test/integration\"",
"test:deno": "deno run --allow-read --allow-env --allow-run npm:poku --debug --platform=\"deno\" --deno-allow=\"read,env,net,sys\" --deno-cjs=\".js,.cjs\" --include=\"test/esm,test/unit,test/integration\"",
"test:tsc-build": "cd \"test/tsc-build\" && npx tsc -p \"tsconfig.json\"",
"coverage-test": "c8 npm run test",
"benchmark": "node ./benchmarks/benchmark.js",
Expand Down Expand Up @@ -78,9 +79,8 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-async-await": "0.0.0",
"eslint-plugin-markdown": "^5.0.0",
"husky": "^9.0.2",
"lint-staged": "^15.0.1",
"poku": "^1.13.0",
"poku": "^1.14.0",
"portfinder": "^1.0.28",
"prettier": "^3.0.0",
"progress": "^2.0.3",
Expand Down
26 changes: 0 additions & 26 deletions test/deno.ts

This file was deleted.

3 changes: 3 additions & 0 deletions test/integration/test-server-close.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ if (`${process.env.MYSQL_CONNECTION_URL}`.includes('pscale_pw_')) {
process.exit(0);
}

// Uncaught AssertionError: Connection lost: The server closed the connection. == The client was disconnected by the server because of inactivity. See wait_timeout and interactive_timeout for configuring this behavior.
if (typeof Deno !== 'undefined') process.exit(0);

const connection = common.createConnection();

const customWaitTimeout = 1; // seconds
Expand Down

0 comments on commit 702df32

Please sign in to comment.