Skip to content

Allow for host urls to include paths #53

Allow for host urls to include paths

Allow for host urls to include paths #53

Workflow file for this run

name: "CI"
on:
pull_request:
branches:
- "*"
push:
branches:
- "main"
- "master"
jobs:
test:
runs-on: "ubuntu-20.04"
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python 3.8"
uses: "actions/setup-python@v1"
with:
python-version: "3.8"
- name: "Install dependencies"
run: |
pip3 install flake8 black Flask==2.2.3
pip3 install -e .[brotli]
- name: "Lint code base"
run: |
flake8 .
black --check .
- name: "Run test suite for gzip and brotli"
run: |
cd tests/example_app
export FLASK_APP=example.app
ls -laR example/static/ | wc -l \
| grep -q "26" \
&& (echo "File count before compiling test (index): pass" && exit 0) \
|| (echo "File count before compiling test (index): fail" && exit 1)
ls -laR example/about/static/ | wc -l \
| grep -q "5" \
&& (echo "File count before compiling test (about): pass" && exit 0) \
|| (echo "File count before compiling test (about): fail" && exit 1)
ls -laR example/contact/static/ | wc -l \
| grep -q "5" \
&& (echo "File count before compiling test (contact): pass" && exit 0) \
|| (echo "File count before compiling test (contact): fail" && exit 1)
ls -laR example/about/team/static/ | wc -l \
| grep -q "5" \
&& (echo "File count before compiling test (team): pass" && exit 0) \
|| (echo "File count before compiling test (team): fail" && exit 1)
flask digest compile \
&& ls -laR example/static/ | wc -l \
| grep -q "42" \
&& (echo "File count after compiling test (index): pass" && exit 0) \
|| (echo "File count after compiling test (index): fail" && exit 1)
ls -laR example/about/static/ | wc -l \
| grep -q "11" \
&& (echo "File count after compiling test (about): pass" && exit 0) \
|| (echo "File count after compiling test (about): fail" && exit 1)
ls -laR example/contact/static/ | wc -l \
| grep -q "11" \
&& (echo "File count after compiling test (contact): pass" && exit 0) \
|| (echo "File count after compiling test (contact): fail" && exit 1)
ls -laR example/about/team/static/ | wc -l \
| grep -q "11" \
&& (echo "File count after compiling test (team): pass" && exit 0) \
|| (echo "File count after compiling test (team): fail" && exit 1)
find . -type f | grep ".gz$" | wc -l \
| grep -q "14" \
&& (echo "Check for gzip asset creation: pass" && exit 0) \
|| (echo "Check for gzip asset creation: pass: fail" && exit 1)
find . -type f | grep ".br$" | wc -l \
| grep -q "14" \
&& (echo "Check for brotli asset creation: pass" && exit 0) \
|| (echo "Check for brotli asset creation: pass: fail" && exit 1)
grep -q "js/modules/hello.js" example/static/cache_manifest.json \
&& (echo "Cache manifest has nested file test: pass" && exit 0) \
|| (echo "Cache manifest has nested file test: fail" && exit 1)
grep -q "js/modules/hello-d41d8cd98f00b204e9800998ecf8427e.js" example/static/cache_manifest.json \
&& (echo "Cache manifest has digested file test: pass" && exit 0) \
|| (echo "Cache manifest has digested file test: fail" && exit 1)
grep -q "js/modules/hello.js" example/static/cache_manifest.json \
&& (echo "Cache manifest has nested file test: pass" && exit 0) \
|| (echo "Cache manifest has nested file test: fail" && exit 1)
flask run &
sleep 5 \
&& curl http://localhost:5000 \
| grep -q 'https://cdn.example.com/static/css/app-d41d8cd98f00b204e9800998ecf8427e.css' \
&& (echo 'Stylesheet is md5 tagged test (index): pass' && exit 0) \
|| (echo 'Stylesheet is md5 tagged test (index): fail' && exit 1)
curl http://localhost:5000/about/ \
| grep -q 'https://cdn.example.com/about/static/app-297c671953f6c24f1354214b3f706e0b.css' \
&& (echo 'Stylesheet is md5 tagged test (about): pass' && exit 0) \
|| (echo 'Stylesheet is md5 tagged test (about): fail' && exit 1)
curl http://localhost:5000/contact \
| grep -q 'https://cdn.example.com/contact/static/app-b71c3f4f5d026dd5198163b655228776.css' \
&& (echo 'Stylesheet is md5 tagged test (contact): pass' && exit 0) \
|| (echo 'Stylesheet is md5 tagged test (contact): fail' && exit 1)
curl http://localhost:5000/about/team \
| grep -q 'https://cdn.example.com/about/static/team/app-023f768653c556fc2fcaf338b408c464.css' \
&& (echo 'Stylesheet is md5 tagged test (team): pass' && exit 0) \
|| (echo 'Stylesheet is md5 tagged test (team): fail' && exit 1)
kill $!
flask digest clean \
&& ls -laR example/static/ | wc -l \
| grep -q "26" \
&& (echo "File count after cleaning test (index): pass" && exit 0) \
|| (echo "File count after cleaning test (index): fail" && exit 1)
ls -laR example/about/static/ | wc -l \
| grep -q "5" \
&& (echo "File count after cleaning test (about): pass" && exit 0) \
|| (echo "File count after cleaning test (about): fail" && exit 1)
ls -laR example/contact/static/ | wc -l \
| grep -q "5" \
&& (echo "File count after cleaning test (contact): pass" && exit 0) \
|| (echo "File count after cleaning test (contact): fail" && exit 1)
ls -laR example/about/team/static/ | wc -l \
| grep -q "5" \
&& (echo "File count after cleaning test (team): pass" && exit 0) \
|| (echo "File count after cleaning test (team): fail" && exit 1)
flask run &
sleep 5 \
&& curl http://localhost:5000 \
| grep -q 'https://cdn.example.com/static/js/app.js' \
&& (echo 'Javascript is not md5 tagged test: pass' && exit 0) \
|| (echo 'Javascript is not md5 tagged test: fail' && exit 1)
flask digest clean
kill $!