-
Notifications
You must be signed in to change notification settings - Fork 3
756 lines (663 loc) · 34.2 KB
/
github_actions.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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
name: CI
on:
push:
branches:
- "**"
tags-ignore:
- "**"
jobs:
is-a-mark:
if: "contains(github.event.head_commit.message, ' - Set bwsbranch to')"
name: Check for mark
runs-on: ubuntu-latest
steps:
- name: Print commit message
run: |
echo "Commit Message:: ${{ github.event.head_commit.message }}"
has-ncip-version:
name: Has a matching NCIP server version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Export additional variables
id: extracted_variables
run: |
# Export VERSION as Koha major and minor e.g. 18.11, 20.05, etc.. TODO: Make this into a js based github action.
export FULL_VERSION="$(cat Koha.pm | grep '$VERSION =')" && export FULL_VERSION=${FULL_VERSION%\"*} && export FULL_VERSION=${FULL_VERSION##*\"} && echo $FULL_VERSION
IFS='.' read -ra VER_PARTS <<< "$FULL_VERSION"
KOHA_MAJOR=${VER_PARTS[0]}
KOHA_MINOR=${VER_PARTS[1]}
MAJOR_MINOR_VERSION="${KOHA_MAJOR}.${KOHA_MINOR}"
echo "MAJOR_MINOR_VERSION: $MAJOR_MINOR_VERSION"
echo ::set-output name=MAJOR_MINOR_VERSION::$MAJOR_MINOR_VERSION
- name: Check to see if there is a matching NCIP server tag on Docker Hub
run: |
curl --silent "https://registry.hub.docker.com/v2/repositories/bywater/koha-ncip-server/tags?page_size=1000" | jq -r ".results[].name" | sort --version-sort | grep "v${{ steps.extracted_variables.outputs.MAJOR_MINOR_VERSION }}-latest"
unit-test:
if: github.repository == 'bywatersolutions/bywater-koha' || github.repository == 'bywatersolutions/bywater-koha-future' || github.repository == 'bywatersolutions/bywater-koha-security'
name: Run unit tests
needs: [has-ncip-version]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Export additional variables needed by koha-testing-docker
run: |
export LOCAL_USER_ID="$(id -u)" # Needed for koha-testing-docker
KOHA_BRANCH=${GITHUB_REF##*/}
echo "BRANCH: $KOHA_BRANCH"
export SYNC_REPO=.
echo "LOCAL_USER_ID=$LOCAL_USER_ID" >> $GITHUB_ENV
echo "KOHA_BRANCH=$KOHA_BRANCH" >> $GITHUB_ENV
echo "SYNC_REPO=$SYNC_REPO" >> $GITHUB_ENV
echo "RUN_TESTS_AND_EXIT=yes" >> $GITHUB_ENV
echo "KOHA_IMAGE=23.05" >> $GITHUB_ENV
- name: Set up koha-testing-docker
run: |
sudo sysctl -w vm.max_map_count=262144
wget -O docker-compose.yml https://gitlab.com/koha-community/koha-testing-docker/raw/23.05/docker-compose.yml
mkdir -p env
wget -O env/defaults.env https://gitlab.com/koha-community/koha-testing-docker/raw/23.05/env/defaults.env
cp env/defaults.env .env
docker-compose pull
# - name: Setup Debug Session
# uses: csexton/debugger-action@master
- name: Run tests
run: |
docker-compose -f docker-compose.yml -p koha up --abort-on-container-exit --no-color
cat $GITHUB_WORKSPACE/testing.success
- name: Post test cleanup
run: |
docker-compose down
docker rm -f $(docker ps -a -f "name=koha_" -q)
docker volume prune -f
docker image prune -f
rm docker-compose.yml
rm -rf env .env
- uses: bywatersolutions/action-slack@v3
with:
status: ${{ job.status }}
fields: ref,workflow # selectable (default: repo,message)
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEVOPS_WEBHOOK }} # required
if: always() # Pick up events even if the job fails or is canceled.
release-notes: # This container checks out the branch on it's own, so no need for the GitHub checkout action
if: github.repository == 'bywatersolutions/bywater-koha' || github.repository == 'bywatersolutions/bywater-koha-security'
name: Build release notes
needs: [unit-test, is-a-mark]
runs-on: ubuntu-latest
steps:
- name: Export additional variables needed by bywater-koha-custom-rebaser
run: |
KOHA_BRANCH=${GITHUB_REF##*/}
echo "KOHA_BRANCH: $KOHA_BRANCH"
echo "KOHA_BRANCH=$KOHA_BRANCH" >> $GITHUB_ENV
- name: Run kylemhall/bywater-koha-release-notes-generator
run: |
echo "BRANCH: $KOHA_BRANCH"
docker run --env DEBUG=1 --env UPLOAD=1 --env GITHUB_TOKEN=${{ secrets.OUR_GITHUB_TOKEN }} --env KOHA_BRANCH=$KOHA_BRANCH quay.io/bywatersolutions/bywater-koha-release-notes-generator
release-notes-notify-general: # Message #general only for bywater releases
if: contains(github.ref, 'bywater-v')
name: Notify general channel about new release notes
needs: release-notes
runs-on: ubuntu-latest
steps:
- name: Export additional variables
id: extracted_variables
run: |
KOHA_BRANCH=${GITHUB_REF##*/}
echo "KOHA_BRANCH: $KOHA_BRANCH"
echo ::set-output name=KOHA_BRANCH::$KOHA_BRANCH
echo "KOHA_BRANCH=$KOHA_BRANCH" >> $GITHUB_ENV
- name: Notify Slack
run: |
curl -X POST -H 'Content-type: application/json' --data '{ "blocks": [{"type": "section","text": { "type": "mrkdwn","text": "@here, new release notes are here! https://github.com/bywatersolutions/bywater-koha-release-notes/blob/master/${{ steps.extracted_variables.outputs.KOHA_BRANCH }}.md"}}]}' ${{ secrets.SLACK_GENERAL_WEBHOOK }}
release-notes-notify-slack-channel: # Message #release-notes for all codebases
name: Notify release-notes channel about new release notes
needs: release-notes
runs-on: ubuntu-latest
steps:
- name: Export additional variables
id: extracted_variables
run: |
KOHA_BRANCH=${GITHUB_REF##*/}
echo "KOHA_BRANCH: $KOHA_BRANCH"
echo ::set-output name=KOHA_BRANCH::$KOHA_BRANCH
echo "KOHA_BRANCH=$KOHA_BRANCH" >> $GITHUB_ENV
- name: Notify Slack
run: |
curl -X POST -H 'Content-type: application/json' --data '{ "blocks": [{"type": "section","text": { "type": "mrkdwn","text": "@here, new release notes are here! https://github.com/bywatersolutions/bywater-koha-release-notes/blob/master/${{ steps.extracted_variables.outputs.KOHA_BRANCH }}.md"}}]}' ${{ secrets.SLACK_RELEASE_NOTES_WEBHOOK }}
auto-rebase:
if: startsWith( github.ref, 'refs/heads/bywater-v' ) && github.repository == 'bywatersolutions/bywater-koha'
name: Rebase custom codebases
needs: [unit-test, is-a-mark]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Export additional variables needed by bywater-koha-custom-rebaser
id: extracted_variables
run: |
KOHA_BRANCH=${GITHUB_REF##*/}
echo "KOHA_BRANCH: $KOHA_BRANCH"
echo ::set-output name=KOHA_BRANCH::$KOHA_BRANCH
export KOHACLONE="$(pwd)" # Needed for koha-testing-docker
echo "KOHACLONE: $KOHACLONE"
echo ::set-output name=KOHACLONE::$KOHACLONE
- name: Run kylemhall/bywater-koha-custom-rebaser
run: |
docker run --mount type=bind,source=${{ steps.extracted_variables.outputs.KOHACLONE }},target=/kohaclone -e DO_IT=1 -e GITHUB_TOKEN=$OUR_GITHUB_TOKEN -e KOHA_BRANCH=${{ steps.extracted_variables.outputs.KOHA_BRANCH }} quay.io/bywatersolutions/bywater-koha-custom-rebaser
env:
OUR_GITHUB_TOKEN: ${{ secrets.OUR_GITHUB_TOKEN }}
- uses: bywatersolutions/action-slack@v3
with:
status: ${{ job.status }}
fields: ref,workflow # selectable (default: repo,message)
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEVOPS_WEBHOOK }} # required
if: always() # Pick up events even if the job fails or is canceled.
build-debs:
if: github.repository == 'bywatersolutions/bywater-koha' || github.repository == 'bywatersolutions/bywater-koha-future' || github.repository == 'bywatersolutions/bywater-koha-security'
name: Build Debian packages
needs: [unit-test, is-a-mark]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Export additional variables
id: extracted_variables
run: |
# Export VERSION as Koha major and minor e.g. 18.11, 20.05, etc.. TODO: Make this into a js based github action.
export FULL_VERSION="$(cat Koha.pm | grep '$VERSION =')" && export FULL_VERSION=${FULL_VERSION%\"*} && export FULL_VERSION=${FULL_VERSION##*\"} && echo $FULL_VERSION
IFS='.' read -ra VER_PARTS <<< "$FULL_VERSION"
KOHA_MAJOR=${VER_PARTS[0]}
KOHA_MINOR=${VER_PARTS[1]}
MAJOR_MINOR_VERSION="${KOHA_MAJOR}.${KOHA_MINOR}"
echo "MAJOR_MINOR_VERSION: $MAJOR_MINOR_VERSION"
echo ::set-output name=MAJOR_MINOR_VERSION::$MAJOR_MINOR_VERSION
# Export kohaclone path
KOHACLONE="$(pwd)"
echo "KOHACLONE: $KOHACLONE"
echo ::set-output name=KOHACLONE::$KOHACLONE
# Export current branch name
KOHA_BRANCH=${GITHUB_REF##*/}
echo "KOHA_BRANCH: $KOHA_BRANCH"
echo ::set-output name=KOHA_BRANCH::$KOHA_BRANCH
# Split the branch name into parts ( e.g. bywater-v19.05.01-03 => "bywater", "v19.05.01", "03 )
IFS='-' read -ra BRANCH_PARTS <<< "$KOHA_BRANCH"
# Extract shortname branch name
SHORTNAME=${BRANCH_PARTS[0]}
echo "SHORTNAME: $SHORTNAME"
echo ::set-output name=SHORTNAME::$SHORTNAME
# Extract version without v
TMP_VERSION=${BRANCH_PARTS[1]}
MMM_VERSION=${TMP_VERSION:1} # Removes the first character i.e. 'v19.05.01' => '19.05.01'
echo "MMM_VERSION: $MMM_VERSION"
echo ::set-output name=MMM_VERSION::$MMM_VERSION
# Extract mark
MARK=${BRANCH_PARTS[2]}
echo "MARK: $MARK"
echo ::set-output name=MARK::$MARK
# Generate tag name
TAG_NAME="${SHORTNAME}_v${MMM_VERSION}-${MARK}"
echo "TAG NAME: $TAG_NAME"
echo ::set-output name="TAG_NAME::$TAG_NAME"
- name: Echo KOHA_BRANCH from previous step
run: echo "${{ steps.extracted_variables.outputs.KOHA_BRANCH }}"
- name: Create dir for debian packages
run: mkdir /tmp/debs
- name: Clean out old docker images, just in case
run: docker system prune -a
- name: Run koha-dpkg-docker
run: |
docker run --volume=${{ steps.extracted_variables.outputs.KOHACLONE }}:/koha --volume=/tmp/debs:/debs --privileged --env VERSION="${{ steps.extracted_variables.outputs.MMM_VERSION }}~${{ steps.extracted_variables.outputs.SHORTNAME }}~${{ steps.extracted_variables.outputs.MARK }}" --env RELEASE="${{ steps.extracted_variables.outputs.MAJOR_MINOR_VERSION }}" --env DEB_BUILD_OPTIONS="nocheck" koha/koha-dpkg:master
- name: List file in debs dir
run: ls -alh /tmp/debs
- name: Stash koha-common deb file name
id: find_koha_common
run: |
KOHA_COMMON_DEB=$(ls /tmp/debs | grep koha-common)
echo "KOHA COMMON DEB: $KOHA_COMMON_DEB"
echo ::set-output name=KOHA_COMMON_DEB::$KOHA_COMMON_DEB
- name: Create artifact zip
run: zip --junk-paths -r "/tmp/${{ steps.extracted_variables.outputs.KOHA_BRANCH }}.zip" /tmp/debs/*
- name: List contents of current directory, should contain artifacts zip
run: ls -alh
- name: Create Release
id: create_release
uses: bywatersolutions/github-action-create-release@master
env:
GITHUB_TOKEN: ${{ secrets.OUR_GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.extracted_variables.outputs.TAG_NAME }}
release_name: Release ${{ steps.extracted_variables.outputs.KOHA_BRANCH }}
target: ${{ steps.extracted_variables.outputs.KOHA_BRANCH }}
draft: false
prerelease: false
- name: Upload assets
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.extracted_variables.outputs.TAG_NAME }}
files: |
/tmp/${{ steps.extracted_variables.outputs.KOHA_BRANCH }}.zip
/tmp/debs/${{ steps.find_koha_common.outputs.KOHA_COMMON_DEB }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: bywatersolutions/action-slack@v3
with:
status: ${{ job.status }}
fields: ref,workflow # selectable (default: repo,message)
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEVOPS_WEBHOOK }} # required
if: always() # Pick up events even if the job fails or is canceled.
- uses: bywatersolutions/action-slack@v3
with:
status: ${{ job.status }}
fields: ref,workflow # selectable (default: repo,message)
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_KYLE_WEBHOOK }} # required
if: always() # Pick up events even if the job fails or is canceled.
- uses: bywatersolutions/action-slack@v3
with:
status: custom
fields: all
custom_payload: |
{
username: 'GitHub Koha Package Notifier',
icon_emoji: ':octocat:',
attachments: [{
color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning',
title: "New Koha Debian Package Ready!",
text: `The Koha Debian package for branch ${process.env.AS_REF} has been built and is ready to import into Aptly!`,
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_KYLE_WEBHOOK }}
- name: Sleep for 30 seconds
run: sleep 30s
shell: bash
- name: Notify package importer
run: curl --insecure "https://apt2.bywatersolutions.com/?tag=${{ steps.extracted_variables.outputs.TAG_NAME }}&t=${{ secrets.TOKEN }}"
shell: bash
build-docker:
#if: github.repository == 'bywatersolutions/bywater-koha' || github.repository == 'bywatersolutions/bywater-koha-futureNOT'
if: false
name: Build Docker image
needs: build-debs
runs-on: ubuntu-latest
steps:
- name: Git clone koha-docker
run: git clone https://gitlab.com/koha-community/docker/koha-docker.git --depth 1 --branch master
- name: Export additional variables
id: extracted_variables
run: |
# Export VERSION as Koha major and minor e.g. 18.11, 20.05, etc.. TODO: Make this into a js based github action.
# Export current branch name
KOHA_BRANCH=${GITHUB_REF##*/}
echo "KOHA_BRANCH: $KOHA_BRANCH"
echo ::set-output name=KOHA_BRANCH::$KOHA_BRANCH
IFS='-' read -ra VER_PARTS <<< "$KOHA_BRANCH"
TMP_KOHA_BRANCH=${VER_PARTS[1]}
IFS='.' read -ra VER_PARTS <<< "$TMP_KOHA_BRANCH"
KOHA_MAJOR_MINOR="${VER_PARTS[0]}.${VER_PARTS[1]}"
echo "KOHA_MAJOR_MINOR: $KOHA_MAJOR_MINOR"
echo ::set-output name=KOHA_MAJOR_MINOR::$KOHA_MAJOR_MINOR
# Split the branch name into parts ( e.g. bywater-v19.05.01-03 => "bywater", "v19.05.01", "03 )
IFS='-' read -ra BRANCH_PARTS <<< "$KOHA_BRANCH"
# Extract shortname branch name
SHORTNAME=${BRANCH_PARTS[0]}
echo "SHORTNAME: $SHORTNAME"
echo ::set-output name=SHORTNAME::$SHORTNAME
# Extract version without v
TMP_VERSION=${BRANCH_PARTS[1]}
MMM_VERSION=${TMP_VERSION:1} # Removes the first character i.e. 'v19.05.01' => '19.05.01'
echo "MMM_VERSION: $MMM_VERSION"
echo ::set-output name=MMM_VERSION::$MMM_VERSION
# Extract mark
MARK=${BRANCH_PARTS[2]}
echo "MARK: $MARK"
echo ::set-output name=MARK::$MARK
# Build the branch specific part of the download path
DOWNLOAD_PATH="${KOHA_BRANCH}/koha-common_${MMM_VERSION}.${SHORTNAME}.${MARK}-1_all.deb"
echo ::set-output name=DOWNLOAD_PATH::$DOWNLOAD_PATH
echo "DOWNLOAD PATH: $DOWNLOAD_PATH"
# Set the base path of the URL, TODO: needs to change for bywater-koha-future
BASE_URL="https://github.com/${{github.repository}}/releases/download/"
DEB_URL="${BASE_URL}${DOWNLOAD_PATH}"
echo "DEB_URL: $DEB_URL"
echo ::set-output name=DEB_URL::$DEB_URL
- name: Echo DEB_URL from previous step
run: echo "${{ steps.extracted_variables.outputs.DEB_URL }}"
- name: cd to koha-docker
run: cd koha-docker
- name: Current directory
run: pwd
- name: Show files
run: ls -alh
- name: Build the Docker image
run: cd koha-docker; docker build --tag quay.io/bywatersolutions/koha:${{ steps.extracted_variables.outputs.SHORTNAME }}-${{ steps.extracted_variables.outputs.KOHA_MAJOR_MINOR }}-latest --tag quay.io/bywatersolutions/koha:${{ steps.extracted_variables.outputs.KOHA_BRANCH }} --build-arg KOHA_COMMON_DEB_URL=${{ steps.extracted_variables.outputs.DEB_URL }} --build-arg KOHA_VERSION=23.05 .
- name: Log in to Docker Hub
env:
QUAY_USER: ${{secrets.QUAY_USER}}
QUAY_PASSWORD: ${{secrets.QUAY_PASSWORD}}
run: docker login quay.io -u $QUAY_USER -p $QUAY_PASSWORD
- name: Push to Quay.io
run: docker push quay.io/bywatersolutions/koha:${{ steps.extracted_variables.outputs.KOHA_BRANCH }}
- name: Push to Quay.io - tag 'latest'
run: docker push quay.io/bywatersolutions/koha:${{ steps.extracted_variables.outputs.SHORTNAME }}-${{ steps.extracted_variables.outputs.KOHA_MAJOR_MINOR }}-latest
set-default-branch:
name: Set default branch
if: startsWith( github.ref, 'refs/heads/bywater-v' ) && github.repository == 'bywatersolutions/bywater-koha'
needs: [unit-test, is-a-mark]
runs-on: ubuntu-latest
steps:
- run: |
KOHA_BRANCH=${GITHUB_REF##*/}
echo "KOHA_BRANCH: $KOHA_BRANCH";
gh repo edit bywatersolutions/bywater-koha --default-branch $KOHA_BRANCH
env:
GITHUB_TOKEN: ${{ secrets.OUR_GITHUB_TOKEN }}
BRANCH: ${GITHUB_REF##*/}
zap-scan-baseline-opac:
name: ZAP Scan - Baseline - OPAC
if: false
needs: unit-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Export additional variables needed by koha-testing-docker
run: |
export LOCAL_USER_ID="$(id -u)" # Needed for koha-testing-docker
KOHA_BRANCH=${GITHUB_REF##*/}
echo "BRANCH: $KOHA_BRANCH"
export SYNC_REPO=.
echo "LOCAL_USER_ID=$LOCAL_USER_ID" >> $GITHUB_ENV
echo "KOHA_BRANCH=$KOHA_BRANCH" >> $GITHUB_ENV
echo "SYNC_REPO=$SYNC_REPO" >> $GITHUB_ENV
echo "RUN_TESTS_AND_EXIT=yes" >> $GITHUB_ENV
echo "KOHA_IMAGE=23.05" >> $GITHUB_ENV
- name: Set up koha-testing-docker
run: |
sudo sysctl -w vm.max_map_count=262144
wget -O docker-compose.yml https://gitlab.com/koha-community/koha-testing-docker/raw/23.05/docker-compose.yml
mkdir -p env
wget -O env/defaults.env https://gitlab.com/koha-community/koha-testing-docker/raw/23.05/env/defaults.env
cp env/defaults.env .env
docker-compose pull
docker-compose -f docker-compose.yml -p koha up --detach
echo "SLEEPING 3 MINUTES"
sleep 60
echo "1 MINUTE DONE"
sleep 60
echo "2 MINUTES DONE"
sleep 60
echo "3 MINUTES DONE"
echo "WAKING UP"
echo "DOCKER LOGS"
docker logs koha_koha_1 2>&1
echo "/DOCKER LOGS"
# - name: Setup Debug Session
# uses: csexton/debugger-action@master
- name: List docker networks
run: |
docker network ls
- name: Scan opac interface
run: |
docker run --network koha_kohanet -t owasp/zap2docker-weekly zap-baseline.py -t http://koha:8080
- name: Post test cleanup
run: |
docker-compose down
docker rm -f $(docker ps -a -f "name=koha_" -q)
docker volume prune -f
docker image prune -f
rm docker-compose.yml
rm -rf env .env
- uses: bywatersolutions/action-slack@v3
with:
status: ${{ job.status }}
fields: ref,workflow # selectable (default: repo,message)
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEVOPS_WEBHOOK }} # required
if: always() # Pick up events even if the job fails or is canceled.
zap-scan-baseline-staff:
name: ZAP Scan - Baseline - Staff
if: false
needs: unit-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Export additional variables needed by koha-testing-docker
run: |
export LOCAL_USER_ID="$(id -u)" # Needed for koha-testing-docker
KOHA_BRANCH=${GITHUB_REF##*/}
echo "BRANCH: $KOHA_BRANCH"
export SYNC_REPO=.
echo "LOCAL_USER_ID=$LOCAL_USER_ID" >> $GITHUB_ENV
echo "KOHA_BRANCH=$KOHA_BRANCH" >> $GITHUB_ENV
echo "SYNC_REPO=$SYNC_REPO" >> $GITHUB_ENV
echo "RUN_TESTS_AND_EXIT=yes" >> $GITHUB_ENV
echo "KOHA_IMAGE=23.05" >> $GITHUB_ENV
- name: Set up koha-testing-docker
run: |
sudo sysctl -w vm.max_map_count=262144
wget -O docker-compose.yml https://gitlab.com/koha-community/koha-testing-docker/raw/23.05/docker-compose.yml
mkdir -p env
wget -O env/defaults.env https://gitlab.com/koha-community/koha-testing-docker/raw/23.05/env/defaults.env
cp env/defaults.env .env
docker-compose pull
docker-compose -f docker-compose.yml -p koha up --detach
echo "SLEEPING 3 MINUTES"
sleep 60
echo "1 MINUTE DONE"
sleep 60
echo "2 MINUTES DONE"
sleep 60
echo "3 MINUTES DONE"
echo "WAKING UP"
echo "DOCKER LOGS"
docker logs koha_koha_1 2>&1
echo "/DOCKER LOGS"
# - name: Setup Debug Session
# uses: csexton/debugger-action@master
- name: List docker networks
run: |
docker network ls
- name: Scan staff interface
run: |
docker run --network koha_kohanet -t owasp/zap2docker-weekly zap-baseline.py -t http://koha:8081
- name: Post test cleanup
run: |
docker-compose down
docker rm -f $(docker ps -a -f "name=koha_" -q)
docker volume prune -f
docker image prune -f
rm docker-compose.yml
rm -rf env .env
- uses: bywatersolutions/action-slack@v3
with:
status: ${{ job.status }}
fields: ref,workflow # selectable (default: repo,message)
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEVOPS_WEBHOOK }} # required
if: always() # Pick up events even if the job fails or is canceled.
zap-scan-full-staff:
name: ZAP Scan - Full - Staff
needs: zap-scan-baseline-staff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Export additional variables needed by koha-testing-docker
run: |
export LOCAL_USER_ID="$(id -u)" # Needed for koha-testing-docker
KOHA_BRANCH=${GITHUB_REF##*/}
echo "BRANCH: $KOHA_BRANCH"
export SYNC_REPO=.
echo "LOCAL_USER_ID=$LOCAL_USER_ID" >> $GITHUB_ENV
echo "KOHA_BRANCH=$KOHA_BRANCH" >> $GITHUB_ENV
echo "SYNC_REPO=$SYNC_REPO" >> $GITHUB_ENV
echo "RUN_TESTS_AND_EXIT=yes" >> $GITHUB_ENV
echo "KOHA_IMAGE=23.05" >> $GITHUB_ENV
- name: Set up koha-testing-docker
run: |
sudo sysctl -w vm.max_map_count=262144
wget -O docker-compose.yml https://gitlab.com/koha-community/koha-testing-docker/raw/23.05/docker-compose.yml
mkdir -p env
wget -O env/defaults.env https://gitlab.com/koha-community/koha-testing-docker/raw/23.05/env/defaults.env
cp env/defaults.env .env
docker-compose pull
docker-compose -f docker-compose.yml -p koha up --detach
echo "SLEEPING 3 MINUTES"
sleep 60
echo "1 MINUTE DONE"
sleep 60
echo "2 MINUTES DONE"
sleep 60
echo "3 MINUTES DONE"
echo "WAKING UP"
echo "DOCKER LOGS"
docker logs koha_koha_1 2>&1
echo "/DOCKER LOGS"
# - name: Setup Debug Session
# uses: csexton/debugger-action@master
- name: List docker networks
run: |
docker network ls
- name: Scan staff interface
run: |
docker run --network koha_kohanet -t owasp/zap2docker-weekly zap-full-scan.py -t http://koha:8081
- name: Post test cleanup
run: |
docker-compose down
docker rm -f $(docker ps -a -f "name=koha_" -q)
docker volume prune -f
docker image prune -f
rm docker-compose.yml
rm -rf env .env
- uses: bywatersolutions/action-slack@v3
with:
status: ${{ job.status }}
fields: ref,workflow # selectable (default: repo,message)
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEVOPS_WEBHOOK }} # required
if: always() # Pick up events even if the job fails or is canceled.
zap-scan-full-opac:
name: ZAP Scan - Full - OPAC
needs: zap-scan-baseline-opac
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Export additional variables needed by koha-testing-docker
run: |
export LOCAL_USER_ID="$(id -u)" # Needed for koha-testing-docker
KOHA_BRANCH=${GITHUB_REF##*/}
echo "BRANCH: $KOHA_BRANCH"
export SYNC_REPO=.
echo "LOCAL_USER_ID=$LOCAL_USER_ID" >> $GITHUB_ENV
echo "KOHA_BRANCH=$KOHA_BRANCH" >> $GITHUB_ENV
echo "SYNC_REPO=$SYNC_REPO" >> $GITHUB_ENV
echo "RUN_TESTS_AND_EXIT=yes" >> $GITHUB_ENV
echo "KOHA_IMAGE=23.05" >> $GITHUB_ENV
- name: Set up koha-testing-docker
run: |
sudo sysctl -w vm.max_map_count=262144
wget -O docker-compose.yml https://gitlab.com/koha-community/koha-testing-docker/raw/23.05/docker-compose.yml
mkdir -p env
wget -O env/defaults.env https://gitlab.com/koha-community/koha-testing-docker/raw/23.05/env/defaults.env
cp env/defaults.env .env
docker-compose pull
docker-compose -f docker-compose.yml -p koha up --detach
echo "SLEEPING 3 MINUTES"
sleep 60
echo "1 MINUTE DONE"
sleep 60
echo "2 MINUTES DONE"
sleep 60
echo "3 MINUTES DONE"
echo "WAKING UP"
echo "DOCKER LOGS"
docker logs koha_koha_1 2>&1
echo "/DOCKER LOGS"
# - name: Setup Debug Session
# uses: csexton/debugger-action@master
- name: List docker networks
run: |
docker network ls
- name: Scan opac interface
run: |
docker run --network koha_kohanet -t owasp/zap2docker-weekly zap-full-scan.py -t http://koha:8080
- name: Post test cleanup
run: |
docker-compose down
docker rm -f $(docker ps -a -f "name=koha_" -q)
docker volume prune -f
docker image prune -f
rm docker-compose.yml
rm -rf env .env
- uses: bywatersolutions/action-slack@v3
with:
status: ${{ job.status }}
fields: ref,workflow # selectable (default: repo,message)
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEVOPS_WEBHOOK }} # required
if: always() # Pick up events even if the job fails or is canceled.
auto-rebase-xslt:
if: false
#if: startsWith( github.ref, 'refs/heads/bywater-v' )
name: Rebase XSLT
needs: [unit-test, is-a-mark]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
branch:
- ajaxon
- bedford
- bedtest
- briar
- camden
- centenary
- duncanville
- esripsa
- fredh
- keys
- library
- nrhtx
- nyam
- nycrecords
- ottumwa
- palnet
- panhandle
- presby
- rosev
- rta
- siskiyou
- taft
- vatech
- vatechtest
- arlington
steps:
- uses: actions/checkout@v1
- name: Display xslt branch to be rebased
run: echo ${{ matrix.branch }}
- name: Add xslt remote for bywater-koha-xslt
run: git remote add bywater-koha-xslt https://github.com/bywatersolutions/bywater-koha-xslt.git
- name: Add xslt remote for bywater-koha-xslt-archives
run: git remote add bywater-koha-xslt https://github.com/bywatersolutions/bywater-koha-xslt-archives.git
- name: Fetch from xslt remotes
run: git fetch --all
- name: Check out the xslt branch to be rebassed
run: git checkout bywater-koha-xslt/${{ matrix.branch }}
- name: Push a backup copy of this branch to bywater-koha-xslt
run: git push bywater-koha-xslt-archives HEAD:refs/heads/${GITHUB_REF##*/}-$(date --iso-8601)
- name: Get first and last commits of custom XSLT
id: extracted_variables
run: |
FIRST_COMMIT=$(git log --all --grep='BWS-XSLT' --pretty=format:"%H" | tail -1)
echo "FIRST COMMIT: $FIRST_COMMIT"
echo ::set-output name=FIRST_COMMIT::$FIRST_COMMIT
LAST_COMMIT=$(git log --all --grep='BWS-XSLT' --pretty=format:"%H" | head -1)
echo "LAST COMMIT: $LAST_COMMIT"
echo ::set-output name=LAST_COMMIT::$LAST_COMMIT
- name: Check out the base Koha branch to cherry pick the XSLT commits on to
run: git checkout ${{ github.sha}}
- name: Cherry pick the commits
run: git cherry-pick ${{ steps.extracted_variables.outputs.LAST_COMMIT }}^..${{ steps.extracted_variables.outputs.FIRST_COMMIT }}
- name: Push the rebased branch back
run: git push -f bywater-koha-xslt HEAD:${{ github.ref }}