Skip to content

Commit

Permalink
test: check compressed files contents
Browse files Browse the repository at this point in the history
  • Loading branch information
selim13 committed Jun 11, 2022
1 parent af0c215 commit f601a40
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [14.x, 16.x, 18.x]

steps:
- uses: actions/checkout@v2

- name: Install brotli
run: sudo apt-get install -y brotli

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
node-version: ${{ matrix.node-version }}

- name: Install NPM packages
run: npm ci

- name: Run tests
run: npm test
28 changes: 13 additions & 15 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@

set -e

[ -f "test/dist/app.js" ]
[ -f "test/dist/app.js.gz" ]
[ -f "test/dist/app.js.br" ]
[ -f "test/dist/app.js.map" ]
[ -f "test/dist/app.js.map.gz" ]
[ -f "test/dist/app.js.map.br" ]
[ -f "test/dist/style.css" ]
[ -f "test/dist/style.css.gz" ]
[ -f "test/dist/style.css.br" ]
[ -f "test/dist/style.css.map" ]
[ -f "test/dist/style.css.map.gz" ]
[ -f "test/dist/style.css.map.br" ]
[ -f "test/dist/images/vector.svg" ]
[ -f "test/dist/images/vector.svg.gz" ]
[ -f "test/dist/images/vector.svg.br" ]
test_file() {
local file="$1"

[ -f "$file" ]
zcat "$file.gz" > "$file.gz.out" && cmp --silent "$file" "$file.gz.out"
brotli --decompress --stdout "$file.br" > "$file.br.out" && cmp --silent "$file" "$file.br.out"
}

test_file test/dist/app.js
test_file test/dist/app.js.map
test_file test/dist/style.css
test_file test/dist/style.css.map
test_file test/dist/images/vector.svg

0 comments on commit f601a40

Please sign in to comment.