From 4a74013f9b53edfb558419954b118a9e0044f82e Mon Sep 17 00:00:00 2001 From: Matteo Cristino <102997993+matteo-cristino@users.noreply.github.com> Date: Tue, 6 Aug 2024 11:54:58 +0200 Subject: [PATCH] ci: cache also chromium installed by puppeteer (#134) * ci: cache also chromium installed by puppeteer * ci: fix puppeteer version extraction * ci: fix version reading * ci: set puppeteer download base url to avoid hanging of postinstall script see https://github.com/puppeteer/puppeteer/issues/12833 for more information --- .github/workflows/main.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 85ff2fb..5119ef3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,6 +22,20 @@ jobs: with: node-version: 20 pnpm-version: 8 + - run: echo "PUPPETEER_VERSION=$(pnpm ls puppeteer --json | jq '.[0].devDependencies.puppeteer.version' -r)" >> $GITHUB_ENV + shell: bash + - uses: actions/cache@v4 + with: + path: ~/.cache/puppeteer/chrome + key: ${{ runner.os }}-puppeteer-chromium-${{ env.PUPPETEER_VERSION }} + restore-keys: ${{ runner.os }}-puppeteer-chromium- + - name: install chromium + run: | + # very bad, but I do not found any other way to run + # a postinstall script of an already installed package + pnpm -C node_modules/puppeteer run postinstall + env: + PUPPETEER_DOWNLOAD_BASE_URL: https://storage.googleapis.com/chrome-for-testing-public - name: 🧪 Run the tests run: pnpm run test