feat/v2 #35
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 node_modules cache | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: node-modules-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }} | |
- name: Upload code as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-${{ matrix.node-version }} | |
path: . | |
lint: | |
name: Lint Code | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download code from artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: code-22.x | |
path: . | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 22.x | |
- name: Lint | |
run: npm run lint | |
env: | |
CI: true | |
unit: | |
name: Run unit tests | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download code from artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: code-22.x | |
path: . | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 22.x | |
- 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: Download code from artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: code-22.x | |
path: . | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 22.x | |
- 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 |