new deploy scripts #1454
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: Tabroom API CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
env: | |
CI: true | |
TZ: 'America/Chicago' | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
NODE_ENV: 'test' | |
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@v3 | |
- name: Shutdown Ubuntu MySQL | |
run: sudo service mysql stop | |
# - name: Verify MariaDB connection | |
# env: | |
# PORT: ${{ job.services.mariadb.ports[3306] }} | |
# run: | | |
# while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do | |
# sleep 1 | |
# done | |
- name: Load local database | |
run: mysql -h 127.0.0.1 -P 3306 -u root -ptabroom tabroom < ./api/tests/tabroom.sql | |
# - name: Set up MariaDB | |
# uses: getong/[email protected] | |
# with: | |
# mariadb version: '10.11.2' | |
# mysql database: 'tabroom' | |
# mysql user: 'tabroom' | |
# mysql password: 'tabroom' | |
- name: Get node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18.2.0 | |
- name: Install packages | |
run: npm install | |
working-directory: ./api | |
- name: Copy config file | |
run: cp ./config/config.js.sample ./config/config.js | |
working-directory: ./api | |
- name: Lint | |
run: npm run lint | |
working-directory: ./api | |
- name: Tests | |
run: npm run test-ci | |
working-directory: ./api | |
- 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 |