forked from ledgersmb/LedgerSMB
-
Notifications
You must be signed in to change notification settings - Fork 0
269 lines (226 loc) · 8.1 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches-ignore:
- 'master'
paths-ignore:
- '.circleci'
pull_request:
branches:
- '*'
paths-ignore:
- '.circleci'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
webpack:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v3.1.0
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0
node-version: '16'
- name: Cache node modules
id: cache-node_modules
uses: actions/cache@v3
with:
path: ~/.npm
key: |
modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.cache.outputs.cache-node_modules != 'true'
run: npm ci --ignore-scripts
- name: Cache Dojo
id: cache-dojo
uses: actions/cache@v3
with:
path: UI/js
key: dojo-${{ hashFiles('UI/{js-src,css}/**','UI/**/*.html') }}
- name: Build Dojo
run: npm run build
if: steps.cache-dojo.outputs.cache-hit != 'true' ||
steps.cache-node_modules.outputs.cache-hit != 'true'
- name: 'Tar files'
run: tar -cf ~/webpacked_js.tar UI/js
- uses: actions/upload-artifact@v3
with:
name: webpacked_js
path: ~/webpacked_js.tar
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: webpack
# Don't let it run for more than an hour
timeout-minutes: 60
# Service containers to run
strategy:
fail-fast: false
matrix:
include:
- perl: "5.32"
BROWSER: "chrome"
COVERAGE: 1
- perl: "5.30"
BROWSER: "firefox"
COA_TESTING: 1
- perl: "5.28"
BROWSER: "operablink"
DB_TESTING: 1
services:
# Label used to access the service container
postgres:
# Docker database image
image: ledgersmbdev/ledgersmb-dev-postgres
# Maps tcp port 5432 on service container to the host
ports:
- 5432:5432
# Provide the password for postgres
env:
POSTGRES_PASSWORD: test
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
BROWSER: ${{ matrix.BROWSER }}
COA_TESTING: ${{ matrix.COA_TESTING }}
DB_TESTING: ${{ matrix.DB_TESTING }}
DEVEL_COVER_OPTIONS: -silent,1,+ignore,(^x?t/|^local/|^utils/|\.lttc$|^/usr/|^/opt/|starman\$\$),-summary,1
JOB_COUNT: 5
LSMB_BASE_URL: http://lsmb:5000
LSMB_NEW_DB: lsmb_test
MONITOR_FILE: cpu-memory-usage
PGDB: lsmb_test
PGHOST: localhost
PGPASSWORD: test
PGPORT: 5432
PGUSER: postgres
PSGI_BASE_URL: http://lsmb:5762
RELEASE_TESTING: 1
REMOTE_SERVER_ADDR: 127.0.0.1
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- name: Install TinyTex
uses: r-lib/actions/setup-tinytex@v2
- name: Install missing TeX packages
run: |
tlmgr update --self
tlmgr install koma-script
- name: Set host alias (why doesn't Github do it itself)
run: |
hostname -i | awk '{printf("%s lsmb\n",$1)}' | sudo tee -a /etc/hosts
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v3.1.0
- name: Create logging directories
run: |
mkdir screens logs
cp doc/conf/ledgersmb.conf.default ledgersmb.conf
- name: Setup Perl environment
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: ${{ matrix.perl }}
install-modules-with: cpm
install-modules: |
Devel::Cover
Devel::Cover::Report::Coveralls
# Features and Devel modules
install-modules-args: >
--with-develop
--feature=starman
--feature=latex-pdf-ps
--feature=openoffice
--feature=xls
--feature=edi
- uses: actions/download-artifact@v3
with:
name: webpacked_js
- name: 'Untar Webpacked files'
run: tar -xf webpacked_js.tar
- name: Starting 'nginx'
run: |
nginx -c $GITHUB_WORKSPACE/doc/conf/webserver/nginx-github.conf \
-p $GITHUB_WORKSPACE &
# This will start a hub and JOB_COUNT matrix.
- name: Starting hub with ${{ matrix.BROWSER }}
run: |
docker-compose \
--file=utils/selenium/docker-compose.yml \
--file=utils/selenium/docker-compose-${{ matrix.BROWSER }}.yml \
up \
--detach \
--scale ${{ matrix.BROWSER }}=$JOB_COUNT \
- name: Setup coverage
run: |
echo "STARMAN_DEVEL_COVER_OPTIONS=-MDevel::Cover=${{ env.DEVEL_COVER_OPTIONS }}" >> $GITHUB_ENV
echo "YATH_DEVEL_COVER_OPTIONS=--cover=${{ env.DEVEL_COVER_OPTIONS }}" >> $GITHUB_ENV
echo "JOB_COUNT=2" >> $GITHUB_ENV
# Ugly patch to yath to quiet B::Deparse noise.
sudo cp -v utils/patch/Test2/Harness/Collector/JobDir.pm \
local/lib/perl5/Test2/Harness/Collector/JobDir.pm
if: ${{ matrix.COVERAGE }}
- name: Starting 'starman'
run: |
PERL5OPT="$PERL5OPT $STARMAN_DEVEL_COVER_OPTIONS" \
starman --preload-app --pid starman.pid --workers $JOB_COUNT \
--max-requests 5000 --error-log logs/starman-error.log \
-Ilib -Iold/lib --port 5762 bin/ledgersmb-server.psgi &
# Fix the condition to debug
- name: Setup upterm session
uses: lhotari/action-upterm@v1
if: ${{ matrix.BROWSER == 'chrome' && 0 }}
- name: Run Perl tests
run: |
make devtest TESTS='--no-progress --job-count 2 t xt'
env:
LSMB_TEST_DB: 1
COA_TESTING: ${{ matrix.COA_TESTING }}
COVERAGE: ${{ matrix.COVERAGE }}
DB_TESTING: ${{ matrix.DB_TESTING }}
if: ${{ !matrix.COVERAGE }}
- name: Run Coverage Perl tests
run: |
make devtest TESTS="--no-progress --job-count $JOB_COUNT \"--cover=${{ env.DEVEL_COVER_OPTIONS }}\" t xt"
env:
LSMB_TEST_DB: 1
COA_TESTING: ${{ matrix.COA_TESTING }}
COVERAGE: ${{ matrix.COVERAGE }}
DB_TESTING: ${{ matrix.DB_TESTING }}
if: ${{ matrix.COVERAGE }}
- name: Upload coverage data
run: |
unset PERL5OPT
cover -report coveralls
cover -report text > logs/coverage.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ matrix.COVERAGE && github.repository != 'ledgersmb/LedgerSMB'}}
- name: Collect docker logs
uses: jwalton/gh-docker-logs@v2
with:
dest: 'logs/docker-logs'
if: always()
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: logs-and-screens ${{ matrix.perl }} ${{ matrix.BROWSER }}
path: |
logs/**
screens/**
/tmp/nginx*.log
if: always()