Skip to content

Always run tests, run linter in separate job #80

Always run tests, run linter in separate job

Always run tests, run linter in separate job #80

Workflow file for this run

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, apache-php8.0, nginx, nginx-php8.0]
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