Skip to content

Commit

Permalink
build: add Bun to ci matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
sidorares committed Jan 30, 2023
1 parent f9b64fb commit 8389bfe
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
54 changes: 54 additions & 0 deletions .github/workflows/ci-bun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI - Linux (bun)

# this will be merged with ci-linux.yml

on:
pull_request:
push:
branches: [ main ]

workflow_dispatch:

env:
MYSQL_PORT: 3306
MYSQL_USER: root
MYSQL_DATABASE: test

jobs:
tests-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
bun-version: [0.5.1]
mysql-version: ["mysql:5.7", "mysql:8.0.18", "mysql:8.0.22"]
use-compression: [0]
use-tls: [0]

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

steps:
- uses: actions/checkout@v3
- name: Set up MySQL
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 }}

- name: Set up Bun ${{ matrix.bun-version }}
uses: oven-sh/[email protected]
with:
bun-version: ${{ matrix.bun-version }}

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-

- name: Install npm dependencies
run: bun install
- name: Wait mysql server is ready
run: bun tools/wait-up.js

- name: Run tests
# todo: run full test suite once test createServer is implemented using Bun.listen
run: MYSQL_PORT=3306 MYSQL_USE_TLS=${{ matrix.use-tls }} MYSQL_USE_COMPRESSION=${{ matrix.use-compression }} bun test/integration/connection/test-select-1.js
1 change: 1 addition & 0 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class Connection extends EventEmitter {
if (opts.config.socketPath) {
this.stream = Net.connect(opts.config.socketPath);
} else {
console.log('connecting to', opts.config.host, opts.config.port, typeof opts.config.port);
this.stream = Net.connect(
opts.config.port,
opts.config.host
Expand Down
2 changes: 1 addition & 1 deletion test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ exports.config = config;
exports.waitDatabaseReady = function(callback) {
const start = Date.now();
const tryConnect = function() {
const conn = exports.createConnection({ database: 'mysql' });
const conn = exports.createConnection({ database: 'mysql', password: process.env.MYSQL_PASSWORD ?? '' });
conn.once('error', err => {
if (err.code !== 'PROTOCOL_CONNECTION_LOST' && err.code !== 'ETIMEDOUT') {
console.log('Unexpected error waiting for connection', err);
Expand Down

0 comments on commit 8389bfe

Please sign in to comment.