Skip to content

test.yml: Add screenshot of page to test run #164

test.yml: Add screenshot of page to test run

test.yml: Add screenshot of page to test run #164

Workflow file for this run

name: Run tests
on:
workflow_dispatch:
pull_request:
push:
jobs:
build-and-test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Test people.json is valid JSON
run: |
python3 -c 'import json; json.load(open("people.json"))'
- name: Test image builds
run: |
docker compose -f compose.yml build
- name: Test container can start and is healthy
run: |
# Launch the project from docker-compose.yml and wait up to
# 30s for its built-in health check to return "healthy"
docker compose -f compose.yml up --wait --wait-timeout 30
docker compose -f compose.yml down
- name: Take screenshot of page
uses: karol-brejna-i/webpage-screenshot-action@v1
with:
url: http://localhost:5000
- name: Bring down container
run: |
docker compose -f compose.yml down
- uses: actions/upload-artifact@v3
with:
name: screenshot
path: ${{ github.workspace }}/*.png