From dc31ad46fb6f7c09d7236d13fce0bc63b5f010ce Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Mon, 21 Dec 2020 17:34:56 -0500 Subject: run process_static as part of GitHub workflow --- .github/workflows/static.yml | 50 +++++++++++++++++++++++++++++++++++ .github/workflows/validate-static.yml | 47 -------------------------------- 2 files changed, 50 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/static.yml delete mode 100644 .github/workflows/validate-static.yml diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml new file mode 100644 index 00000000..27e116f5 --- /dev/null +++ b/.github/workflows/static.yml @@ -0,0 +1,50 @@ +name: Validate and process static files + +on: + pull_request: + push: + branches: [master] + +jobs: + static: + runs-on: ubuntu-latest + + env: + VALIDATOR_VERSION: 20.6.30 + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + + - name: Cache node modules + uses: actions/cache@v1 + env: + cache-name: cache-node-modules + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + + - name: Cache validator + id: validator-cache + uses: actions/cache@v1 + with: + path: vnu-runtime-image + key: ${{ runner.os }}-validator-${{ env.VALIDATOR_VERSION }} + + - run: sudo apt-get update + - run: sudo apt-get -y install libxml2-utils yajl-tools python3-lxml python3-cssselect moreutils brotli zopfli + - run: npm install + + - name: Download validatornu + # There isn't a package with a `validatornu` command in Ubuntu, so download the validator + # from the GitHub releases and change the validate_static script later to use it. + run: wget https://github.com/validator/validator/releases/download/${{ env.VALIDATOR_VERSION }}/vnu.linux.zip && unzip vnu.linux.zip + if: steps.validator-cache.outputs.cache-hit != 'true' + + - run: sed -i 's+validatornu+vnu-runtime-image/bin/vnu+g' validate_static + + - name: validate static + run: ./validate_static + + - name: process static + run: ./process_static diff --git a/.github/workflows/validate-static.yml b/.github/workflows/validate-static.yml deleted file mode 100644 index 1ca3158b..00000000 --- a/.github/workflows/validate-static.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Validate static - -on: - pull_request: - push: - branches: [master] - -jobs: - validate-static: - runs-on: ubuntu-latest - - env: - VALIDATOR_VERSION: 20.6.30 - - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - - - name: Cache node modules - uses: actions/cache@v1 - env: - cache-name: cache-node-modules - with: - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - - - name: Cache validator - id: validator-cache - uses: actions/cache@v1 - with: - path: vnu-runtime-image - key: ${{ runner.os }}-validator-${{ env.VALIDATOR_VERSION }} - - - run: sudo apt-get update - - run: sudo apt-get -y install libxml2-utils yajl-tools - - run: npm install - - - name: Download validatornu - # There isn't a package with a `validatornu` command in Ubuntu, so download the validator - # from the GitHub releases and change the validate_static script later to use it. - run: wget https://github.com/validator/validator/releases/download/${{ env.VALIDATOR_VERSION }}/vnu.linux.zip && unzip vnu.linux.zip - if: steps.validator-cache.outputs.cache-hit != 'true' - - - run: sed -i 's+validatornu+vnu-runtime-image/bin/vnu+g' validate_static - - - name: validate static - run: ./validate_static -- cgit v1.3.1