mirror of
https://github.com/Extroonie/extroonie.com.git
synced 2026-10-12 17:48:06 -07:00
35 lines
1.6 KiB
YAML
35 lines
1.6 KiB
YAML
name: Check site
|
|
on: [push, pull_request]
|
|
permissions:
|
|
contents: read
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Check formatting, run tests, and build production image
|
|
run: docker build --target production -t extroonie .
|
|
- name: Check serving and 404 status
|
|
run: |
|
|
docker run -d --name extroonie-test -p 127.0.0.1:8080:8080 extroonie
|
|
status=$(curl --silent --show-error --fail \
|
|
--retry 10 --retry-all-errors --retry-delay 1 --retry-max-time 30 \
|
|
--connect-timeout 2 --max-time 5 \
|
|
--output /dev/null --write-out '%{http_code}' http://127.0.0.1:8080/)
|
|
echo "Homepage HTTP status: $status"
|
|
test "$status" = 200
|
|
status=$(curl --silent --show-error --connect-timeout 2 --max-time 5 \
|
|
--output /dev/null --write-out '%{http_code}' http://127.0.0.1:8080/not-a-page/)
|
|
echo "Missing page HTTP status: $status"
|
|
test "$status" = 404
|
|
- name: Show container diagnostics
|
|
if: failure()
|
|
run: |
|
|
docker inspect --format '{{json .State}}' extroonie-test || true
|
|
docker logs --tail 100 extroonie-test || true
|
|
- name: Remove test container
|
|
if: always()
|
|
run: docker rm -f extroonie-test || true
|