forked from soketi/soketi
-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (125 loc) · 4.09 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: CI
on:
push:
branches:
- '*'
tags:
- '*'
paths-ignore:
- "**.md"
pull_request:
branches:
- '*'
jobs:
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node:
- 16.x
adapter:
- local
- redis
- cluster
- nats
app_manager:
- array
- mysql
- postgres
- dynamodb
include:
- adapter: local
rate_limiter: local
queue_driver: sync
cache_driver: memory
- adapter: local
rate_limiter: local
queue_driver: sqs
cache_driver: memory
- adapter: cluster
rate_limiter: cluster
queue_driver: sync
cache_driver: redis
- adapter: redis
rate_limiter: redis
queue_driver: redis
cache_driver: redis
- adapter: nats
rate_limiter: redis
queue_driver: sync
cache_driver: redis
name: Node.js ${{ matrix.node }} (adapter:${{ matrix.adapter }} manager:${{ matrix.app_manager }} ratelimiter:${{ matrix.rate_limiter }} queue:${{ matrix.queue_driver }})
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
name: Setup Node.js v${{ matrix.node }}
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: npm install
- name: Execute lint & build
run: |
npm run lint
npm run build
- name: Setup Redis
if: "matrix.adapter == 'redis' || matrix.adapter == 'cluster' || matrix.adapter == 'nats'"
run: docker run -p 6379:6379 redis:6-alpine &
# Setup MySQL with user `root`, password `root` and database `testing`
- name: Setup MySQL
if: "matrix.app_manager == 'mysql'"
run: |
sudo systemctl start mysql.service
mysql -e 'CREATE DATABASE testing;' -u root -proot
mysql -u root -proot --database=testing < tests/fixtures/mysql_schema.sql
# Setup PostgreSQL with user `testing`, password `testing` and database `testing`
- name: Setup PostgreSQL
if: "matrix.app_manager == 'postgres'"
run: |
sudo systemctl start postgresql.service
pg_isready
sudo -u postgres psql --command="CREATE USER testing PASSWORD 'testing'"
sudo -u postgres createdb --owner=postgres testing
psql --host=127.0.0.1 --username=testing testing < tests/fixtures/postgres_schema.sql
env:
PGPASSWORD: testing
- name: Setup DynamoDB
if: "matrix.app_manager == 'dynamodb'"
run: |
docker run -p 8000:8000 amazon/dynamodb-local:1.22.0 &
node tests/fixtures/dynamodb_schema.js
env:
AWS_ACCESS_KEY_ID: fake-id
AWS_SECRET_ACCESS_KEY: fake-secret
- name: Setup Localstack
if: "matrix.queue_driver == 'sqs'"
run: |
docker-compose up -d localstack
docker-compose run initialize_sqs
- name: Setup NATS
if: "matrix.adapter == 'nats'"
run: |
docker run -d \
-p 4222:4222 \
-p 6222:6222 \
-p 8222:8222 \
nats --jetstream --user="" --pass=""
- name: Execute tests
run: npm run test
env:
RETRY_TIMES: 2
TEST_ADAPTER: ${{ matrix.adapter }}
TEST_APP_MANAGER: ${{ matrix.app_manager }}
TEST_CACHE_DRIVER: ${{ matrix.cache_driver }}
TEST_QUEUE_DRIVER: ${{ matrix.queue_driver }}
TEST_RATE_LIMITER: ${{ matrix.rate_limiter }}
TEST_MYSQL_USER: root
TEST_MYSQL_PASSWORD: root
TEST_SQS_URL: http://localhost:4566/000000000000/test.fifo
AWS_ACCESS_KEY_ID: fake-id
AWS_SECRET_ACCESS_KEY: fake-secret
- uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false