Skip to content

Commit

Permalink
Adapt the actions to social-connect repo
Browse files Browse the repository at this point in the history
  • Loading branch information
jcortejoso authored Oct 2, 2023
1 parent 3901315 commit cb03bc5
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 29 deletions.
49 changes: 20 additions & 29 deletions .github/workflows/circleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,9 @@ defaults:

env:
# Increment these to force cache rebuilding
NODE_MODULE_CACHE_VERSION: 3
NODE_MODULE_CACHE_VERSION: 1
NODE_OPTIONS: '--max-old-space-size=4096'
TERM: dumb
GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.parallel=false -Dorg.gradle.configureondemand=true -Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"'
# Git Tag for contract release to use
RELEASE_TAG: ganache-v7-core-contracts.v9
# RELEASE_TAG: core-contracts.v9
# CELO_BLOCKCHAIN_BRANCH_TO_TEST: master
CELO_BLOCKCHAIN_BRANCH_TO_TEST: release/1.7.x

jobs:
install-dependencies:
Expand All @@ -45,7 +39,9 @@ jobs:
# Adding a initial comma so ',<path>' matches also for the first file
all_modified_files: ',${{ steps.changed-files.outputs.all_modified_files }}'
# runs-on: ubuntu-latest
runs-on: ['self-hosted', 'monorepo-node18']
runs-on: ['self-hosted', 'org', '8-cpu']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/celo-monorepo:node18
timeout-minutes: 30
steps:
- name: Restore .git cache
Expand Down Expand Up @@ -134,7 +130,9 @@ jobs:
- run: echo ",${{ steps.changed-files.outputs.all_modified_files }}"
lint-checks:
name: Lint code
runs-on: ['self-hosted', 'monorepo-node18']
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
steps:
Expand All @@ -154,7 +152,9 @@ jobs:
- run: yarn run lint
general_test:
name: General jest test
runs-on: ['self-hosted', 'monorepo-node18']
runs-on: ['self-hosted', 'org', '8-cpu']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/celo-monorepo:node18
needs: install-dependencies
steps:
- uses: actions/cache/restore@v3
Expand All @@ -170,17 +170,7 @@ jobs:
- name: Run Jest Tests
run: |
mkdir -p test-results/jest
# Skipping packages that are tested in a specific job below
yarn run lerna \
--ignore @celo/contractkit \
--ignore @celo/protocol \
--ignore @celo/celotool \
--ignore @celo/celocli \
--ignore @celo/env-tests \
--ignore @celo/identity \
--ignore @celo/transactions-uri \
--ignore '@celo/wallet-*' \
run test
yarn run lerna run test
- name: Upload Jest Test Results
uses: actions/upload-artifact@v3
with:
Expand All @@ -190,7 +180,9 @@ jobs:

identity-tests:
name: Identity Tests
runs-on: ['self-hosted', 'monorepo-node18']
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]
if: |
Expand Down Expand Up @@ -218,15 +210,14 @@ jobs:
yarn --cwd=packages/sdk/identity test
transactions-uri-tests:
name: Transaction URI Tests
runs-on: ['self-hosted', 'monorepo-node18']
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, contractkit-tests]
if: |
github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/protocol') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/dev-utils') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/sdk') ||
contains(needs.install-dependencies.outputs.all_modified_files, 'packages/typescript') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',package.json') ||
contains(needs.install-dependencies.outputs.all_modified_files, ',yarn.lock') ||
false
Expand Down Expand Up @@ -256,14 +247,14 @@ jobs:
odis-test:
name: ODIS test
runs-on: ['self-hosted', 'monorepo-node18']
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 == 'master' || 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
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/sync-workspace/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "Sync workspace"
description: "Sync GitHub Action workspace using GitHub cache"
inputs:
package-json-checksum:
description: "Checksum of package.json"
required: true
rebuild-package:
description: "Rebuild package. It also disable fail-on-cache-miss"
required: false
default: 'false'
runs:
using: "composite"
steps:
- uses: actions/cache/restore@v3
id: cache_node
env:
REBUILD_PACKAGE: ${{ inputs.rebuild-package }}
with:
path: |
node_modules
packages/**/node_modules
key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ inputs.package-json-checksum }}
enableCrossOsArchive: true
fail-on-cache-miss: "!${{ fromJSON(env.REBUILD_PACKAGE) }}"
- name: Restore build artifacts cache
uses: actions/cache/restore@v3
id: cache_build_artifacts
env:
REBUILD_PACKAGE: ${{ inputs.rebuild-package }}
with:
# We need to cache all the artifacts generated by yarn install+build
# Update this list also in .github/actions/sync-workspace/action.yml with exactly the same list
path: |
packages/**/lib
packages/**/dist
packages/**/build
packages/sdk/contractkit/src/generated
key: code-${{ github.sha }}
restore-keys: |
code-${{ github.sha }}
enableCrossOsArchive: true
fail-on-cache-miss: "!${{ fromJSON(env.REBUILD_PACKAGE) }}"
- name: Rebuild package
shell: bash --login -eo pipefail {0}
env:
REBUILD_PACKAGE: ${{ inputs.rebuild-package }}
if: ${{ fromJSON(env.REBUILD_PACKAGE) }}
run: |
yarn install
yarn build --ignore docs --include-dependencies

0 comments on commit cb03bc5

Please sign in to comment.