Skip to content

Commit

Permalink
Merge branch 'master' into jcortejoso/test-blockchain-1.8.x-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
lvpeschke authored Nov 30, 2023
2 parents be7c8ff + bfbec57 commit ac37b3f
Show file tree
Hide file tree
Showing 146 changed files with 8,488 additions and 10,884 deletions.
5 changes: 0 additions & 5 deletions .changeset/beige-planes-sort.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/breezy-ants-refuse.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/four-cooks-rhyme.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/lemon-rice-cry.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/radical-monkey-play.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/sixty-squids-warn.md

This file was deleted.

1 change: 0 additions & 1 deletion .github/actions/sync-workspace/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ runs:
key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}
enableCrossOsArchive: true
fail-on-cache-miss: "!${{ fromJSON(env.REBUILD_PACKAGE) }}"

- name: Restore build artifacts cache
uses: actions/cache/restore@v3
id: cache_build_artifacts
Expand Down
63 changes: 45 additions & 18 deletions .github/workflows/celo-monorepo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ on:
push:
branches:
- master
- changeset-release/master
pull_request:
branches:
- master
- prerelease/*
- 'release/**'
- 'prerelease/**'

concurrency:
group: celo-monorepo-${{ github.ref }}
Expand Down Expand Up @@ -55,7 +57,6 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Restore node cache
uses: actions/cache@v3
Expand All @@ -75,22 +76,42 @@ jobs:
- name: Run yarn postinstall if cache hitted
run: yarn run postinstall
if: steps.cache_node.outputs.cache-hit == 'true'
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v16
with:
fail-if-changed: 'true'
fail-message: 'Files changed during build. Please build locally and commit the changes.'
- name: Build packages
run: yarn build --ignore docs --include-dependencies
- name: Check licenses
if: steps.cache_node.outputs.cache-hit != 'true'
run: |
yarn check-licenses
# Get a list of submodules to ignore in the changed files check
- name: Get submodules to ignore in changed files check
id: get_submodules_to_ignore
run: |
# Get all the submodules paths
submodules=$(git config --file .gitmodules --name-only --get-regexp path)
# Remove the "submodule." prefix and ".path" suffix
submodules=$(echo $submodules | sed 's/^submodule.//g')
submodules=$(echo $submodules | sed 's/.path$//g')
# Add a ! in front of each path to ignore it latter in the changed files check
submodules=$(echo $submodules | sed 's/^/!/g')
echo "submodules<<EOF" >> $GITHUB_OUTPUT
echo "$submodules" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# Get workdir local changes and fail if there are any change
- name: Verify Changed files
id: verify-changed-files
uses: tj-actions/verify-changed-files@v16
with:
fail-if-changed: 'true'
fail-message: 'Files changed during build. Please build locally and commit the changes.'
files: |
**/*
${{ steps.get_submodules_to_ignore.outputs.submodules }}
- run: |
echo "${{ steps.verify-changed-files.outputs.changed_files }}"
- name: Get the artifacts to cache
id: get_artifacts_to_cache
run: |
artifacts_to_cache="$(git ls-files --others --ignored --exclude-standard | grep -v node_modules)"
echo "artifacts_to_cache<<EOF" >> $GITHUB_OUTPUT
echo "$artifacts_to_cache" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
Expand All @@ -107,7 +128,7 @@ jobs:
key: code-${{ github.sha }}
restore-keys: |
code-${{ github.sha }}
- name: Detect files changed in PR, and expose as output
- name: Detect files changed in PR (or commit), and expose as output
id: changed-files
uses: tj-actions/changed-files@v37
with:
Expand All @@ -116,13 +137,16 @@ jobs:
# 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', 'monorepo-node18']
timeout-minutes: 30
needs: install-dependencies
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
Expand All @@ -135,6 +159,8 @@ jobs:
needs: install-dependencies
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
Expand All @@ -149,7 +175,6 @@ jobs:
--ignore @celo/celotool \
--ignore @celo/celocli \
--ignore @celo/env-tests \
--ignore @celo/transactions-uri \
--ignore '@celo/wallet-*' \
run test
- name: Upload Jest Test Results
Expand All @@ -164,6 +189,8 @@ jobs:
needs: install-dependencies
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
Expand Down Expand Up @@ -300,10 +327,6 @@ jobs:
uses: ./.github/actions/sync-workspace
with:
artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }}
- name: Generate DevChain
run: |
cd packages/sdk/contractkit
yarn test:reset
- name: Run tests
run: |
yarn --cwd=packages/sdk/contractkit test
Expand Down Expand Up @@ -332,10 +355,6 @@ jobs:
uses: ./.github/actions/sync-workspace
with:
artifacts_to_cache: ${{ needs.install-dependencies.outputs.artifacts_to_cache }}
- name: Generate DevChain
run: |
cd packages/cli
yarn test:reset
- name: Run tests
run: |
yarn --cwd=packages/cli test
Expand Down Expand Up @@ -365,6 +384,8 @@ jobs:
false
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
Expand Down Expand Up @@ -392,6 +413,8 @@ jobs:
false
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
Expand Down Expand Up @@ -419,6 +442,8 @@ jobs:
false
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
Expand Down Expand Up @@ -566,6 +591,8 @@ jobs:
./specs/scripts/reserve.sh
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Sync workspace
uses: ./.github/actions/sync-workspace
with:
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/publish-contracts-abi-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Publish ABIs and Solidity files to NPM
on:
push:
branches: [main]
pull_request:

