.github/workflows/main.yml
name: main
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: mirromutth/mysql-action@v1.1
with:
mysql version: "8.0"
mysql database: "testdb"
mysql root password: "xxxxxxxxxx"
- uses: actions/setup-node@v1
with:
node-version: 12
- name: install task
run: |
echo 'Canada/Pacific' | sudo tee /etc/timezone
sudo dpkg-reconfigure --frontend noninteractive tzdata
sh env.sh local
docker-compose build
(cd ./nodejs/www && npm ci)
- name: test task
env:
MYSQL_ROOT_PASSWORD: xxxxxxxxxx
run: |
(cd ./nodejs/www && npm run testdb:create)
(cd ./nodejs/www && npm run coverage)
- uses: actions/setup-ruby@v1
- name: Send Webhook Notification
if: always()
env:
JOB_STATUS: ${{ job.status }}
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
HOOK_OS_NAME: ${{ runner.os }}
WORKFLOW_NAME: ${{ github.workflow }}
run: |
git clone https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
bash webhook/send.sh $JOB_STATUS $WEBHOOK_URL
shell: bash