-
Notifications
You must be signed in to change notification settings - Fork 46
85 lines (68 loc) · 2.37 KB
/
docker-test.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
name: test
on:
push:
branches:
- master
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- uses: actions/setup-node@v4
with:
node-version-file: package.json
- name: Install Cypress dependencies
run: npm ci
- name: Ensure files follow code style
run: npm run lint
test:
name: Test Docker image
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
dockerfile: [apache, nginx]
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- uses: actions/setup-node@v4
with:
node-version-file: package.json
- name: Install Cypress dependencies
run: npm ci
- name: Build Baikal image
id: build
run: echo "IMAGE_ID=$(docker build -qf ${{ matrix.dockerfile }}.dockerfile .)" >> "$GITHUB_OUTPUT"
- name: Start Baikal container
run: docker run --rm -dp 80:80 --name ${{ matrix.dockerfile }} ${{ steps.build.outputs.IMAGE_ID }}
- name: Run Cypress tests
run: npm run test
- name: Stop Baikal container
run: docker stop ${{ matrix.dockerfile }}
- name: Build and run MailSlurper
run: |
IMAGE_ID=$(docker build -q 'https://github.com/mailslurper/mailslurper.git#release-1.15.0')
docker run --rm --detach --name mailslurper -p 8085:8085 -v ${{ github.workspace }}/cypress/fixtures/mailslurper-config.json:/config.json:ro $IMAGE_ID
- name: Start Baikal container with MSMTP configuration
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 ${{ matrix.dockerfile }} ${{ steps.build.outputs.IMAGE_ID }}
docker cp ${{ github.workspace }}/cypress/fixtures/mail-test.php ${{ matrix.dockerfile }}:/var/www/baikal/html/
- name: Run Cypress tests incl. MSMTP
run: CYPRESS_MSMTP_ENABLED=TRUE npm run test
- name: Archive test results
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-results-${{ matrix.dockerfile }}
path: cypress/screenshots