-
Notifications
You must be signed in to change notification settings - Fork 3
171 lines (142 loc) · 5.1 KB
/
ci.yaml
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Node CI and Release
on:
push:
branches:
- '**'
tags:
- '*'
pull_request:
branches:
- '**'
jobs:
lint:
runs-on: ubuntu-20.04
env:
IS_CI_ENV: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Run linting checks
run: |
cd types && npm install --loglevel=error && npm run lint && cd ..
cd browse && npm install --loglevel=error @typescript-eslint/parser @typescript-eslint/eslint-plugin && npm run lint && cd ..
cd api && npm install --loglevel=error @typescript-eslint/parser @typescript-eslint/eslint-plugin github:TheCacophonyProject/apidoc-plugin-ts#v1.1.0 && npm run lint && cd ..
cd integration-tests && npm install --loglevel=error @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-cypress eslint-plugin-no-only-tests && npm run lint && cd ..
test-batch-1:
runs-on: ubuntu-20.04
services:
docker:
image: docker:19.03.12
options: --privileged
ports:
- 2375:2375
env:
DOCKER_TLS_CERTDIR: ""
env:
IS_CI_ENV: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/v2.21.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version # Verify installation
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Set up Docker environment
run: |
docker-compose build
docker-compose up --force-recreate &> dockerstart.log &
node ./api/waitForApi.js || { docker ps; docker-compose logs; exit 1; }
- name: Apply migration undo and redo to test undo migration
run: |
docker-compose exec server /app/api/node_modules/.bin/sequelize db:migrate:undo --config /app/api/config/app_test_default.js --migrations-path /app/api/migrations
docker-compose exec server /app/api/node_modules/.bin/sequelize db:migrate --config /app/api/config/app_test_default.js --migrations-path /app/api/migrations
- name: Run Cypress tests
run: |
cd integration-tests
npm install --loglevel=error
npm run ci-batch-1
test-batch-2:
runs-on: ubuntu-20.04
services:
docker:
image: docker:19.03.12
options: --privileged
ports:
- 2375:2375
env:
DOCKER_TLS_CERTDIR: ""
env:
IS_CI_ENV: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/v2.21.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version # Verify installation
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Set up Docker environment
run: |
docker-compose build
docker-compose up --force-recreate &> dockerstart.log &
node ./api/waitForApi.js || { docker ps; docker-compose logs; exit 1; }
- name: Run Cypress tests
run: |
cd integration-tests
npm install --loglevel=error
npm run ci-batch-2
build:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
env:
IS_CI_ENV: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install global npm packages
run: npm install -g --loglevel=error npm [email protected] eslint prettier
- name: Generate API docs
run: |
cd api
npm update --loglevel=error apidoc-plugin-ts
npm run apidoc
- name: Prepare for deployment
run: |
version=${GITHUB_REF#refs/tags/v}
mkdir /tmp/nfpm
curl -sL https://github.com/goreleaser/nfpm/releases/download/v0.9.5/nfpm_0.9.5_Linux_x86_64.tar.gz | tar -C /tmp/nfpm -xzf -
export PATH=/tmp/nfpm:$PATH
npm install -g json
_release/build.sh ${version}
- name: Upload release assets
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*.deb"
allowUpdates: true