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

88 lines
2.3 KiB
YAML
Raw Normal View History

2020-07-08 11:12:21 +00:00
name: tests
on:
push:
branches:
- master
tags-ignore:
- '**'
2021-04-13 13:55:03 +00:00
paths-ignore:
- '**.md'
2020-07-08 11:12:21 +00:00
pull_request:
2021-04-13 13:55:03 +00:00
paths-ignore:
- '**.md'
2020-07-08 11:12:21 +00:00
jobs: # Docs: <https://git.io/JvxXE>
2021-04-13 13:55:03 +00:00
gitleaks:
name: Gitleaks
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check for GitLeaks
uses: zricethezav/gitleaks-action@v1.5.0 # Action page: <https://github.com/zricethezav/gitleaks-action>
2020-07-08 11:12:21 +00:00
generate:
name: Try to run generator
2021-03-04 06:28:48 +00:00
runs-on: ubuntu-20.04
2020-07-08 11:12:21 +00:00
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:
2021-04-13 13:55:03 +00:00
node-version: 15
2020-07-08 11:12:21 +00:00
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
2021-04-13 13:55:03 +00:00
working-directory: generator
2020-07-08 11:12:21 +00:00
run: yarn install
- name: Run generator
2021-04-13 13:55:03 +00:00
run: ./generator/generator.js -i -c ./config.json -o ./out
2020-07-08 11:12:21 +00:00
- name: Test file creation
2021-04-13 13:55:03 +00:00
run: |
test -f ./out/index.html
test -f ./out/ghost/404.html
test -f ./out/l7-dark/404.html
test -f ./out/l7-light/404.html
test -f ./out/shuffle/404.html
2020-07-08 11:12:21 +00:00
docker-build:
2020-07-08 11:22:29 +00:00
name: Build docker image
2021-03-04 06:28:48 +00:00
runs-on: ubuntu-20.04
2020-07-08 11:12:21 +00:00
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 .
2021-04-13 13:55:03 +00:00
- name: Scan image
uses: anchore/scan-action@v2 # action page: <https://github.com/anchore/scan-action>
with:
image: image:local
fail-build: true
severity-cutoff: medium # negligible, low, medium, high or critical
2020-07-08 11:22:29 +00:00
- name: Run docker image
2021-04-13 13:55:03 +00:00
run: docker run --rm -d -p "8080:8080/tcp" -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