Skip to content

ci: align CI config #394

ci: align CI config

ci: align CI config #394

Workflow file for this run

name: Continous Integration
on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
permissions: {}
jobs:
build:
runs-on: ubuntu-22.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
- 21
steps:
- uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
cache: npm
node-version: ${{ matrix.node-version }}
- uses: ankane/setup-mysql@0066c6761a230df8a1ce7f26f3f434c7f3405ae7 # v1
with:
mysql-version: 8.0
- run: |
cat <<EOF | mysql
CREATE USER
'$MYSQL_USER'@'localhost'
IDENTIFIED BY '$MYSQL_PASSWORD';
GRANT ALL PRIVILEGES
ON *.*
TO '$MYSQL_USER'@'localhost';
ALTER USER
'$MYSQL_USER'@'localhost'
IDENTIFIED WITH mysql_native_password
BY '$MYSQL_PASSWORD';
FLUSH PRIVILEGES;
EOF
- run: |
npm ci \
--ignore-scripts \
--prefer-offline
- run: npm test --ignore-scripts
code-lint:
name: Code Lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Use Node.js 18
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
cache: npm
node-version: 18
- name: Bootstrap project
run: |
npm ci \
--ignore-scripts \
--prefer-offline
- name: Verify code linting
run: |
npm run \
--ignore-script \
lint
commit-lint:
name: Commit Lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Use Node.js 18
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
cache: npm
node-version: 18
- name: Bootstrap project
run: |
npm ci \
--ignore-scripts \
--prefer-offline
- name: Verify commit linting
run: |
npm exec \
--package=@commitlint/cli \
-- \
commitlint \
--from=origin/master \
--to=HEAD \
--verbose