loopback-connector-mysql/.github/workflows/continuous-integration.yaml

76 lines
2.2 KiB
YAML

name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [12]
# node-version: [10, 12, 14, 15]
services:
mysql:
image: mysql:5.7.22
env:
MYSQL_USER: user
MYSQL_PASSWORD: pass
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: testdb
MYSQL_ROOT_PASSWORD: root
MYSQL_HOST: localhost
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 # -v /usr/bin/docker/mysql:/var/run/mysqld/mysqld.sock
steps:
# - name: Shutdown Ubuntu MySQL (SUDO)
# run: sudo service mysql stop
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
# - name: Set up MySQL 5.7
# uses: mirromutth/mysql-action@master
# with:
# host port: 3000
# mysql version: 5.7
# mysql database: testdb
# mysql root password: root
# mysql user: user
# mysql password: pass
# - name: Wait for MySQL
# run: |
# sudo service mysql start
# while ! mysqladmin ping --host=127.0.0.1 --port 3306 -uroot --password=root --silent; do
# sleep 1
# done
# sudo apt-get update
# sudo apt-get install -y mysql-client
# docker ps -a
# done
# docker container ls
# mysql -uroot -proot -e "show databases"
- name: npm install, build, and test
run: |
sudo ls /usr/bin/docker
docker ps -a
mysql -uroot -proot -e "show databases"
npm install
npm test
env:
DB_PORT: 3306
CI: true
# docker run -it -e MYSQL_ROOT_PASSWORD=root -v /var/run/mysqld/mysqld.sock:/host/mysqld/mysqld.sock -d mysql:5.7
# docker run -it -e MYSQL_ROOT_PASSWORD=root -v /var/run/mysqld:/host/mysqld -d mysql:5.7