Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit c3d2faa

Browse files
Lukas-Stuehrkmattt
andauthored
Add a workflow to validate the generated assets on CI. (#233)
* Add a workflow to validate the generated assets on CI. * Add NPM cache step to CI job Co-authored-by: Mattt <[email protected]>
1 parent 5738c2a commit c3d2faa

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,36 @@ jobs:
9292
apt-get install -y libxml2-dev graphviz
9393
- name: Build and Test
9494
run: swift test -c release --enable-test-discovery
95+
96+
validate-assets:
97+
runs-on: ubuntu-latest
98+
99+
name: "Validate Assets"
100+
101+
steps:
102+
- name: Checkout
103+
uses: actions/checkout@v1
104+
- name: Setup node.js
105+
uses: actions/setup-node@v1
106+
with:
107+
node-version: 14.x
108+
- uses: actions/cache@v2
109+
with:
110+
path: ~/.npm
111+
key: ${{ runner.os }}-node-${{ hashFiles('.node/**/package-lock.json') }}
112+
restore-keys: |
113+
${{ runner.os }}-node-
114+
- name: Install node dependencies
115+
run: |
116+
cd .node
117+
npm install
118+
- name: Test assets
119+
run: |
120+
cd .node
121+
OLD=`cksum ../Resources/all.min.css`
122+
npm run build
123+
NEW=`cksum ../Resources/all.min.css`
124+
if [[ "$OLD" != "$NEW" ]]; then
125+
echo "Regenerated assets differ from committed version"
126+
exit -1
127+
fi

.node/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"not dead"
66
],
77
"scripts": {
8-
"watch": "postcss -w ../Assets/**/*.css -o ../Resources/all.min.css --config ./postcss.config.js"
8+
"watch": "postcss -w ../Assets/**/*.css -o ../Resources/all.min.css --config ./postcss.config.js",
9+
"build": "postcss ../Assets/**/*.css -o ../Resources/all.min.css --config ./postcss.config.js"
910
},
1011
"dependencies": {
1112
"cssnano": "^4.1.10",

0 commit comments

Comments
 (0)