From f82833cfdb17fa4a3da588a92925d3ebd8579357 Mon Sep 17 00:00:00 2001 From: zomars Date: Mon, 20 Feb 2023 15:53:04 -0700 Subject: [PATCH] Abstract playwright cache --- .github/actions/cache-playwright/action.yml | 23 +++++++++++++++++++++ .github/workflows/e2e-app-store.yml | 16 +------------- .github/workflows/e2e-embed.yml | 16 +------------- .github/workflows/e2e.yml | 16 +------------- .github/workflows/yarn-e2e.yml | 14 +------------ 5 files changed, 27 insertions(+), 58 deletions(-) create mode 100644 .github/actions/cache-playwright/action.yml diff --git a/.github/actions/cache-playwright/action.yml b/.github/actions/cache-playwright/action.yml new file mode 100644 index 0000000000..fb6994896c --- /dev/null +++ b/.github/actions/cache-playwright/action.yml @@ -0,0 +1,23 @@ +name: Install playwright binaries +description: "Install playwright, cache and restore if necessary" +inputs: + node_version: + required: true + description: "The node version used to run this" +runs: + using: "composite" + steps: + - name: Cache playwright binaries + uses: actions/cache@v2 + id: playwright-cache + with: + path: | + ~/Library/Caches/ms-playwright + ~/.cache/ms-playwright + ${{ github.workspace }}/node_modules/playwright + key: cache-playwright-${{ hashFiles('**/yarn.lock') }} + restore-keys: cache-playwright- + - name: Install playwright deps + if: steps.playwright-cache.outputs.cache-hit != 'true' + shell: bash + run: yarn playwright install diff --git a/.github/workflows/e2e-app-store.yml b/.github/workflows/e2e-app-store.yml index ebb0edf01f..f49331a503 100644 --- a/.github/workflows/e2e-app-store.yml +++ b/.github/workflows/e2e-app-store.yml @@ -76,21 +76,7 @@ jobs: with: node-version: ${{ matrix.node }} cache: "yarn" - - - name: Cache playwright binaries - uses: actions/cache@v2 - id: playwright-cache - with: - path: | - ~/Library/Caches/ms-playwright - ~/.cache/ms-playwright - ${{ github.workspace }}/node_modules/playwright - key: cache-playwright-${{ hashFiles('**/yarn.lock') }} - restore-keys: cache-playwright- - - run: yarn --frozen-lockfile - - name: Install playwright deps - if: steps.playwright-cache.outputs.cache-hit != 'true' - run: yarn playwright install --with-deps + - uses: ./.github/actions/cache-playwright - name: Run Tests run: yarn test-e2e:app-store diff --git a/.github/workflows/e2e-embed.yml b/.github/workflows/e2e-embed.yml index 9312999331..78c17c90b7 100644 --- a/.github/workflows/e2e-embed.yml +++ b/.github/workflows/e2e-embed.yml @@ -72,21 +72,7 @@ jobs: with: node-version: 16.x cache: "yarn" - - - name: Cache playwright binaries - uses: actions/cache@v2 - id: playwright-cache - with: - path: | - ~/Library/Caches/ms-playwright - ~/.cache/ms-playwright - ${{ github.workspace }}/node_modules/playwright - key: cache-playwright-${{ hashFiles('**/yarn.lock') }} - restore-keys: cache-playwright- - - run: yarn --frozen-lockfile - - name: Install playwright deps - if: steps.playwright-cache.outputs.cache-hit != 'true' - run: yarn playwright install --with-deps + - uses: ./.github/actions/cache-playwright - name: Run Tests run: yarn turbo run embed-tests-update-snapshots:ci --scope=@calcom/embed-react --concurrency=1 diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index df4e687496..fa4490934c 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -75,21 +75,7 @@ jobs: with: node-version: 16.x cache: "yarn" - - - name: Cache playwright binaries - uses: actions/cache@v2 - id: playwright-cache - with: - path: | - ~/Library/Caches/ms-playwright - ~/.cache/ms-playwright - ${{ github.workspace }}/node_modules/playwright - key: cache-playwright-${{ hashFiles('**/yarn.lock') }} - restore-keys: cache-playwright- - - run: yarn --frozen-lockfile - - name: Install playwright deps - if: steps.playwright-cache.outputs.cache-hit != 'true' - run: yarn playwright install --with-deps + - uses: ./.github/actions/cache-playwright - run: yarn test-e2e - name: Upload test results diff --git a/.github/workflows/yarn-e2e.yml b/.github/workflows/yarn-e2e.yml index 984fc2039b..fd0e98a001 100644 --- a/.github/workflows/yarn-e2e.yml +++ b/.github/workflows/yarn-e2e.yml @@ -65,19 +65,7 @@ jobs: - uses: ./.github/actions/yarn-install with: node_version: ${{ secrets.node_version }} - - name: Cache playwright binaries - uses: actions/cache@v2 - id: playwright-cache - with: - path: | - ~/Library/Caches/ms-playwright - ~/.cache/ms-playwright - ${{ github.workspace }}/node_modules/playwright - key: cache-playwright-${{ hashFiles('**/yarn.lock') }} - restore-keys: cache-playwright- - - name: Install playwright deps - if: steps.playwright-cache.outputs.cache-hit != 'true' - run: yarn playwright install + - uses: ./.github/actions/cache-playwright - uses: ./.github/actions/yarn-build with: # GitHub Composite actions cannot read secrets, we have to pass them in here