Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
mfuji09 committed Nov 29, 2024
2 parents 52435d6 + 450e433 commit f55ed6e
Show file tree
Hide file tree
Showing 437 changed files with 22,344 additions and 11,496 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
auto-merge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
if: github.event.pull_request.user.login == 'dependabot[bot]'

steps:
- name: Dependabot metadata
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ jobs:
REACT_APP_DISABLE_AUTH: true

run: |
set -eo pipefail
# Info about which CONTENT_* environment variables were set and to what.
echo "CONTENT_ROOT=$CONTENT_ROOT"
echo "CONTENT_TRANSLATED_ROOT=$CONTENT_TRANSLATED_ROOT"
Expand All @@ -141,9 +143,9 @@ jobs:
# Spread the work across 2 processes. Why 2? Because that's what you
# get in the default GitHub hosting Linux runners.
# See https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
yarn build --locale en-us --locale ja --locale fr &
yarn build:docs --locale en-us --locale ja --locale fr &
build1=$!
yarn build --not-locale en-us --not-locale ja --not-locale fr &
yarn build:docs --not-locale en-us --not-locale ja --not-locale fr &
build2=$!
# You must explicitly specify the job you're waiting-on to ensure
Expand All @@ -159,6 +161,9 @@ jobs:
# Generate sitemap index file
yarn build --sitemap-index
# SSR all pages
yarn render:html
# Generate whatsdeployed files.
yarn tool whatsdeployed --output client/build/_whatsdeployed/code.json
yarn tool whatsdeployed $CONTENT_ROOT --output client/build/_whatsdeployed/content.json
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

steps:
- name: Release
uses: google-github-actions/release-please-action@v4
uses: googleapis/release-please-action@v4
id: release

- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/npm-published-simulation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ jobs:
curl --retry-connrefused --retry 5 -I http://localhost:5042
# Basically, test if it 200 OKs. If not, this'll exit non-zero.
curl http://localhost:5042/en-US/ > /dev/null
curl http://localhost:5042/en-US/docs/MDN/Kitchensink > /dev/null
curl --fail http://localhost:5042/en-US/ > /dev/null
curl --fail http://localhost:5042/en-US/docs/MDN/Kitchensink > /dev/null
- name: Test viewing the dev server
env:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ jobs:
BUILD_GOOGLE_ANALYTICS_MEASUREMENT_ID: G-XXXXXXXX
run: |
yarn build:prepare
# BUILD_FOLDERSEARCH=mdn/kitchensink yarn build
BUILD_FOLDERSEARCH=web/javascript/reference/global_objects/array/foreach yarn build
# BUILD_FOLDERSEARCH=mdn/kitchensink yarn build:docs
BUILD_FOLDERSEARCH=web/javascript/reference/global_objects/array/foreach yarn build:docs
yarn render:html
- name: Serve and lhci
env:
Expand Down
103 changes: 103 additions & 0 deletions .github/workflows/pr-bundlesize-compare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Compare bundle size

on:
pull_request:

jobs:
# Build current and upload stats.json
build-head:
if: github.event.pull_request.head.repo.full_name == github.repository
name: "Build head"
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn

- name: Cache @vscode/ripgrep bin
uses: actions/cache@v4
with:
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('yarn.lock') }}
path: node_modules/@vscode/ripgrep/bin/

- name: Install all yarn packages
run: yarn --frozen-lockfile
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build
run: yarn build:client
env:
ANALYZE_BUNDLE_PR: true

- name: Upload stats.json
uses: actions/upload-artifact@v4
with:
name: head-stats
path: ./client/build/stats.json

# Build base for comparison and upload stats.json
build-base:
if: github.event.pull_request.head.repo.full_name == github.repository
name: "Build base"
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn

- name: Cache @vscode/ripgrep bin
uses: actions/cache@v4
with:
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('yarn.lock') }}
path: node_modules/@vscode/ripgrep/bin/

- name: Install all yarn packages
run: yarn --frozen-lockfile
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build
run: yarn build:client
env:
ANALYZE_BUNDLE_PR: true

- name: Upload stats.json
uses: actions/upload-artifact@v4
with:
name: base-stats
path: ./client/build/stats.json

