Skip to content

Doing it the right way #226

Doing it the right way

Doing it the right way #226

Workflow file for this run

name: Tabroom API CI
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
CI: true
TZ: 'America/Chicago'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
NODE_ENV: 'test'
CODE_PATH: '/home/runner/work/indexcards/indexcards'
DB_USER: 'tabroom'
DB_PASS: 'tabroom'
HUSKY: 0
jobs:
build:
runs-on: ubuntu-latest
services:
mariadb-test:
image: mariadb:10.11.2
ports:
- '3306:3306'
env:
MARIADB_USER: tabroom
MARIADB_PASSWORD: tabroom
MARIADB_DATABASE: tabroom
MARIADB_ROOT_PASSWORD: tabroom
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- uses: actions/checkout@v4
- name: Shutdown Ubuntu MySQL
run: sudo service mysql stop
- name: Load local database
run: mysql -h 127.0.0.1 -P 3306 -u root -ptabroom tabroom < ./tests/test.sql
- name: Get node
uses: actions/setup-node@v1
with:
node-version: 18.17.1
- name: Install packages
run: npm install
- name: Copy config file
run: cp ./config/config.js.sample ./config/config.js
- name: Lint
run: npm run lint
- name: Tests
run: npm run test-ci
- name: If tests passed change icon
if: success()
run: echo "SLACK_ICON=:white_check_mark:" >> $GITHUB_ENV
- name: Send slack notification
if: always()
uses: speechanddebate/action-slack-notify@master