-
Notifications
You must be signed in to change notification settings - Fork 1
208 lines (194 loc) · 12 KB
/
main.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
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push only. ToDo: handle pull requests for testing only
on:
push:
branches: '**'
tags: 'v*'
pull_request:
branches: '**'
workflow_dispatch:
workflow_run:
workflows: [Build]
types: [completed]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Deploy the local and remote versions of geppetto-vfb
deploy-test:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# total job timeout:
timeout-minutes: 590
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# Decide based on branch which servers to use
- name: Pass branch
id: branch
run: echo "::set-output name=value::$(echo ${GITHUB_REF} | sed 's@refs/heads/@@g' | sed 's@refs/tags/@@g' )";
echo "::set-output name=clean::$(echo ${GITHUB_REF} | sed 's@refs/heads/@@g' | sed 's@refs/tags/@@g' | sed 's@[/\\]@-@g')";
- name: Setup local servers
id: local-servers
shell: bash
run: if [ "${GITHUB_REF#refs/heads/}" == master ] || [[ "${GITHUB_REF#refs/heads/}" == v* ]]; then
echo "::debug::Set to master setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb:7474";
echo "::set-output name=VFB_OWL_SERVER::http://owl:8080/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://ocpu:80/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb.v4.virtualflybrain.org";
echo "::set-output name=SOLR_SERVER::https://solr.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::release";
elif [ "${GITHUB_REF#refs/heads/}" == debug ] || [ "${GITHUB_REF#refs/heads/}" == pipeline2 ] || [ "${GITHUB_REF#refs/heads/}" == vfb_geppetto_application ] || [ "${GITHUB_REF#refs/heads/}" == development ] || [[ "${GITHUB_REF#refs/heads/}" == f* ]]; then
echo "::debug::Set to dev setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb:7474";
echo "::set-output name=VFB_OWL_SERVER::http://owl:8080/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://ocpu:80/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb-dev.virtualflybrain.org";
echo "::set-output name=SOLR_SERVER::https://solr-dev.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::development";
elif [ "${GITHUB_REF#refs/heads/}" == alpha ] ; then
echo "::debug::Set to alpha setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb:7474";
echo "::set-output name=VFB_OWL_SERVER::http://owl:8080/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://ocpu:80/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb-alpha.virtualflybrain.org";
echo "::set-output name=SOLR_SERVER::https://solr-alpha.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::staging";
else
echo "::debug::Set to default setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb:7474";
echo "::set-output name=VFB_OWL_SERVER::http://owl:8080/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://ocpu:80/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb.v4.virtualflybrain.org";
echo "::set-output name=SOLR_SERVER::https://solr.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::release";
fi
- name: Setup remote servers
id: remote-servers
shell: bash
run: if [ "${GITHUB_REF#refs/heads/}" == master ] || [[ "${GITHUB_REF#refs/heads/}" == v* ]]; then
echo "::debug::Set to master setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb.v4.virtualflybrain.org";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb.v4.virtualflybrain.org";
echo "::set-output name=VFB_OWL_SERVER::http://owl.virtualflybrain.org/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=SOLR_SERVER::https://solr.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::release";
elif [ "${GITHUB_REF#refs/heads/}" == debug ] || [ "${GITHUB_REF#refs/heads/}" == pipeline2 ] || [ "${GITHUB_REF#refs/heads/}" == vfb_geppetto_application ] || [ "${GITHUB_REF#refs/heads/}" == development ] || [[ "${GITHUB_REF#refs/heads/}" == f* ]]; then
echo "::debug::Set to dev setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb-dev.virtualflybrain.org";
echo "::set-output name=VFB_OWL_SERVER::http://owl-dev.virtualflybrain.org/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb-dev.virtualflybrain.org";
echo "::set-output name=SOLR_SERVER::https://solr-dev.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::release";
elif [ "${GITHUB_REF#refs/heads/}" == alpha ] ; then
echo "::debug::Set to alpha setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb-alpha.virtualflybrain.org";
echo "::set-output name=VFB_OWL_SERVER::http://owl-alpha.virtualflybrain.org/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb-alpha.virtualflybrain.org";
echo "::set-output name=SOLR_SERVER::https://solr-alpha.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::release";
else
echo "::debug::Set to default setup";
echo "::set-output name=VFB_PDB_SERVER::http://pdb.v4.virtualflybrain.org";
echo "::set-output name=VFB_OWL_SERVER::http://owl.virtualflybrain.org/kbs/vfb/";
echo "::set-output name=VFB_R_SERVER::http://r.virtualflybrain.org/ocpu/library/vfbr/R/vfb_nblast";
echo "::set-output name=VFB_TREE_PDB_SERVER::https://pdb.v4.virtualflybrain.org";
echo "::set-output name=SOLR_SERVER::https://solr.virtualflybrain.org/solr/ontology/select";
echo "::set-output name=BUILD_TYPE::release";
fi
# Output the chosen servers
- name: Used remote servers
run: |
echo PDB:${{ steps.remote-servers.outputs.VFB_PDB_SERVER }}
echo OWL:${{ steps.remote-servers.outputs.VFB_OWL_SERVER }}
echo SOLR:${{ steps.remote-servers.outputs.SOLR_SERVER }}
echo TREE_PDB:${{ steps.remote-servers.outputs.VFB_TREE_PDB_SERVER }}
echo R:${{ steps.remote-servers.outputs.VFB_R_SERVER }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push local wss
id: docker_build_local
timeout-minutes: 290
uses: docker/build-push-action@v2
with:
push: true
tags: "virtualflybrain/geppetto-vfb:${{ steps.branch.outputs.clean }}-local.wss"
build-args: |
VFB_TREE_PDB_SERVER_ARG=${{ steps.local-servers.outputs.VFB_TREE_PDB_SERVER }}
SOLR_SERVER_ARG=${{ steps.local-servers.outputs.SOLR_SERVER }}
VFB_R_SERVER_ARG=${{ steps.local-servers.outputs.VFB_R_SERVER }}
VFB_OWL_SERVER_ARG=${{ steps.local-servers.outputs.VFB_OWL_SERVER }}
VFB_PDB_SERVER_ARG=${{ steps.local-servers.outputs.VFB_PDB_SERVER }}
build_type=${{ steps.local-servers.outputs.BUILD_TYPE }}
targetBranch=${{ steps.branch.outputs.value }}
originBranch=${{ steps.branch.outputs.value }}
defaultBranch=development
finalBuild=true
- name: Build and push remote
id: docker_build_remote
timeout-minutes: 290
uses: docker/build-push-action@v2
with:
push: true
tags: "virtualflybrain/geppetto-vfb:${{ steps.branch.outputs.clean }}-remote"
build-args: |
VFB_TREE_PDB_SERVER_ARG=${{ steps.remote-servers.outputs.VFB_TREE_PDB_SERVER }}
SOLR_SERVER_ARG=${{ steps.remote-servers.outputs.SOLR_SERVER }}
VFB_R_SERVER_ARG=${{ steps.remote-servers.outputs.VFB_R_SERVER }}
VFB_OWL_SERVER_ARG=${{ steps.remote-servers.outputs.VFB_OWL_SERVER }}
VFB_PDB_SERVER_ARG=${{ steps.remote-servers.outputs.VFB_PDB_SERVER }}
build_type=${{ steps.remote-servers.outputs.BUILD_TYPE }}
targetBranch=${{ steps.branch.outputs.value }}
originBranch=${{ steps.branch.outputs.value }}
defaultBranch=development
finalBuild=false
- name: Image digest
run: |
echo "local:${{ steps.docker_build_local.outputs.digest }}"
echo "remote:${{ steps.docker_build_remote.outputs.digest }}"
- name: Install Puppeteer
run: npm install jest@24.8.0 jest-image-snapshot@4.1.0 puppeteer@1.17.0 jest-puppeteer@4.3.0 @babel/preset-env@7.4.5 url-join@4.0.0 @babel/core@7.4.5
- name: Start VFB server
run: docker run -t -dit --name=testServer -p 8080:8080 "virtualflybrain/geppetto-vfb:${{ steps.branch.outputs.clean}}-remote";
sleep 100;
docker logs testServer;
if [ $(docker logs testServer | grep "fixable with the " | wc -l) -gt 0 ]; then echo "Lint Error!"; exit 1; fi;
- name: Wait for VFB server to spin up
timeout-minutes: 290
run: |
export LANDING_PAGE="http://localhost:8080/org.geppetto.frontend/geppetto"
Test () { export http_status=$(curl -s -i $LANDING_PAGE | grep HTTP/1.1 | awk {'print $2'}); echo "Returned status \"$http_status\""; if [ "$http_status" != "200" ]; then echo "Waiting for docker to finish building..."; iterations=$((iterations+1)); if [ "$iterations" != "100" ]; then sleep 1; Test; fi; else echo "$(date) - connected successfully"; fi; }
Test;
- name: Test batch 1
run: npm test -- --verbose --colors --forceExit --testPathPattern='geppetto-vfb/tests/jest/vfb/batch1/.*js'
- name: Test batch 2
run: npm test -- --verbose --colors --forceExit --testPathPattern='geppetto-vfb/tests/jest/vfb/batch2/.*js'
- name: Test batch 3
run: npm test -- --verbose --colors --forceExit --testPathPattern='geppetto-vfb/tests/jest/vfb/batch3/.*js'
- name: Test under review
continue-on-error: true
run: |
if [ "${GITHUB_REF#refs/heads/}" == debug ] || [ "${GITHUB_REF#refs/heads/}" == pipeline2 ] || [ "${GITHUB_REF#refs/heads/}" == vfb_geppetto_application ] || [ "${GITHUB_REF#refs/heads/}" == development ] || [[ "${GITHUB_REF#refs/heads/}" =~ ^(fix|feature).* ]] ; then
npm test -- --verbose --colors --forceExit --testPathPattern='geppetto-vfb/tests/jest/vfb/review/.*js';
fi
- name: Stop VFB server
run: docker stop testServer
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: test_fails
path: |
tests/jest/vfb/snapshots/*/*/__diff_output__/*.png
tests/jest/vfb/snapshots/*/*/*.png
retention-days: 5