Skip to content

Commit 8389bfe

Browse files
committed
build: add Bun to ci matrix
1 parent f9b64fb commit 8389bfe

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

.github/workflows/ci-bun.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CI - Linux (bun)
2+
3+
# this will be merged with ci-linux.yml
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches: [ main ]
9+
10+
workflow_dispatch:
11+
12+
env:
13+
MYSQL_PORT: 3306
14+
MYSQL_USER: root
15+
MYSQL_DATABASE: test
16+
17+
jobs:
18+
tests-linux:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
bun-version: [0.5.1]
24+
mysql-version: ["mysql:5.7", "mysql:8.0.18", "mysql:8.0.22"]
25+
use-compression: [0]
26+
use-tls: [0]
27+
28+
name: Bun ${{ matrix.bun-version }} - DB ${{ matrix.mysql-version }} - SSL=${{matrix.use-tls}} Compression=${{matrix.use-compression}}
29+
30+
steps:
31+
- uses: actions/checkout@v3
32+
- name: Set up MySQL
33+
run: docker run -d -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -e MYSQL_DATABASE=${{ env.MYSQL_DATABASE }} -v $PWD/mysqldata:/var/lib/mysql/ -v $PWD/examples/custom-conf:/etc/mysql/conf.d -v $PWD/examples/ssl/certs:/certs -p ${{ env.MYSQL_PORT }}:3306 ${{ matrix.mysql-version }}
34+
35+
- name: Set up Bun ${{ matrix.bun-version }}
36+
uses: oven-sh/[email protected]
37+
with:
38+
bun-version: ${{ matrix.bun-version }}
39+
40+
- name: Cache dependencies
41+
uses: actions/cache@v3
42+
with:
43+
path: ~/.npm
44+
key: npm-${{ hashFiles('package-lock.json') }}
45+
restore-keys: npm-
46+
47+
- name: Install npm dependencies
48+
run: bun install
49+
- name: Wait mysql server is ready
50+
run: bun tools/wait-up.js
51+
52+
- name: Run tests
53+
# todo: run full test suite once test createServer is implemented using Bun.listen
54+
run: MYSQL_PORT=3306 MYSQL_USE_TLS=${{ matrix.use-tls }} MYSQL_USE_COMPRESSION=${{ matrix.use-compression }} bun test/integration/connection/test-select-1.js

lib/connection.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class Connection extends EventEmitter {
4747
if (opts.config.socketPath) {
4848
this.stream = Net.connect(opts.config.socketPath);
4949
} else {
50+
console.log('connecting to', opts.config.host, opts.config.port, typeof opts.config.port);
5051
this.stream = Net.connect(
5152
opts.config.port,
5253
opts.config.host

test/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ exports.config = config;
3030
exports.waitDatabaseReady = function(callback) {
3131
const start = Date.now();
3232
const tryConnect = function() {
33-
const conn = exports.createConnection({ database: 'mysql' });
33+
const conn = exports.createConnection({ database: 'mysql', password: process.env.MYSQL_PASSWORD ?? '' });
3434
conn.once('error', err => {
3535
if (err.code !== 'PROTOCOL_CONNECTION_LOST' && err.code !== 'ETIMEDOUT') {
3636
console.log('Unexpected error waiting for connection', err);

0 commit comments

Comments
 (0)