release:
types: [released]
workflow_dispatch:
inputs:
npm_version:
description: 'NPM version'
required: true
type: string
jobs:
publish:
runs-on: ['self-hosted', 'org', 'npm-publish']
permissions:
contents: write
id-token: write
pull-requests: write
repository-projects: write
steps:
- uses: actions/checkout@v4
- name: Akeyless Get Secrets
id: get_auth_token
uses: docker://us-west1-docker.pkg.dev/devopsre/akeyless-public/akeyless-action:latest
with:
api-url: https://api.gateway.akeyless.celo-networks-dev.org
access-id: p-kf9vjzruht6l
static-secrets: '{"/static-secrets/NPM/npm-publish-token":"NPM_TOKEN"}'

# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
#scope: '@celo'

- name: 'Setup yarn'
shell: bash
run: |
npm install --global yarn
source ~/.bashrc
- name: 'Install packages'
shell: bash
run: yarn

- name: 'Build all packages'
run: yarn build

- name: Check if a release should be published
run: yarn --silent is_contract_release >> "$GITHUB_ENV"
working-directory: packages/protocol
env:
GITHUB_TAG: ${{ github.ref_name }}
INPUT_VERSION: ${{ inputs.npm_version }}

- name: Compile solidity contracts and typescript files
run: yarn prepare_contracts_and_abis_publishing
working-directory: packages/protocol
env:
RELEASE_TYPE: ${{ env.RELEASE_TYPE }}
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}

- name: Publish @celo/contracts
run: npm publish $RELEASE_TYPE $DRY_RUN
working-directory: packages/protocol/contracts
env:
RELEASE_TYPE: ${{ env.RELEASE_TYPE != '' && '--tag $RELEASE_TYPE' || '' }}
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }}
DRY_RUN: ${{ env.RELEASE_VERSION == '' && '--dry-run' || '' }}

- name: Publish @celo/abis
run: npm publish $RELEASE_TYPE $DRY_RUN
working-directory: packages/protocol/abis
env:
RELEASE_TYPE: ${{ env.RELEASE_TYPE != '' && '--tag $RELEASE_TYPE' || '' }}
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }}
DRY_RUN: ${{ env.RELEASE_VERSION == '' && '--dry-run' || '' }}
5 changes: 3 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release to NPM
name: Prepare or Publish
runs-on: ['self-hosted', 'org', 'npm-publish']
permissions:
contents: write
Expand All @@ -29,7 +29,7 @@ jobs:
with:
api-url: https://api.gateway.akeyless.celo-networks-dev.org
access-id: p-kf9vjzruht6l
static-secrets: '{"/static-secrets/apps-tooling-circle/npm-publish-token":"NPM_TOKEN"}'
static-secrets: '{"/static-secrets/NPM/npm-publish-token":"NPM_TOKEN"}'
- name: Setup Node.js 18.x
uses: actions/setup-node@v3
with:
Expand All @@ -51,3 +51,4 @@ jobs:
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: yarn release
version: yarn version-and-reinstall
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "packages/protocol/lib/celo-foundry"]
path = packages/protocol/lib/celo-foundry
url = https://github.com/bowd/celo-foundry
url = https://github.com/celo-org/celo-foundry
[submodule "packages/protocol/lib/solidity-bytes-utils"]
path = packages/protocol/lib/solidity-bytes-utils
url = https://github.com/GNSPS/solidity-bytes-utils
Expand Down
3 changes: 2 additions & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ Bypassing rate-limits
Clickjacking on pages with no sensitive actions
Host header injection without proven business impact
Anything related to email spoofing, SPF, DMARC or DKIM
Open ports without an accompanying proof-of-concept demonstrating vulnerability
Open ports without an accompanying proof-of-concept demonstrating vulnerability
Open write access of documents pertain to the community

# General
----------------------------------------------------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions dependency-graph.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"@celo/base",
"@celo/connect",
"@celo/cryptographic-utils",
"@celo/phone-utils",
"@celo/typescript",
"@celo/utils",
"@celo/wallet-local"
Expand Down Expand Up @@ -90,7 +89,6 @@
"@celo/base",
"@celo/connect",
"@celo/dev-utils",
"@celo/phone-utils",
"@celo/protocol",
"@celo/utils",
"@celo/wallet-local"
Expand Down
9 changes: 4 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
module.exports = {
collectCoverageFrom: ['**/src/**/*.ts?(x)', '!**/*.d.ts'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testMatch: ['**/?(*.)(spec|test).ts?(x)'],
collectCoverageFrom: ['**/src/**/*.ts', '!**/*.d.ts'],
moduleFileExtensions: ['ts', 'js', 'json', 'node'],
testMatch: ['**/?(*.)(spec|test).ts'],
transform: {
'\\.(ts|tsx)$': 'ts-jest',
'^.+\\.jsx?$': 'babel-jest',
'\\.ts$': 'ts-jest',
},
}
Loading

0 comments on commit ac37b3f

Please sign in to comment.