summaryrefslogtreecommitdiff
path: root/.github/workflows/validate-static.yml
blob: 1ca3158bc6041eb650f818d692f31a09dc5a1646 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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