-
Notifications
You must be signed in to change notification settings - Fork 577
131 lines (122 loc) · 3.82 KB
/
nodejs.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
name: Node.js CI
on:
push:
branches: [main]
paths-ignore:
- 'site/**'
- '*.md'
pull_request:
paths-ignore:
- 'site/**'
- '*.md'
jobs:
build:
timeout-minutes: 60
strategy:
matrix:
node-version: [16, 18, 'lts/*']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
rabbitmq:
image: rabbitmq:latest
ports:
- 5672/tcp
options: --health-cmd "rabbitmqctl node_health_check" --health-interval 10s --health-timeout 5s --health-retries 5
zookeeper:
image: wurstmeister/zookeeper
ports:
- 2181:2181
env:
ALLOW_ANONYMOUS_LOGIN: yes
options: >-
--health-cmd "echo mntr | nc -w 2 -q 2 localhost 2181"
--health-interval 10s
--health-timeout 5s
--health-retries 5
kafka:
image: wurstmeister/kafka
ports:
- 9092:9092
options: >-
--health-cmd "kafka-broker-api-versions.sh --version"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092 ## 修改:宿主机IP
KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
KAFKA_ADVERTISED_PORT: 9092
# postgres:
# image: postgres:alpine
# ports:
# - 5432:5432
# env:
# POSTGRES_DB: db_ci_test
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: postgres
# # needed because the postgres container does not provide a healthcheck
# options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
etcd:
image: bitnami/etcd
options: >-
--name Etcd-server
--publish 2379:2379
--publish 2380:2380
--env ALLOW_NONE_AUTHENTICATION=yes
--env ETCD_ADVERTISE_CLIENT_URLS=http://etcd-server:2379
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: 4.2
- run: npm run install_npm
- run: npm install && npm install codecov
- run: npm run build --if-present
- run: npm run cov
env:
RABBITMQ_URL: amqp://localhost:${{ job.services.rabbitmq.ports[5672] }}
ALI_SDK_OSS_REGION: ${{ secrets.ALI_SDK_OSS_REGION }}
ALI_SDK_OSS_ENDPOINT: ${{ secrets.ALI_SDK_OSS_ENDPOINT }}
ALI_SDK_OSS_ID: ${{ secrets.ALI_SDK_OSS_ID }}
ALI_SDK_OSS_SECRET: ${{ secrets.ALI_SDK_OSS_SECRET }}
ALI_SDK_OSS_BUCKET: ${{ secrets.ALI_SDK_OSS_BUCKET }}
ALI_SDK_STS_ID: ${{ secrets.ALI_SDK_STS_ID }}
ALI_SDK_STS_SECRET: ${{ secrets.ALI_SDK_STS_SECRET }}
ALI_SDK_STS_BUCKET: ${{ secrets.ALI_SDK_STS_BUCKET }}
ALI_SDK_STS_ROLE: ${{ secrets.ALI_SDK_STS_ROLE }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
#
# build-windows:
# runs-on: windows-latest
#
# strategy:
# matrix:
# node-version: [12, 14.x]
#
# steps:
# - uses: actions/checkout@v2
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v1
# with:
# node-version: ${{ matrix.node-version }}
# - run: npm install
# - run: npm run build --if-present
# - run: npm run cov