|
| 1 | +name: CI - Linux |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: [ main ] |
| 7 | + |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + MYSQL_PORT: 3306 |
| 12 | + MYSQL_USER: root |
| 13 | + MYSQL_DATABASE: test |
| 14 | + |
| 15 | +jobs: |
| 16 | + tests-linux: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + node-version: [18.x, 20.x, 21.x] |
| 22 | + mysql-version: ["mysql:8.0.33"] |
| 23 | + use-compression: [0, 1] |
| 24 | + use-tls: [0, 1] |
| 25 | + mysql_connection_url_key: [""] |
| 26 | + # TODO - add mariadb to the matrix. currently few tests are broken due to mariadb incompatibilities |
| 27 | + env: |
| 28 | + MYSQL_CONNECTION_URL: ${{ secrets[matrix.mysql_connection_url_key] }} |
| 29 | + |
| 30 | + name: Node.js ${{ matrix.node-version }} - DB ${{ matrix.mysql-version }}${{ matrix.mysql_connection_url_key }} - SSL=${{matrix.use-tls}} Compression=${{matrix.use-compression}} |
| 31 | + |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Set up MySQL |
| 36 | + if: ${{ matrix.mysql-version }} |
| 37 | + run: docker run -d -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -e MYSQL_DATABASE=${{ env.MYSQL_DATABASE }} -v $PWD/mysqldata:/var/lib/mysql/ -v $PWD/test/fixtures/custom-conf:/etc/mysql/conf.d -v $PWD/test/fixtures/ssl/certs:/certs -p ${{ env.MYSQL_PORT }}:3306 ${{ matrix.mysql-version }} |
| 38 | + |
| 39 | + - name: Set up Node.js ${{ matrix.node-version }} |
| 40 | + uses: actions/setup-node@v4 |
| 41 | + with: |
| 42 | + node-version: ${{ matrix.node-version }} |
| 43 | + |
| 44 | + - name: Cache dependencies |
| 45 | + uses: actions/cache@v4 |
| 46 | + with: |
| 47 | + path: ~/.npm |
| 48 | + key: npm-linux-${{ hashFiles('package-lock.json') }} |
| 49 | + restore-keys: npm-linux- |
| 50 | + |
| 51 | + - name: Install npm dependencies |
| 52 | + run: npm ci |
| 53 | + |
| 54 | + - name: Wait mysql server is ready |
| 55 | + if: ${{ matrix.mysql-version }} |
| 56 | + run: node tools/wait-up.js |
| 57 | + |
| 58 | + - name: Run tests |
| 59 | + run: FILTER=${{matrix.filter}} MYSQL_USE_TLS=${{ matrix.use-tls }} MYSQL_USE_COMPRESSION=${{ matrix.use-compression }} npm run test |
| 60 | + |
| 61 | + tests-linux-bun: |
| 62 | + runs-on: ubuntu-latest |
| 63 | + strategy: |
| 64 | + fail-fast: false |
| 65 | + matrix: |
| 66 | + bun-version: [latest, canary] |
| 67 | + mysql-version: ["mysql:8.0.33"] |
| 68 | + use-compression: [0, 1] |
| 69 | + use-tls: [0,1] |
| 70 | + |
| 71 | + name: Bun ${{ matrix.bun-version }} - DB ${{ matrix.mysql-version }} - SSL=${{matrix.use-tls}} Compression=${{matrix.use-compression}} |
| 72 | + |
| 73 | + steps: |
| 74 | + - uses: actions/checkout@v4 |
| 75 | + - name: Set up MySQL |
| 76 | + run: docker run -d -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -e MYSQL_DATABASE=${{ env.MYSQL_DATABASE }} -v $PWD/mysqldata:/var/lib/mysql/ -v $PWD/test/fixtures/custom-conf:/etc/mysql/conf.d -v $PWD/test/fixtures/ssl/certs:/certs -p ${{ env.MYSQL_PORT }}:3306 ${{ matrix.mysql-version }} |
| 77 | + |
| 78 | + - name: Set up Bun ${{ matrix.bun-version }} |
| 79 | + uses: oven-sh/setup-bun@v1 |
| 80 | + with: |
| 81 | + bun-version: ${{ matrix.bun-version }} |
| 82 | + |
| 83 | + - name: Set up Node.js |
| 84 | + uses: actions/setup-node@v4 |
| 85 | + with: |
| 86 | + node-version: 20 |
| 87 | + - name: Cache dependencies |
| 88 | + uses: actions/cache@v4 |
| 89 | + with: |
| 90 | + path: ~/.npm |
| 91 | + key: npm-linux-${{ hashFiles('package-lock.json') }} |
| 92 | + restore-keys: npm-linux- |
| 93 | + |
| 94 | + - name: Install npm dependencies |
| 95 | + run: npm ci |
| 96 | + |
| 97 | + - name: Wait mysql server is ready |
| 98 | + run: node tools/wait-up.js |
| 99 | + |
| 100 | + # todo: run full test suite once test createServer is implemented using Bun.listen |
| 101 | + - name: run tests |
| 102 | + env: |
| 103 | + MYSQL_USER: ${{ env.MYSQL_USER }} |
| 104 | + MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }} |
| 105 | + MYSQL_PORT: ${{ env.MYSQL_PORT }} |
| 106 | + MYSQL_USE_COMPRESSION: ${{ matrix.use-compression }} |
| 107 | + MYSQL_USE_TLS: ${{ matrix.use-tls }} |
| 108 | + FILTER: test-select-1|test-select-ssl |
| 109 | + run: bun run test:bun |
| 110 | + timeout-minutes: 1 |
0 commit comments