-
Notifications
You must be signed in to change notification settings - Fork 48
98 lines (81 loc) · 3.42 KB
/
test-job.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
name: Test job
on:
workflow_call:
inputs:
dockerfile:
description: Path to the Dockerfile
required: true
type: string
ref:
description: Git reference to test
default: ${{ github.ref }}
type: string
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
show-progress: false
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: npm
- name: Install Cypress dependencies
run: npm ci
- name: Build Docker image
id: build
run: docker build -f ${{ inputs.dockerfile }}.dockerfile -t baikal-image .
- name: Start Baikal container
run: docker run --rm -dp 80:80 --name ${{ inputs.dockerfile }} baikal-image
- name: Run Cypress tests
run: npm run test
- name: Assert Home Assistant fix is not applied by default
run: |
HA_FIX=$(sha1sum files/docker-entrypoint.d/Plugin-with-home-assistant-fix.php | awk '{print $1}')
ACTUAL=$(docker exec ${{ inputs.dockerfile }} sha1sum /var/www/baikal/vendor/sabre/dav/lib/CalDAV/Plugin.php | awk '{print $1}')
if [ "$ACTUAL" == "$HA_FIX" ]; then
echo "::error file=files/docker-entrypoint.d/30-apply-home-assistant-fix.sh:: Home Assistant fix was applied, even though it was not enabled."
exit 1
fi
- name: Stop Baikal container
run: docker stop ${{ inputs.dockerfile }}
- name: Assert Home Assistant fix is applied
run: |
# Start Baikal with Home Assistant fix enabled
docker run --rm -d --name baikal-ha -e APPLY_HOME_ASSISTANT_FIX=true baikal-image
# Assert Home Assistant fix is applied
EXPECTED=$(sha1sum files/docker-entrypoint.d/Plugin-with-home-assistant-fix.php | awk '{print $1}')
ACTUAL=$(docker exec baikal-ha sha1sum /var/www/baikal/vendor/sabre/dav/lib/CalDAV/Plugin.php | awk '{print $1}')
if [ "$ACTUAL" != "$EXPECTED" ]; then
echo "::error file=files/docker-entrypoint.d/30-apply-home-assistant-fix.sh:: Home Assistant fix was not applied, even though it was enabled."
exit 1
fi
# Stop Baikal
docker stop baikal-ha
- name: Build and run MailSlurper
if: false
run: |
docker build -q 'https://github.com/mailslurper/mailslurper.git#release-1.15.0' -t mailslurper
docker run --rm --detach --name mailslurper -p 8085:8085 -v ${{ github.workspace }}/cypress/fixtures/mailslurper-config.json:/config.json:ro mailslurper
- name: Start Baikal container with MSMTP configuration
if: false
env:
MSMTPRC: |
account default
host mailslurper
port 2500
from [email protected]
run: |
docker run --rm --detach -p 80:80 -e MSMTPRC="$MSMTPRC" --link mailslurper --name baikal baikal-image
docker cp ${{ github.workspace }}/cypress/fixtures/mail-test.php baikal:/var/www/baikal/html/
- name: Run Cypress tests incl. MSMTP
if: false
run: CYPRESS_MSMTP_ENABLED=TRUE npm run test
- name: Archive test results
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-results-${{ inputs.dockerfile }}
path: cypress/screenshots