Skip to content

Commit

Permalink
Build: Update grunt-contrib-qunit to fix caching of Chromium binary
Browse files Browse the repository at this point in the history
* Puppeteer stores the Chromium binary only in node_modules/
  (not in $XDG_CACHE_HOME or some other directory that is generally
  persisted in dev and CI environments, nor in any other directory
  that one can opt-in to caching/persistence).

  This was fixed in Puppeteer 5+ (ref puppeteer/puppeteer#6014),
  through an opt-in PUPPETEER_DOWNLOAD_PATH env var.

* I enalbed this in commit 7cd99a2, but it didn't do anything
  yet as grunt-contrib-qunit wasn't using the newer Puppeteer yet.

  This was fixed in gruntjs/grunt-contrib-qunit#173.

* Fix ENV syntax.
  - Tildes aren't expanded in this context.
  - Other variables like $HOME aren't expanded either.
  - Absolute paths like /tmp can't be used because Windows runners interpret
    `/tmp` as `D:\tmp`, which doesn't exist by default, and Puppeteer requires
    the parent dir to exist instead of simply lazy-creating it.
  - Can't use a relative directory in the workspace like ".puppeteer"
    because Puppeteer insists on the variable being an absolute path.
  - We can use the `github.workspace` builtin variable,
    which we can subsitute per <https://git.io/JUJEE>.
  • Loading branch information
Krinkle committed Jul 4, 2021
1 parent 0d46c0e commit 35fbd22
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 47 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/CI.yaml
Expand Up @@ -43,7 +43,7 @@ jobs:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
PUPPETEER_DOWNLOAD_PATH: ~/.puppeteer_download
PUPPETEER_DOWNLOAD_PATH: "${{ github.workspace }}/.puppeteer_download"
steps:
- uses: actions/checkout@v2

Expand All @@ -52,7 +52,7 @@ jobs:
with:
path: |
~/.npm
~/.puppeteer_download
${{ github.workspace }}/.puppeteer_download
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}

- name: Use Node.js ${{ matrix.node }}
Expand Down Expand Up @@ -86,14 +86,14 @@ jobs:
name: SpiderMonkey
runs-on: ubuntu-20.04
env:
PUPPETEER_DOWNLOAD_PATH: ~/.puppeteer_download
PUPPETEER_DOWNLOAD_PATH: "${{ github.workspace }}/.puppeteer_download"
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.npm
~/.puppeteer_download
${{ github.workspace }}/.puppeteer_download
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Use Node.js 10
uses: actions/setup-node@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/browsers-full.yaml
Expand Up @@ -16,15 +16,15 @@ jobs:
if: ${{ github.repository == 'qunitjs/qunit' }} # skip on forks, needs secret
runs-on: ubuntu-latest
env:
PUPPETEER_DOWNLOAD_PATH: ~/.puppeteer_download
PUPPETEER_DOWNLOAD_PATH: "${{ github.workspace }}/.puppeteer_download"
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: |
~/.npm
~/.puppeteer_download
${{ github.workspace }}/.puppeteer_download
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}

- name: Use Node.js 10
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/browsers-quick.yaml
Expand Up @@ -8,15 +8,15 @@ jobs:
if: ${{ github.repository == 'qunitjs/qunit' }} # skip on forks, needs secret
runs-on: ubuntu-latest
env:
PUPPETEER_DOWNLOAD_PATH: ~/.puppeteer_download
PUPPETEER_DOWNLOAD_PATH: "${{ github.workspace }}/.puppeteer_download"
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: |
~/.npm
~/.puppeteer_download
${{ github.workspace }}/.puppeteer_download
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}

- name: Use Node.js 10
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yaml
Expand Up @@ -8,15 +8,15 @@ jobs:
if: ${{ github.repository == 'qunitjs/qunit' }} # skip on forks, needs secret
runs-on: ubuntu-20.04
env:
PUPPETEER_DOWNLOAD_PATH: ~/.puppeteer_download
PUPPETEER_DOWNLOAD_PATH: "${{ github.workspace }}/.puppeteer_download"
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: |
~/.npm
~/.puppeteer_download
${{ github.workspace }}/.puppeteer_download
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}

- name: Use Node.js 14
Expand Down
64 changes: 28 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -66,7 +66,7 @@
"grunt": "^1.4.1",
"grunt-contrib-connect": "^3.0.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-qunit": "^4.0.0",
"grunt-contrib-qunit": "^5.0.1",
"grunt-git-authors": "^3.2.0",
"grunt-search": "^0.1.8",
"kleur": "4.1.4",
Expand Down

0 comments on commit 35fbd22

Please sign in to comment.