69 lines
2.0 KiB
YAML
69 lines
2.0 KiB
YAML
name: Continous Integration
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
# The branches below must be a subset of the branches above
|
|
branches: [master]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-24.04
|
|
env:
|
|
MYSQL_HOST: '127.0.0.1'
|
|
MYSQL_USER: myUser
|
|
MYSQL_PASSWORD: myPass
|
|
strategy:
|
|
matrix:
|
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
node-version: [18, 20]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
- uses: ankane/setup-mysql@v1
|
|
with:
|
|
mysql-version: 8.0
|
|
- run: |
|
|
sudo mysql -e "CREATE USER '$MYSQL_USER'@'localhost' IDENTIFIED BY '$MYSQL_PASSWORD'"
|
|
sudo mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'localhost'"
|
|
sudo mysql -u root -e "ALTER USER '$MYSQL_USER'@'localhost' IDENTIFIED WITH mysql_native_password by '$MYSQL_PASSWORD'"
|
|
sudo mysql -u root -e "FLUSH PRIVILEGES"
|
|
- run: npm install
|
|
- run: npm test
|
|
code-lint:
|
|
name: Code Lint
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Use Node.js 18
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 18
|
|
- name: Bootstrap project
|
|
run: |
|
|
npm ci --ignore-scripts
|
|
- name: Verify code linting
|
|
run: npm run lint
|
|
|
|
commit-lint:
|
|
name: Commit Lint
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Use Node.js 18
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 18
|
|
- name: Bootstrap project
|
|
run: |
|
|
npm ci --ignore-scripts
|
|
- name: Verify commit linting
|
|
run: npx commitlint --from origin/master --to HEAD --verbose
|