error-pages/.github/workflows/tests.yml

59 lines
1.5 KiB
YAML
Raw Normal View History

2020-07-08 11:12:21 +00:00
name: tests
on:
push:
branches:
- master
tags-ignore:
- '**'
pull_request:
jobs: # Docs: <https://git.io/JvxXE>
generate:
name: Try to run generator
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v1 # Action page: <https://github.com/actions/setup-node>
with:
node-version: 12
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install
- name: Run generator
2020-07-08 17:15:53 +00:00
run: ./bin/generator.js -c ./config.json -o ./out
2020-07-08 11:12:21 +00:00
- name: Test file creation
run: test -f ./out/ghost/404.html
docker-build:
2020-07-08 11:22:29 +00:00
name: Build docker image
2020-07-08 11:12:21 +00:00
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Build docker image
2020-07-08 11:22:29 +00:00
run: docker build -f ./Dockerfile --tag image:local .
- name: Run docker image
2020-07-08 11:24:23 +00:00
run: docker run --rm -d -p "8080:8080" -e "TEMPLATE_NAME=ghost" image:local
2020-07-08 11:22:29 +00:00
2020-07-08 17:18:30 +00:00
- name: Pause
run: sleep 2
2020-07-10 07:43:48 +00:00
- name: Verify 500.html error file exists in root
2020-07-08 11:22:29 +00:00
run: curl -sS --fail "http://127.0.0.1:8080/500.html"
2020-07-10 07:43:48 +00:00
- name: Verify root request HTTP code
run: test $(curl --write-out %{http_code} --silent --output /dev/null http://127.0.0.1:8080/) -eq 404