-
Notifications
You must be signed in to change notification settings - Fork 3
132 lines (113 loc) · 3.78 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
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@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Run linting checks
run: |
cd types && npm ci --loglevel=error && npm run lint && cd ..
cd browse && npm ci --loglevel=error && npm run lint && cd ..
cd api && npm ci --loglevel=error && npm run lint && cd ..
cd integration-tests && npm ci --loglevel=error && npm run lint && cd ..
test:
runs-on: ubuntu-20.04
strategy:
matrix:
batch: [ci-batch-1, ci-batch-2]
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@v4
- 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@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- 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
env:
BATCH: ${{ matrix.batch }}
run: |
cd integration-tests
npm ci --loglevel=error
npm run $BATCH
build:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
env:
IS_CI_ENV: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install global npm packages
run: npm install -g --loglevel=error npm json [email protected]
- 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
_release/build.sh ${version}
- name: Upload release assets
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*.deb"
allowUpdates: true