Skip to content

feat/v2

feat/v2 #36

Workflow file for this run

name: Build and Test
on:
pull_request:
branches:
- main
jobs:
build:
name: Run build with ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x, 20.x, 18.x]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Upload modules as artifact
uses: actions/upload-artifact@v4
with:
name: node_modules-${{ matrix.node-version }}
path: node_modules
lint:
name: Lint Code
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x, 20.x, 18.x]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Download modules from artifact
uses: actions/download-artifact@v4
with:
name: node_modules-${{ matrix.node-version }}
path: node_modules
- name: Lint
run: npm run lint
env:
CI: true
unit:
name: Run unit tests
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x, 20.x, 18.x]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Download modules from artifact
uses: actions/download-artifact@v4
with:
name: node_modules-${{ matrix.node-version }}
path: node_modules
- name: Test
run: npm run test:unit
env:
CI: true
integration:
name: Run integration tests with ${{ matrix.database-type }}
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
database-type:
[
mysql90,
mysql84,
mysql8,
mysql57,
mariadb1104,
mariadb1011,
mariadb1006,
mariadb1005,
mariadb1004,
]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 22.x
- name: Download modules from artifact
uses: actions/download-artifact@v4
with:
name: node_modules-22.x
path: node_modules
- name: Start Database(s)
run: |
docker-compose \
--file "docker-compose.yml" \
up \
--detach \
--build \
"${{ matrix.database-type }}"
- name: Initialize Database
run: |
docker-compose \
--file "docker-compose.yml" \
up \
"wait${{ matrix.database-type }}"
- name: Build and test
run: |
npm run test:integration:${{ matrix.database-type }}
env:
CI: true
- name: Stop Database(s)
run: |
docker-compose \
--file "docker-compose.yml" \
down