From fd60389b4cfe966804529c844642db6ce193ee82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20St=C3=BChrk?= Date: Sun, 28 Mar 2021 22:32:24 +0200 Subject: [PATCH 1/2] Add a workflow to validate the generated assets on CI. --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ .node/package.json | 3 ++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 309c003b..cbda3f76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,3 +92,30 @@ jobs: apt-get install -y libxml2-dev graphviz - name: Build and Test run: swift test -c release --enable-test-discovery + + validate-assets: + runs-on: ubuntu-latest + + name: "Validate Assets" + + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Setup node.js + uses: actions/setup-node@v1 + with: + node-version: 14.x + - name: Install node dependencies + run: | + cd .node + npm install + - name: Test assets + run: | + cd .node + OLD=`cksum ../Resources/all.min.css` + npm run build + NEW=`cksum ../Resources/all.min.css` + if [[ "$OLD" != "$NEW" ]]; then + echo "Regenerated assets differ from committed version" + exit -1 + fi diff --git a/.node/package.json b/.node/package.json index 20b52bc2..cf48f847 100644 --- a/.node/package.json +++ b/.node/package.json @@ -5,7 +5,8 @@ "not dead" ], "scripts": { - "watch": "postcss -w ../Assets/**/*.css -o ../Resources/all.min.css --config ./postcss.config.js" + "watch": "postcss -w ../Assets/**/*.css -o ../Resources/all.min.css --config ./postcss.config.js", + "build": "postcss ../Assets/**/*.css -o ../Resources/all.min.css --config ./postcss.config.js" }, "dependencies": { "cssnano": "^4.1.10", From 35bad3b5290d25e7401bba3377bb8f746463202f Mon Sep 17 00:00:00 2001 From: Mattt Date: Mon, 29 Mar 2021 05:41:39 -0700 Subject: [PATCH 2/2] Add NPM cache step to CI job --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbda3f76..1b4c4795 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,6 +105,12 @@ jobs: uses: actions/setup-node@v1 with: node-version: 14.x + - uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('.node/**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - name: Install node dependencies run: | cd .node