From 3f1763a54cbbeb4ad487e58314104fcbaaaac0c2 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Fri, 6 Oct 2023 16:41:05 +0200 Subject: [PATCH] CI Reorg (#78) * move combiner tests to be separate as they re long running, combine encrypted backup and identity as they are fast * rename group to CI checks * require changeset to be present as part of lint --------- Co-authored-by: Aaron --- .changeset/unlucky-scissors-wave.md | 2 + .github/workflows/circleci.yml | 71 +++++++++++++---------------- 2 files changed, 34 insertions(+), 39 deletions(-) create mode 100644 .changeset/unlucky-scissors-wave.md diff --git a/.changeset/unlucky-scissors-wave.md b/.changeset/unlucky-scissors-wave.md new file mode 100644 index 000000000..a845151cc --- /dev/null +++ b/.changeset/unlucky-scissors-wave.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index 932864d6e..314689452 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -1,5 +1,5 @@ -name: social connect -run-name: social connect tests +name: CI Checks +run-name: ci checks # Dockefile for the self-hosted runner: # https://github.com/celo-org/infrastructure/blob/master/terraform/root-modules/gcp/integration-tests-gke/files/github-arc/Dockerfile-monorepo @@ -38,7 +38,7 @@ env: jobs: install-dependencies: - name: Install dependencies + name: Install + Build + outputs: package-json-checksum: ${{ steps.node-checksums.outputs.PACKAGE_JSON_CHECKSUM }} # Propagate more outputs if you need https://github.com/tj-actions/changed-files#outputs @@ -124,15 +124,6 @@ jobs: if: steps.cache_node.outputs.cache-hit != 'true' run: | yarn check-licenses - - name: Detect files changed in PR, and expose as output - id: changed-files - uses: tj-actions/changed-files@v37 - with: - # Using comma as separator to be able to easily match full paths (using ,) - separator: ',' - # Checking if changed in the last 100 commits in PRs - fetch_depth: '150' - - run: echo ",${{ steps.changed-files.outputs.all_modified_files }}" lint-checks: name: Lint code runs-on: ['self-hosted', 'org', '8-cpu'] @@ -155,8 +146,20 @@ jobs: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - run: yarn run prettify:diff - run: yarn run lint + - name: Detect files changed in PR, and expose as output + id: changed-files + uses: tj-actions/changed-files@v37 + with: + # Using comma as separator to be able to easily match full paths (using ,) + separator: ',' + # Checking if changed in the last 100 commits in PRs + fetch_depth: '150' + - run: echo ",${{ steps.changed-files.outputs.all_modified_files }}" + - name: Has Changeset + id: changeset + run: yarn changeset status --since origin/main general_test: - name: General jest test + name: General (identity + encrypted-backup) test runs-on: ['self-hosted', 'org', '8-cpu'] container: image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/celo-monorepo:node18 @@ -172,30 +175,28 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - - name: Run Jest Tests + - name: Run Encrypted Backup tests run: | - mkdir -p test-results/jest - # Skipping packages that are tested in a specific job below - yarn run lerna \ - --ignore @celo/identity \ - run test + yarn --cwd=packages/sdk/encrypted-backup test + - name: Run Identity Tests + run: | + yarn --cwd=packages/sdk/identity test - name: Upload Jest Test Results uses: actions/upload-artifact@v3 with: name: Jest Test Results path: test-results/jest - - - identity-tests: - name: Identity Tests + combiner-test: + name: Combiner test runs-on: ['self-hosted', 'org', '8-cpu'] container: image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/celo-monorepo:node18 timeout-minutes: 30 - needs: [install-dependencies] + needs: install-dependencies if: | github.base_ref == 'main' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') || - contains(needs.install-dependencies.outputs.all_modified_files, 'packages/phone-number-privacy/common') || + contains(needs.install-dependencies.outputs.all_modified_files, 'packages/phone-number-privacy/combiner') || + contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || false steps: @@ -209,25 +210,20 @@ jobs: uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} - #- name: Generate DevChain - # run: | - # cd packages/sdk/identity - # yarn test:reset - - name: Run tests + - name: Run Tests for combiner run: | - yarn --cwd=packages/sdk/identity test + yarn --cwd=packages/phone-number-privacy/combiner test:coverage odis-test: - name: ODIS test + name: ODIS (signer + common) test + needs: install-dependencies runs-on: ['self-hosted', 'org', '8-cpu'] container: image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/celo-monorepo:node18 timeout-minutes: 30 - needs: [install-dependencies, lint-checks] + if: | github.base_ref == 'main' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') || contains(needs.install-dependencies.outputs.all_modified_files, 'packages/phone-number-privacy') || - contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') || - contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') || contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') || contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') || false @@ -245,9 +241,6 @@ jobs: - name: Run Tests for common package run: | yarn --cwd=packages/phone-number-privacy/common test:coverage - - name: Run Tests for combiner - run: | - yarn --cwd=packages/phone-number-privacy/combiner test:coverage - name: Run Tests for signer run: | - yarn --cwd=packages/phone-number-privacy/signer test:coverage + yarn --cwd=packages/phone-number-privacy/signer test:coverage \ No newline at end of file