2021-07-09 01:02:45 +00:00
|
|
|
name: Continous Integration
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [master]
|
|
|
|
pull_request:
|
|
|
|
# The branches below must be a subset of the branches above
|
|
|
|
branches: [master]
|
|
|
|
|
|
|
|
env:
|
|
|
|
CI: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2023-08-16 12:17:36 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2021-07-09 01:02:45 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
2023-06-18 18:04:31 +00:00
|
|
|
node-version: [16, 18, 20]
|
2021-07-09 01:02:45 +00:00
|
|
|
steps:
|
2023-09-04 14:40:56 +00:00
|
|
|
- uses: actions/checkout@v4
|
2021-07-09 01:02:45 +00:00
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
2022-12-11 16:39:10 +00:00
|
|
|
uses: actions/setup-node@v3
|
2021-07-09 01:02:45 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
- uses: ankane/setup-mysql@v1
|
|
|
|
with:
|
2023-06-18 18:04:31 +00:00
|
|
|
mysql-version: 8.0
|
2021-07-09 01:02:45 +00:00
|
|
|
- run: |
|
|
|
|
sudo mysql -e "CREATE USER '${{ secrets.MYSQL_USER }}'@'localhost' IDENTIFIED BY '${{ secrets.MYSQL_PASSWORD }}'"
|
|
|
|
sudo mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO '${{ secrets.MYSQL_USER }}'@'localhost'"
|
|
|
|
sudo mysql -u root -e "ALTER USER '${{ secrets.MYSQL_USER }}'@'localhost' IDENTIFIED WITH mysql_native_password by '${{ secrets.MYSQL_PASSWORD }}'"
|
|
|
|
sudo mysql -u root -e "FLUSH PRIVILEGES"
|
|
|
|
- run: npm install
|
|
|
|
- run: npm test
|
|
|
|
env:
|
2023-06-18 18:04:31 +00:00
|
|
|
MYSQL_HOST: '127.0.0.1'
|
2021-07-09 01:02:45 +00:00
|
|
|
MYSQL_USER: ${{ secrets.MYSQL_USER }}
|
|
|
|
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }}
|
|
|
|
CI: true
|
|
|
|
code-lint:
|
|
|
|
name: Code Lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 60
|
|
|
|
steps:
|
2023-09-04 14:40:56 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-06-18 18:04:31 +00:00
|
|
|
- name: Use Node.js 18
|
|
|
|
uses: actions/setup-node@v3
|
2021-07-09 01:02:45 +00:00
|
|
|
with:
|
2023-06-18 18:04:31 +00:00
|
|
|
node-version: 18
|
2021-07-09 01:02:45 +00:00
|
|
|
- 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:
|
2023-09-04 14:40:56 +00:00
|
|
|
- uses: actions/checkout@v4
|
2021-07-09 01:02:45 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-06-18 18:04:31 +00:00
|
|
|
- name: Use Node.js 18
|
|
|
|
uses: actions/setup-node@v3
|
2021-07-09 01:02:45 +00:00
|
|
|
with:
|
2023-06-18 18:04:31 +00:00
|
|
|
node-version: 18
|
2021-07-09 01:02:45 +00:00
|
|
|
- name: Bootstrap project
|
|
|
|
run: |
|
|
|
|
npm ci --ignore-scripts
|
|
|
|
- name: Verify commit linting
|
|
|
|
run: npx commitlint --from origin/master --to HEAD --verbose
|