diff --git a/.circleci/config.yml b/.circleci/config.yml index c1c44553..9454be12 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,119 +1,16 @@ -# Note: YAML anchors allow an object to be re-used, reducing duplication. -# The ampersand declares an alias for an object, then later the `<<: *name` -# syntax dereferences it. -# See https://blog.daemonl.com/2016/02/yaml.html -# To validate changes, use an online parser, eg. -# https://yaml-online-parser.appspot.com/ +# This config is remaining in place to prevent pull requests failing because of CircleCI config missing. -# CircleCI configuration version -# Version 2.1 allows for extra config reuse features -# https://circleci.com/docs/2.0/reusing-config/#getting-started-with-config-reuse version: 2.1 -orbs: - browser-tools: circleci/browser-tools@1.4.8 - devinfra: angular/dev-infra@1.0.9 - -# Cache key for CircleCI. We want to invalidate the cache whenever the Yarn lock file changes. -var_1: &cache_key material-angular-io-{{ .Branch }}-{{ checksum "yarn.lock" }} -var_2: &default_docker_image cimg/node:20.11.1-browsers - -# Settings common to each job -var_3: &job_defaults - working_directory: ~/material-angular-io - docker: - - image: *default_docker_image - -var_4: &save_cache - save_cache: - key: *cache_key - paths: - - 'node_modules' - -var_5: &yarn_install - run: - name: 'Installing project dependencies' - command: yarn install --immutable - no_output_timeout: 20m - -# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs -# https://circleci.com/blog/deep-diving-into-circleci-workspaces/ -var_6: &workspace_location ~/ - -commands: - store_build_output: - description: 'Stores build artifacts' - steps: - - run: - name: Move compiled apps to workspace - command: | - set -exu - mkdir -p ~/dist - mv dist/* ~/dist/ - - persist_to_workspace: - root: *workspace_location - paths: - - dist - jobs: - lint: - <<: *job_defaults - steps: - - checkout - - restore_cache: - key: *cache_key - - *yarn_install - - run: yarn lint - - *save_cache - - build: - <<: *job_defaults - # We generate a lot of chunks with our build. To improve stability and to reduce - # the amount it takes to run, we use a higher resource class with better VM specs. - # https://circleci.com/docs/2.0/configuration-reference/#resource_class - resource_class: large - steps: - - checkout - - restore_cache: - key: *cache_key - - *yarn_install - - run: yarn prod-build - - *save_cache - - store_build_output - - test: - <<: *job_defaults - steps: - - checkout - - restore_cache: - key: *cache_key - - *yarn_install - - browser-tools/install-browser-tools - - run: yarn test --watch false --progress=false - - lighthouse_audits: - <<: *job_defaults + pass: + docker: + - image: cimg/base:2022.05 steps: - - attach_workspace: - at: *workspace_location - - checkout - - browser-tools/install-chrome - - restore_cache: - key: *cache_key - - *yarn_install - - browser-tools/install-browser-tools - - run: - command: yarn test:audit:ci - environment: - CHROMIUM_BIN: '/usr/bin/google-chrome' + - run: echo "This too shall pass (always)" workflows: version: 2 default_workflow: jobs: - - lint - - build - - test - - lighthouse_audits: - requires: - - build + - pass diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..8e2ccbc4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,76 @@ +name: CI + +on: + push: + branches: + - main + - "[0-9]+.[0-9]+.x" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: {} + +defaults: + run: + shell: bash + +env: + # TODO: Remove when pnpm is exclusively used. + ASPECT_RULES_JS_FROZEN_PNPM_LOCK: "1" + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Initialize environment + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@db91da4e742cd081bfba01db2edc4e816018419b + - name: Install node modules + run: yarn install --immutable + - name: Execute Linting + run: yarn bazel test --test_tag_filters=lint //... + + build: + runs-on: ubuntu-latest + steps: + - name: Initialize environment + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@db91da4e742cd081bfba01db2edc4e816018419b + - name: Install node modules + run: yarn install --immutable + - name: Execute Direct Production Build (deploy usage) + run: yarn prod-build + - name: Execute Build via Bazel + run: yarn bazel build //... + + test: + runs-on: ubuntu-latest + steps: + - name: Initialize environment + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@db91da4e742cd081bfba01db2edc4e816018419b + - name: Install node modules + run: yarn install --immutable + - name: Execute Tests + run: yarn bazel test --test_tag_filters=-lint,-e2e,-audit //... + - name: Store Test Logs + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + with: + name: test-logs + path: bazel-testlogs/ + retention-days: 14 + + lighthouse: + runs-on: ubuntu-latest + steps: + - name: Initialize environment + uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@db91da4e742cd081bfba01db2edc4e816018419b + - name: Install node modules + run: yarn install --immutable + - name: Execute Lighthouse Audit + run: yarn bazel test --test_tag_filters=audit //... + - name: Store Audit Logs + uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + with: + name: lighthouse-logs + path: bazel-testlogs/ + retention-days: 14 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6f59efb0..7d1a6fe4 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -16,7 +16,7 @@ defaults: env: # TODO: Remove when pnpm is exclusively used. - ASPECT_RULES_JS_FROZEN_PNPM_LOCK: '1' + ASPECT_RULES_JS_FROZEN_PNPM_LOCK: "1" jobs: lint: @@ -36,7 +36,9 @@ jobs: uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@db91da4e742cd081bfba01db2edc4e816018419b - name: Install node modules run: yarn install --immutable - - name: Execute Build + - name: Execute Direct Production Build (deploy usage) + run: yarn prod-build + - name: Execute Build via Bazel run: yarn bazel build //... test: