Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
name: 'Install pnpm dependencies'
description: 'Installs pnpm dependencies into node_modules folders on the Namespace cache volume.'
description: 'Installs pnpm dependencies and caches them.'

outputs:
cache_key:
description: 'The dependency cache key'
value: ${{ steps.compute_lockfile_hash.outputs.hash }}

runs:
using: 'composite'
steps:
- name: Install pnpm
uses: ./.github/actions/install-pnpm

- name: List dependency paths
id: paths
run: |
{
echo 'paths<<EOF'
node -e 'const { workspaces } = require("./package.json"); for (const dir of [".", ...workspaces]) console.log(require("path").resolve(dir, "node_modules"))'
echo '~/.cache/mongodb-binaries'
echo 'EOF'
} >> "$GITHUB_OUTPUT"
- name: Compute dependency cache key
id: compute_lockfile_hash
run: node ./scripts/dependency-hash-key.js >> "$GITHUB_OUTPUT"
shell: bash

- name: Mount dependency cache
uses: namespacelabs/nscloud-cache-action@1124a6f3ce44e5cf84cc22111530961f4d2a15f9 # v1.7.0
- name: Check dependency cache
uses: actions/cache@v6.1.0
id: cache_dependencies
with:
cache: pnpm
path: ${{ steps.paths.outputs.paths }}
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ steps.compute_lockfile_hash.outputs.hash }}

# The cache volume can hold node_modules of another commit or branch. This is a no-op when they match
# pnpm-lock.yaml.
- name: Install dependencies
if: steps.cache_dependencies.outputs.cache-hit != 'true'
run: pnpm install --frozen-lockfile
shell: bash
44 changes: 33 additions & 11 deletions .github/actions/install-playwright/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Install Playwright dependencies'
description: 'Installs Playwright browsers and system dependencies, keeping both on the Namespace cache volume.'
description: 'Installs Playwright dependencies and caches them.'
inputs:
browsers:
description: 'What browsers to install.'
Expand All @@ -26,21 +26,43 @@ runs:
shell: bash
working-directory: ${{ inputs.cwd }}

- name: Mount Playwright cache
uses: namespacelabs/nscloud-cache-action@1124a6f3ce44e5cf84cc22111530961f4d2a15f9 # v1.7.0
- name: Restore cached playwright binaries
uses: actions/cache/restore@v6.1.0
id: playwright-cache
if: steps.playwright-version.outputs.version != ''
with:
cache: |
playwright
apt
path: |
~/.cache/ms-playwright
# Bump the iteration when bumping runner images to use a new cache
key: playwright-${{ runner.os }}-iteration-1-${{ steps.playwright-version.outputs.version }}

# Downloads only the browsers and apt packages that are not on the cache volume yet. `npx` runs outside the repo,
# so it can't pick up a `playwright` that a parallel `pnpm install` is still linking.
- name: Install Playwright
if: steps.playwright-version.outputs.version != ''
# We always install all browsers, if uncached
# `npx` runs outside the repo, so it can't pick up a `playwright` that a parallel `pnpm install` is still linking.
- name: Install Playwright dependencies (uncached)
env:
PLAYWRIGHT_VERSION: ${{ steps.playwright-version.outputs.version }}
run: npx -y "playwright@$PLAYWRIGHT_VERSION" install chromium webkit firefox --with-deps
if: steps.playwright-version.outputs.version != '' && steps.playwright-cache.outputs.cache-hit != 'true'
shell: bash
working-directory: ${{ runner.temp }}

- name: Install Playwright system dependencies only (cached)
env:
PLAYWRIGHT_BROWSERS: ${{ inputs.browsers || 'chromium webkit firefox' }}
PLAYWRIGHT_VERSION: ${{ steps.playwright-version.outputs.version }}
run: npx -y "playwright@$PLAYWRIGHT_VERSION" install --with-deps $PLAYWRIGHT_BROWSERS
run: npx -y "playwright@$PLAYWRIGHT_VERSION" install-deps $PLAYWRIGHT_BROWSERS
if: steps.playwright-version.outputs.version != '' && steps.playwright-cache.outputs.cache-hit == 'true'
shell: bash
working-directory: ${{ runner.temp }}

# Only store cache on develop branch
- name: Store cached playwright binaries
uses: actions/cache/save@v6.1.0
if:
steps.playwright-version.outputs.version != '' && github.event_name == 'push' && github.ref ==
'refs/heads/develop'
with:
path: |
~/.cache/ms-playwright
# Bump the iteration when bumping runner images to use a new cache
key: playwright-${{ runner.os }}-iteration-1-${{ steps.playwright-version.outputs.version }}
21 changes: 19 additions & 2 deletions .github/actions/restore-cache/action.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
name: 'Restore dependency & build cache'
description: 'Installs dependencies from the Namespace cache volume and restores the build output.'
description: 'Restore the dependency & build cache.'

inputs:
dependency_cache_key:
description: 'The dependency cache key'
required: true

runs:
using: 'composite'
steps:
- name: Install pnpm
uses: ./.github/actions/install-pnpm

- name: Check dependency cache
id: dep-cache
uses: actions/cache/restore@v6.1.0
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ inputs.dependency_cache_key }}

- name: Restore build artifacts
uses: actions/download-artifact@v7
with:
name: build-output

- name: Install dependencies
uses: ./.github/actions/install-dependencies
if: steps.dep-cache.outputs.cache-hit != 'true'
run: pnpm install --frozen-lockfile
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/auto-fix-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ concurrency:

jobs:
auto-fix-issue:
runs-on: namespace-profile-sentry-javascript
runs-on: ubuntu-latest
environment: ci-triage
permissions:
# Required to create a new branch and commit the fix
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:

jobs:
release:
runs-on: namespace-profile-sentry-javascript-small
runs-on: ubuntu-24.04
name: 'Prepare a new version'

steps:
Expand Down
Loading
Loading