wildduck/.github/workflows/test.yml

53 lines
1.8 KiB
YAML
Raw Normal View History

2022-07-05 17:04:18 +08:00
name: Run tests
on:
push:
pull_request:
jobs:
2022-07-05 17:20:35 +08:00
test:
strategy:
matrix:
node: [16.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
2022-07-05 17:18:29 +08:00
# 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
2022-07-05 17:34:10 +08:00
ports:
- 6379:6379
2022-07-05 17:04:18 +08:00
steps:
2022-07-05 17:20:35 +08:00
- uses: actions/checkout@v2
2022-07-05 17:55:09 +08:00
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.7.0
with:
mongodb-version: 4.4
mongodb-port: 27017
mongodb-db: wildduck-test
2022-07-05 17:04:18 +08:00
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
2022-11-24 22:15:39 +08:00
- run: sudo apt-get install gnupg
- run: wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
- run: echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu/dists/jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
- run: sudo apt-get update
- run: sudo apt-get install -y mongocli
2022-07-05 17:04:18 +08:00
- run: npm install
2022-07-05 17:18:29 +08:00
- name: Run tests
2022-07-05 17:27:00 +08:00
run: npm run runtest
2022-07-05 17:18:29 +08:00
env:
2022-07-05 17:30:02 +08:00
APPCONF_dbs_redis: redis://127.0.0.1:6379/1
2022-07-05 17:55:09 +08:00
APPCONF_dbs_mongodb: 'mongodb://127.0.0.1:27017/wildduck-test?authSource=admin'