Skip to content

chore(deps): update dependency cheerio to v1.0.0 #5925

chore(deps): update dependency cheerio to v1.0.0

chore(deps): update dependency cheerio to v1.0.0 #5925

Workflow file for this run

name: CI/CD
on:
pull_request: # Runs whenever a pull request is created or updated
push: # Runs whenever a commit is pushed to the repository
branches: [master, develop, beta, hotfix/*] # ...on any of these branches
workflow_call: # Runs whenever another workflow calls this workflow
inputs:
ref:
description: 'The branch or other ref to run this workflow on'
type: string
required: true
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
env:
CXX: g++-4.8
FASTLY_ACTIVATE_CHANGES: true
FASTLY_PURGE_ALL: true
NODE_ENV: production
SKIP_CLEANUP: true
jobs:
set-environment: # this job just a trick to DRY the environment logic
name: Set Environment
runs-on: ubuntu-latest
env:
GH_ENVIRONMENT: >-
${{
(
(github.ref == 'refs/heads/master') && 'production'
) ||
(
(
(github.ref == 'refs/heads/develop') ||
(github.ref == 'refs/heads/beta') ||
startsWith(github.ref, 'refs/heads/hotfix/') ||
startsWith(github.ref, 'refs/heads/release/')
) && 'staging'
) ||
''
}}
steps:
# apparently you're not allowed to have a job with no steps
- name: Report environment
run: |
echo "Environment: ${{ env.GH_ENVIRONMENT }}"
outputs:
environment: ${{ env.GH_ENVIRONMENT }}
should_deploy: ${{ (env.GH_ENVIRONMENT || '') != '' }}
build:
name: Build and Unit Tests
runs-on: ubuntu-latest
needs: set-environment
environment: ${{ needs.set-environment.outputs.environment }}
env:
SCRATCH_ENV: ${{ needs.set-environment.outputs.environment }}
SCRATCH_SHOULD_DEPLOY: ${{ needs.set-environment.outputs.should_deploy }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
ref: ${{ inputs.ref }} # this should be empty to use `checkout`'s default UNLESS provided by workflow_call
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
cache: 'npm'
node-version-file: '.nvmrc'
- name: info
run: |
cat <<EOF
Scratch environment: ${SCRATCH_ENV}
Should deploy: ${SCRATCH_SHOULD_DEPLOY}
Node version: $(node --version)
NPM version: $(npm --version)
github.workflow: ${{ github.workflow }}
github.event.pull_request.head.label: ${{ github.event.pull_request.head.label }}
github.head_ref: ${{ github.head_ref }}
github.ref: ${{ github.ref }}
EOF
- run: npm --production=false ci
- run: mkdir -p ./test/results
- name: lint
run: npm run test:lint:ci
- name: build
run: WWW_VERSION=${GITHUB_SHA:0:5} npm run build
env:
# webpack.config.js uses these with `DefinePlugin`
API_HOST: ${{ secrets.API_HOST }}
ROOT_URL: ${{ secrets.ROOT_URL }}
RECAPTCHA_SITE_KEY: ${{ secrets.RECAPTCHA_SITE_KEY }}
ASSET_HOST: ${{ secrets.ASSET_HOST }}
BACKPACK_HOST: ${{ secrets.BACKPACK_HOST }}
CLOUDDATA_HOST: ${{ secrets.CLOUDDATA_HOST }}
PROJECT_HOST: ${{ secrets.PROJECT_HOST }}
STATIC_HOST: ${{ secrets.STATIC_HOST }}
ONBOARDING_TEST_ACTIVE: "${{ vars.ONBOARDING_TEST_ACTIVE }}"
ONBOARDING_TEST_PROJECT_IDS: "${{ vars.ONBOARDING_TEST_PROJECT_IDS }}"
ONBOARDING_TESTING_STARTING_DATE: "${{ vars.ONBOARDING_TESTING_STARTING_DATE }}"
ONBOARDING_TESTING_ENDING_DATE: "${{ vars.ONBOARDING_TESTING_ENDING_DATE }}"
QUALITATIVE_FEEDBACK_ACTIVE: "${{ vars.QUALITATIVE_FEEDBACK_ACTIVE }}"
QUALITATIVE_FEEDBACK_STARTING_DATE: "${{ vars.QUALITATIVE_FEEDBACK_STARTING_DATE }}"
QUALITATIVE_FEEDBACK_IDEAS_GENERATOR_USER_FREQUENCY: "${{ vars.QUALITATIVE_FEEDBACK_IDEAS_GENERATOR_USER_FREQUENCY }}"
QUALITATIVE_FEEDBACK_STARTER_PROJECTS_USER_FREQUENCY: "${{ vars.QUALITATIVE_FEEDBACK_STARTER_PROJECTS_USER_FREQUENCY }}"
QUALITATIVE_FEEDBACK_DEBUGGING_USER_FREQUENCY: "${{ vars.QUALITATIVE_FEEDBACK_DEBUGGING_USER_FREQUENCY }}"
QUALITATIVE_FEEDBACK_TUTORIALS_USER_FREQUENCY: "${{ vars.QUALITATIVE_FEEDBACK_TUTORIALS_USER_FREQUENCY }}"
QUALITATIVE_FEEDBACK_ENDING_DATE: "${{ vars.QUALITATIVE_FEEDBACK_ENDING_DATE }}"
IDEAS_GENERATOR_SOURCE: "${{ vars.IDEAS_GENERATOR_SOURCE }}"
# used by src/template-config.js
GTM_ID: ${{ secrets.GTM_ID }}
GTM_ENV_AUTH: ${{ secrets.GTM_ENV_AUTH }}
- name: unit tests
run: |
JEST_JUNIT_OUTPUT_NAME=unit-jest-results.xml npm run test:unit:jest:unit -- --reporters=jest-junit
JEST_JUNIT_OUTPUT_NAME=localization-jest-results.xml npm run test:unit:jest:localization -- --reporters=jest-junit
npm run test:unit:tap -- --output-file ./test/results/unit-raw.tap
npm run test:unit:convertReportToXunit
- name: compress artifacts
if: ${{ needs.set-environment.outputs.should_deploy == 'true' }}
env:
ZSTD_NBTHREADS: 0 # tell zstd to automatically choose thread count
run: |
mkdir -p artifacts/
tar -cavf artifacts/build.tar.zst build
- name: "upload artifact: build"
if: ${{ needs.set-environment.outputs.should_deploy == 'true' }}
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4
with:
name: build
path: artifacts/build.tar.zst
compression-level: 0 # don't re-compress compressed data
- name: save node_modules for other jobs
if: ${{ needs.set-environment.outputs.should_deploy == 'true' }}
uses: actions/cache/save@v4
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('.nvmrc', 'package-lock.json') }}
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [set-environment, build]
environment: ${{ needs.set-environment.outputs.environment }}
env:
SCRATCH_ENV: ${{ needs.set-environment.outputs.environment }}
if: ${{ needs.set-environment.outputs.should_deploy == 'true' }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
ref: ${{ inputs.ref }} # this should be empty to use `checkout`'s default UNLESS provided by workflow_call
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version-file: '.nvmrc'
- name: info
run: |
cat <<EOF
Scratch environment: ${SCRATCH_ENV}
Node version: $(node --version)
NPM version: $(npm --version)
EOF
- name: retrieve node_modules
uses: actions/cache/restore@v4
with:
fail-on-cache-miss: true
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('.nvmrc', 'package-lock.json') }}
- name: setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- run: pip install s3cmd==2.4.0
- name: download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
# if `name` is not specified, it will download all artifacts
path: artifacts/
# upload-artifact makes a ZIP file with the provided `name` (default: `artifact`)
# by default, download-artifact will extract that ZIP file into a subdirectory with the same name
merge-multiple: true # don't make a subdirectory for each artifact name
- name: extract artifacts
env:
ZSTD_NBTHREADS: 0 # tell zstd to automatically choose thread count
run: |
ls -lRh artifacts/
tar -xavf artifacts/build.tar.zst
- name: deploy
# This also uses SCRATCH_ENV, defined at the job level
run: npm run deploy
env:
S3_LOCAL_DIR: build
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
FASTLY_API_KEY: ${{ secrets.FASTLY_API_KEY }}
FASTLY_SERVICE_ID: ${{ secrets.FASTLY_SERVICE_ID }}
SCRATCH_BRANCH: ${{ github.ref_name }}
SLACK_WEBHOOK_CIRCLECI_NOTIFICATIONS: ${{ secrets.SLACK_WEBHOOK_CIRCLECI_NOTIFICATIONS }} # TODO: rename or replace
SLACK_WEBHOOK_ENGINEERING: ${{ secrets.SLACK_WEBHOOK_ENGINEERING }}
SLACK_WEBHOOK_MODS: ${{ secrets.SLACK_WEBHOOK_MODS }}
RADISH_URL: ${{ vars.RADISH_URL }}
integration-tests:
name: Production Integration Tests
runs-on: ubuntu-latest
needs: [set-environment, deploy]
environment: ${{ needs.set-environment.outputs.environment }}
# GHA can't reach staging
# TODO: Run integration tests against localhost? Not only would that let us test any and all branches,
# but we could also, I dunno, consider fully testing _before_ we deploy? :sweat_smile:
if: ${{ needs.set-environment.outputs.environment == 'production' }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
ref: ${{ inputs.ref }} # this should be empty to use `checkout`'s default UNLESS provided by workflow_call
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version-file: '.nvmrc'
- name: retrieve node_modules
uses: actions/cache/restore@v4
with:
fail-on-cache-miss: true
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('.nvmrc', 'package-lock.json') }}
- name: download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
# if `name` is not specified, it will download all artifacts
path: artifacts/
# upload-artifact makes a ZIP file with the provided `name` (default: `artifact`)
# by default, download-artifact will extract that ZIP file into a subdirectory with the same name
merge-multiple: true # don't make a subdirectory for each artifact name
- name: extract artifacts
env:
ZSTD_NBTHREADS: 0 # tell zstd to automatically choose thread count
run: |
tar -xavf artifacts/build.tar.zst
- name: integration tests
run: |
# if the health test fails, there's no point in trying to run the integration tests
npm run test:health
# health test succeeded, so proceed with integration tests
JEST_JUNIT_OUTPUT_NAME=integration-jest-results.xml npm run test:integration -- --reporters=jest-junit
env:
ROOT_URL: ${{ secrets.ROOT_URL }}
# test/integration-legacy/selenium-helpers.js
CI: "true"
CIRCLECI: "true" # TODO
CIRCLE_BUILD_NUM: ${{ github.run_id }} # TODO
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SMOKE_REMOTE: "true" # use Sauce Labs
# test/integration/*
SMOKE_USERNAME: ${{ secrets.SMOKE_USERNAME }}
SMOKE_PASSWORD: ${{ secrets.SMOKE_PASSWORD }}
COMMENT_PROJECT_ID: ${{ secrets.COMMENT_PROJECT_ID }}
COMMENT_STUDIO_ID: ${{ secrets.COMMENT_STUDIO_ID }}
UNOWNED_SHARED_PROJECT_ID: ${{ secrets.UNOWNED_SHARED_PROJECT_ID }}
OWNED_SHARED_PROJECT_ID: ${{ secrets.OWNED_SHARED_PROJECT_ID }}
OWNED_UNSHARED_PROJECT_ID: ${{ secrets.OWNED_UNSHARED_PROJECT_ID }}
UNOWNED_UNSHARED_PROJECT_ID: ${{ secrets.UNOWNED_UNSHARED_PROJECT_ID }}
UNOWNED_SHARED_SCRATCH2_PROJECT_ID: ${{ secrets.UNOWNED_SHARED_SCRATCH2_PROJECT_ID }}
OWNED_UNSHARED_SCRATCH2_PROJECT_ID: ${{ secrets.OWNED_UNSHARED_SCRATCH2_PROJECT_ID }}
TEST_STUDIO_ID: ${{ secrets.TEST_STUDIO_ID }}
RATE_LIMIT_CHECK: ${{ secrets.RATE_LIMIT_CHECK }}