2022-07-05 17:04:18 +08:00
|
|
|
name: Run tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
2022-07-05 17:18:29 +08:00
|
|
|
container-job:
|
|
|
|
# Containers must run in Linux based operating systems
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
# Docker Hub image that `container-job` executes in
|
|
|
|
container: node:10.18-jessie
|
|
|
|
|
|
|
|
# Service containers to run with `container-job`
|
|
|
|
services:
|
|
|
|
# Label used to access the service container
|
|
|
|
redis:
|
|
|
|
# Docker Hub image
|
|
|
|
image: redis
|
|
|
|
# Set health checks to wait until redis has started
|
|
|
|
options: >-
|
|
|
|
--health-cmd "redis-cli ping"
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
|
|
|
|
mongo:
|
|
|
|
image: mongo
|
|
|
|
env:
|
|
|
|
MONGO_INITDB_ROOT_USERNAME: wildduck
|
|
|
|
MONGO_INITDB_ROOT_PASSWORD: wildduck
|
|
|
|
MONGO_INITDB_DATABASE: wildduck-test
|
|
|
|
options: >-
|
|
|
|
--health-cmd mongo
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
ports:
|
|
|
|
- 27017:27017
|
2022-07-05 17:04:18 +08:00
|
|
|
test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
node: [16.x]
|
|
|
|
os: [ubuntu-latest]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
2022-07-05 17:18:29 +08:00
|
|
|
- uses: actions/checkout@v3
|
2022-07-05 17:04:18 +08:00
|
|
|
- name: Use Node.js ${{ matrix.node }}
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node }}
|
|
|
|
- run: npm install
|
2022-07-05 17:18:29 +08:00
|
|
|
- name: Run tests
|
|
|
|
run: npm test
|
|
|
|
env:
|
|
|
|
APPCONF_dbs_redis: redis://redis:6379/1
|
|
|
|
APPCONF_dbs_mongodb: mongodb://wildduck:wildduck@mongo:27017/wildduck-test
|
|
|
|
NODE_CONFIG_ONLY: 'true'
|