Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH Actions runs, container, missing job and main instead of master #50

Merged
merged 9 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/actions/protocol-sync-workspace/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Sync workspace for protocol tests"
description: "Sync workspace for protocol tests"
inputs:
package-json-checksum:
description: "Checksum of package.json"
required: true
runs:
using: "composite"
steps:
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ inputs.package-json-checksum }}
- uses: actions/cache/restore@v3
id: cache_protocol
with:
path: packages/protocol/.tmp/released_chain
key: protocol-${{ github.sha }}
enableCrossOsArchive: true
fail-on-cache-miss: true
49 changes: 49 additions & 0 deletions .github/actions/sync-workspace/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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
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
82 changes: 23 additions & 59 deletions .github/workflows/circleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,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 All @@ -63,8 +65,8 @@ jobs:
run: |
set -euo pipefail
set -v
# To get the "master" branch mapping
git checkout master
# To get the "main" branch mapping
git checkout main
git checkout ${GITHUB_SHA}
# Verify that following commands work, they are later called in the incremental testing script
# Their output does not matter here, the fact that they finish successfully does.
Expand All @@ -74,7 +76,6 @@ jobs:
id: node-checksums
run: |
find . -maxdepth 5 -type f -name 'package.json' -not -path "*node_modules*" -print0 | sort -z | xargs -0 cat > $RUNNER_TEMP/package.checksum
find ./patches -type f -name '*.patch' -print0 | sort -z | xargs -0 cat >> $RUNNER_TEMP/package.checksum
echo "PACKAGE_JSON_CHECKSUM=$(md5sum $RUNNER_TEMP/package.checksum | cut -f1 -d' ')"
echo "PACKAGE_JSON_CHECKSUM=$(md5sum $RUNNER_TEMP/package.checksum | cut -f1 -d' ')" >> "$GITHUB_OUTPUT"
- name: Restore node cache
Expand Down Expand Up @@ -134,7 +135,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 +157,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 @@ -172,14 +177,7 @@ jobs:
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
- name: Upload Jest Test Results
uses: actions/upload-artifact@v3
Expand All @@ -190,11 +188,13 @@ 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: |
github.base_ref == 'master' || contains(github.base_ref, 'staging') || contains(github.base_ref, 'production') ||
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, ',yarn.lock') ||
false
Expand All @@ -209,58 +209,22 @@ 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
run: |
yarn --cwd=packages/sdk/identity test
transactions-uri-tests:
name: Transaction URI Tests
runs-on: ['self-hosted', '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
steps:
- uses: actions/cache/restore@v3
id: cache_git
with:
path: .git
key: git-${{ github.ref }}
- uses: actions/checkout@v3
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }}
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
with:
fetch_depth: '150'
- name: Generate DevChain
run: |
cd packages/sdk/identity
yarn test:reset
#- name: Generate DevChain
# run: |
# cd packages/sdk/identity
# yarn test:reset
- name: Run tests
run: |
yarn --cwd=packages/sdk/identity test

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') ||
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') ||
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@
]
},
"devDependencies": {
"@celo/typescript": "0.0.2",
"@babel/core": "^7.8.4",
"@babel/runtime": "^7.8.4",
"@changesets/cli": "^2.26.2",
"@tsconfig/recommended": "^1.0.3",
"@types/jest": "^29.1.1",
"@types/node": "18.7.16",
"@types/prompt": "1.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export async function thresholdCallToSigners<R extends OdisRequest>(
} = options

const manualAbort = new AbortController()
// @ts-ignore
const timeoutSignal = AbortSignal.timeout(requestTimeoutMS)
const abortSignal = abortSignalAny([manualAbort.signal, timeoutSignal])

Expand Down
1 change: 0 additions & 1 deletion packages/phone-number-privacy/combiner/src/common/io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export async function fetchSignerResponseWithFallback<R extends OdisRequest>(
[KEY_VERSION_HEADER]: keyVersion.toString()
},
body: JSON.stringify(request.body),
// @ts-expect-error -- wants a param for abortifThrown but thats not available on the incoming yet. @alec will fix it ;)
signal: abortSignal,
agent: url.startsWith("https://") ? httpsAgent : httpAgent
})
Expand Down
16 changes: 2 additions & 14 deletions packages/phone-number-privacy/combiner/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
{
"extends": "@tsconfig/recommended/tsconfig.json",
"compilerOptions": {
"plugins": [
{
"name": "typescript-tslint-plugin"
}
],
"lib": ["es2017"],
"module": "commonjs",
"strict": true,
"allowJs": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"sourceMap": true,
"declaration": true,
"target": "es2017",
"rootDir": "src",
"outDir": "./dist",
"skipLibCheck": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"preserveConstEnums": true,
"composite": true
"outDir": "dist"
},
"include": ["src"],
"compileOnSave": true
Expand Down
1 change: 1 addition & 0 deletions packages/phone-number-privacy/common/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ module.exports = {
lines: 80,
},
},
tsConfig: '<rootDir>/tsconfig.test.json',
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { hexToBuffer } from '@celo/base'
import { ContractKit } from '@celo/contractkit'
import Logger from 'bunyan'
import { Request } from 'express'
import { ErrorMessage, ErrorType } from '../../lib'
import { ErrorMessage, ErrorType } from '../../src/interfaces/errors'
import { AuthenticationMethod } from '../../src/interfaces/requests'
import * as auth from '../../src/utils/authentication'
import { newContractKitFetcher } from '../../src/utils/authentication'
Expand Down
16 changes: 2 additions & 14 deletions packages/phone-number-privacy/common/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
{
"extends": "@tsconfig/recommended",
"compilerOptions": {
"plugins": [
{
"name": "typescript-tslint-plugin"
}
],
"lib": ["es2017"],
"module": "commonjs",
"strict": true,
"allowJs": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"sourceMap": true,
"declaration": true,
"target": "es2017",
"rootDir": "src",
"outDir": "./lib",
"skipLibCheck": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"preserveConstEnums": true,
"composite": true
"outDir": "lib"
},
"include": ["src", "index.d.ts"],
"compileOnSave": true
Expand Down
15 changes: 15 additions & 0 deletions packages/phone-number-privacy/common/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "@tsconfig/recommended",
"compilerOptions": {
"plugins": [
{
"name": "typescript-tslint-plugin"
}
],
"declaration": true,
"rootDir": ".",
"outDir": "lib"
},
"exclude": ["node_modules", "lib", "dist", "coverage"],
"include": ["test", "src", "index.d.ts"],
}
2 changes: 1 addition & 1 deletion packages/phone-number-privacy/common/tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"extends": ["@celo/typescript/tslint.json"],
"rules": {
"no-global-arrow-functions": false,
"no-console": true
"no-console": true
}
}
16 changes: 2 additions & 14 deletions packages/phone-number-privacy/monitor/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
{
"extends": "@tsconfig/recommended/tsconfig.json",
"compilerOptions": {
"plugins": [
{
"name": "typescript-tslint-plugin"
}
],
"lib": ["es2017"],
"module": "commonjs",
"strict": true,
"allowJs": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"sourceMap": true,
"declaration": true,
"target": "es2017",
"rootDir": "src",
"outDir": "./dist",
"skipLibCheck": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"preserveConstEnums": true,
"composite": true
"outDir": "dist"
},
"include": ["src", "index.d.ts"],
"compileOnSave": true
Expand Down
Loading
Loading