# run the action against the stats.json files
compare:
if: github.event.pull_request.head.repo.full_name == github.repository
name: "Compare base & head bundle sizes"
runs-on: ubuntu-latest
needs: [build-base, build-head]
permissions:
pull-requests: write
steps:
- uses: actions/download-artifact@v4
- uses: github/webpack-bundlesize-compare-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
current-stats-json-path: ./head-stats/stats.json
base-stats-json-path: ./base-stats/stats.json
56 changes: 42 additions & 14 deletions .github/workflows/prod-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,19 @@ jobs:
# See matching warning for mdn/content checkout step
fetch-depth: 0

- name: Checkout (translated-content-de)
uses: actions/checkout@v4
if: ${{ ! vars.SKIP_BUILD || ! vars.SKIP_FUNCTION }}
with:
repository: mdn/translated-content-de
path: mdn/translated-content-de

- name: Move de into translated-content
if: ${{ ! vars.SKIP_BUILD || ! vars.SKIP_FUNCTION }}
run: |
mv mdn/translated-content-de/files/de mdn/translated-content/files/
rm -rf mdn/translated-content-de
- uses: actions/checkout@v4
if: ${{ ! vars.SKIP_BUILD }}
with:
Expand Down Expand Up @@ -215,20 +228,24 @@ jobs:

# Firefox Accounts and SubPlat settings
REACT_APP_FXA_SIGNIN_URL: /users/fxa/login/authenticate/
REACT_APP_FXA_SETTINGS_URL: https://accounts.firefox.com/settings/?brand=mozilla
REACT_APP_MDN_PLUS_SUBSCRIBE_URL: https://accounts.firefox.com/subscriptions/products/prod_LKvr8fYGbBxcaZ?brand=mozilla
REACT_APP_FXA_MANAGE_SUBSCRIPTIONS_URL: https://subscriptions.firefox.com/subscriptions/?brand=mozilla
REACT_APP_FXA_SETTINGS_URL: https://accounts.firefox.com/settings/
REACT_APP_MDN_PLUS_SUBSCRIBE_URL: https://accounts.firefox.com/subscriptions/products/prod_LKvr8fYGbBxcaZ
REACT_APP_FXA_MANAGE_SUBSCRIPTIONS_URL: https://subscriptions.firefox.com/subscriptions/

REACT_APP_MDN_PLUS_5M_PLAN: price_1KeG02JNcmPzuWtR1oBrw8o6
REACT_APP_MDN_PLUS_5Y_PLAN: price_1KeG02JNcmPzuWtRslZijhQu
REACT_APP_MDN_PLUS_10M_PLAN: price_1KeG02JNcmPzuWtRuAnIgNHh
REACT_APP_MDN_PLUS_10Y_PLAN: price_1KeG02JNcmPzuWtRlrSiLTI6

# Surveys.
REACT_APP_SURVEY_START_DISCOVERABILITY_AUG_2023: 1691409600000 # new Date("2023-08-07 12:00:00Z").getTime()
REACT_APP_SURVEY_END_DISCOVERABILITY_AUG_2023: 1691841600000 # new Date("2023-08-12 12:00:00Z").getTime()
REACT_APP_SURVEY_RATE_FROM_DISCOVERABILITY_AUG_2023: 0.0
REACT_APP_SURVEY_RATE_TILL_DISCOVERABILITY_AUG_2023: 0.10 # 10%
REACT_APP_SURVEY_START_HOMEPAGE_FEEDBACK_2024: 1731369600000 # new Date("2024-11-12Z").getTime()
REACT_APP_SURVEY_END_HOMEPAGE_FEEDBACK_2024: 1733184000000 # new Date("2024-12-03Z").getTime()
REACT_APP_SURVEY_RATE_FROM_HOMEPAGE_FEEDBACK_2024: 0.0
REACT_APP_SURVEY_RATE_TILL_HOMEPAGE_FEEDBACK_2024: 1 # 100%
REACT_APP_SURVEY_START_WEBDX_EDITING_2024: 1731628800000 # new Date("2024-11-15Z").getTime()
REACT_APP_SURVEY_END_WEBDX_EDITING_2024: 1732320000000 # new Date("2024-11-23Z").getTime()
REACT_APP_SURVEY_RATE_FROM_WEBDX_EDITING_2024: 0.0
REACT_APP_SURVEY_RATE_TILL_WEBDX_EDITING_2024: 0.1 # 10%

# Telemetry.
REACT_APP_GLEAN_CHANNEL: prod
Expand All @@ -243,6 +260,9 @@ jobs:
# Playground
REACT_APP_PLAYGROUND_BASE_HOST: mdnplay.dev

# Observatory
REACT_APP_OBSERVATORY_API_URL: https://observatory-api.mdn.mozilla.net

# Sentry.
SENTRY_DSN_BUILD: ${{ secrets.SENTRY_DSN_BUILD }}
SENTRY_ENVIRONMENT: prod
Expand All @@ -252,19 +272,20 @@ jobs:
REACT_APP_AI_FEEDBACK_GITHUB_REPO: mdn/ai-feedback

run: |
set -eo pipefail
# Info about which CONTENT_* environment variables were set and to what.
echo "CONTENT_ROOT=$CONTENT_ROOT"
echo "CONTENT_TRANSLATED_ROOT=$CONTENT_TRANSLATED_ROOT"
yarn build:sw
yarn build:prepare
yarn tool sync-translated-content
yarn tool sync-translated-content es fr ja ko pt-br ru zh-cn zh-tw
# Build using one process per locale.
# Note: We have 4 cores, but 9 processes is a reasonable number.
for locale in en-us es fr ja ko pt-br ru zh-cn zh-tw; do
yarn build --locale $locale 2>&1 | sed "s/^/[$locale] /" &
for locale in en-us de es fr ja ko pt-br ru zh-cn zh-tw; do
yarn build:docs --locale $locale 2>&1 | sed "s/^/[$locale] /" &
pids+=($!)
done
Expand All @@ -274,15 +295,18 @@ jobs:
du -sh client/build
# Generate sitemap index file
yarn build --sitemap-index
# Build the blog
yarn build:blog
# Build the curriculum
yarn build:curriculum
# Generate sitemap index file
yarn build --sitemap-index
# SSR all pages
yarn render:html
# Generate whatsdeployed files.
yarn tool whatsdeployed --output client/build/_whatsdeployed/code.json
yarn tool whatsdeployed $CONTENT_ROOT --output client/build/_whatsdeployed/content.json
Expand Down Expand Up @@ -337,14 +361,17 @@ jobs:
run: |-
npm ci
npm run build-redirects
npm run build-canonicals
- name: Deploy Function
if: ${{ ! vars.SKIP_FUNCTION }}
run: |-
set -eo pipefail
for region in europe-west1 us-west1 asia-east1; do
gcloud beta functions deploy mdn-prod-prod-$region \
--gen2 \
--runtime=nodejs18 \
--runtime=nodejs20 \
--region=$region \
--source=cloud-function \
--trigger-http \
Expand All @@ -360,6 +387,7 @@ jobs:
--set-env-vars="ORIGIN_PLAY=mdnplay.dev" \
--set-env-vars="SOURCE_CONTENT=https://storage.googleapis.com/${{ vars.GCP_BUCKET_NAME }}/main/" \
--set-env-vars="SOURCE_API=https://api.developer.mozilla.org/" \
--set-env-vars="ORIGIN_TRIAL_TOKEN=AxVILwizhbMjxFeHOn1P3R8niO1RJY/smaK4B4d1rLzc1gTaxtXMSaTi+FoigYgCw40uFRDwFcEAeqDR+vVLOW4AAABfeyJvcmlnaW4iOiJodHRwczovL2RldmVsb3Blci5tb3ppbGxhLm9yZyIsImZlYXR1cmUiOiJQcml2YXRlQXR0cmlidXRpb25WMiIsImV4cGlyeSI6MTc0MjA3OTYwMH0=" \
--set-env-vars="BSA_ENABLED=true" \
--set-env-vars="SENTRY_DSN=${{ secrets.SENTRY_DSN_CLOUD_FUNCTION }}" \
--set-env-vars="SENTRY_ENVIRONMENT=prod" \
Expand Down
Loading

0 comments on commit f55ed6e

Please sign in to comment.