Skip to content

Commit

Permalink
Merge pull request #821 from bnb-chain/develop
Browse files Browse the repository at this point in the history
release: prepare release for v0.2.3-alpha.2
  • Loading branch information
fynnss authored Jul 13, 2023
2 parents 9f884ef + 54867a4 commit cc083dc
Show file tree
Hide file tree
Showing 262 changed files with 22,064 additions and 5,020 deletions.
4 changes: 2 additions & 2 deletions .github/commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const validateTypeNums = (parsedCommit) => {
module.exports = {
parserPreset: {
parserOpts: {
headerPattern: /^(.*):.*/,
headerPattern: /.*/,
}
},
extends: ['@commitlint/config-conventional'],
Expand All @@ -39,4 +39,4 @@ module.exports = {
72,
],
},
}
}
14 changes: 6 additions & 8 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@ on:
branches:
- master
- develop
- ci-*
- release*
- fix-release*
- feat-*

pull_request:
branches:
- master
- develop
- ci-*
- release*
- fix-release*
- feat-*

jobs:
build-test:
Expand All @@ -22,17 +26,11 @@ jobs:
go-version: [1.20.x]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
env:
GOPRIVATE: github.com/bnb-chain
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Setup GitHub Token
run: git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/

- name: Checkout code
uses: actions/checkout@v3

Expand All @@ -57,7 +55,7 @@ jobs:
version: 1.14.0
buf_user: "${{ secrets.BUF_REGISTRY_USER }}"
buf_api_token: "${{ secrets.BUF_REGISTRY_SECRET }}"

- name: Install Protoc
uses: arduino/setup-protoc@v1

Expand Down Expand Up @@ -99,4 +97,4 @@ jobs:
# SLACK_ICON_EMOJI: ':x:'
# SLACK_COLOR: danger
# SLACK_MESSAGE: Greenfield SP build test failed
# SLACK_FOOTER: ''
# SLACK_FOOTER: ''
10 changes: 4 additions & 6 deletions .github/workflows/code-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,31 @@ on:
branches:
- master
- develop
- ci-*
- release*
- fix-release*
- feat-*

pull_request:
branches:
- master
- develop
- ci-*
- release*
- fix-release*
- feat-*

jobs:
golangci:
name: golangci-lint
runs-on: ${{ matrix.os }}
env:
GOPRIVATE: github.com/bnb-chain
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
timeout-minutes: 8
strategy:
matrix:
go-version: [1.20.x]
os: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v3
- name: Setup GitHub Token
run: git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/

- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
Expand Down
70 changes: 36 additions & 34 deletions .github/workflows/commit-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,54 +5,56 @@ on:
branches:
- master
- develop
- ci-*
- release*
- fix-release*

- feat-*

pull_request:
branches:
- master
- develop
- ci-*
- release*
- fix-release*

- feat-*

jobs:
commit-message-lint:
strategy:
matrix:
node-version: [14.x]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
# commit-message-lint:
# strategy:
# matrix:
# node-version: [14.x]
# os: [ ubuntu-latest ]
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# - uses: actions/setup-node@v3
# with:
# node-version: ${{ matrix.node-version }}

- uses: actions/cache@v3
with:
path: |
~/.npm
**/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# - uses: actions/cache@v3
# with:
# path: |
# ~/.npm
# **/node_modules
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-node-

- name: Install Deps
run: |
npm install -g commitlint-plugin-function-rules @commitlint/cli
npm install --save-dev commitlint-plugin-function-rules @commitlint/cli
# - name: Install Deps
# run: |
# npm install -g commitlint-plugin-function-rules @commitlint/cli
# npm install --save-dev commitlint-plugin-function-rules @commitlint/cli

- uses: wagoid/commitlint-github-action@v5
id: commitlint
env:
NODE_PATH: ${{ github.workspace }}/node_modules
with:
configFile: /github/workspace/.github/commitlint.config.js
# - uses: wagoid/commitlint-github-action@v5
# id: commitlint
# env:
# NODE_PATH: ${{ github.workspace }}/node_modules
# with:
# configFile: /github/workspace/.github/commitlint.config.js

branch-naming-lint:
strategy:
Expand All @@ -66,4 +68,4 @@ jobs:
allowed_prefixes: 'build,chore,ci,docs,feat,fix,perf,refactor,revert,style,test'
ignore: master,develop,release
min_length: 5
max_length: 30
max_length: 30
52 changes: 52 additions & 0 deletions .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Docker-CI

on:
push:
branches: [ ci-* ]

env:
IMAGE_NAME: ghcr.io/bnb-chain/greenfield-storage-provider-invisible
IMAGE_SOURCE: https://github.com/bnb-chain/greenfield-storage-provider

jobs:
# Push image to GitHub Packages.
push:
strategy:
matrix:
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v3

- uses: bufbuild/buf-setup-action@v1.14.0
with:
version: 1.14.0
buf_user: "${{ secrets.BUF_REGISTRY_USER }}"
buf_api_token: "${{ secrets.BUF_REGISTRY_SECRET }}"

- name: Install Protoc
uses: arduino/setup-protoc@v1

- run: |
make install-tools
make buf-gen
- name: Build image
run: |
docker build . \
--build-arg "GH_TOKEN=${{ secrets.GH_SECRET }}" \
--label "org.opencontainers.image.source=${IMAGE_SOURCE}" \
--label "org.opencontainers.image.revision=$(git rev-parse HEAD)" \
--label "org.opencontainers.image.licenses=LGPL-3.0,GPL-3.0" \
-f ./Dockerfile -t "${IMAGE_NAME}"
- name: Log into registry
run: echo "${{ secrets.GH_SECRET }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
VERSION=$(echo "${{ github.sha }}" | sed -e 's,.*/\(.*\),\1,')
docker tag $IMAGE_NAME $IMAGE_NAME:$VERSION
docker push $IMAGE_NAME:$VERSION
1 change: 0 additions & 1 deletion .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,3 @@ jobs:
docker tag $IMAGE_NAME $IMAGE_NAME:latest
docker push $IMAGE_NAME:$VERSION
docker push $IMAGE_NAME:latest
83 changes: 32 additions & 51 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,19 @@ on:
branches:
- master
- develop
- ci-*
- release*
- fix-release*
- feat-*

pull_request:
branches:
- master
- develop
- ci-*
- release*
- fix-release*

env:
GreenfieldTag: v0.2.1-alpha.1
GreenfieldIntegrationTestBranch: sp-refactor-0.2.1-new-sdk
GOPRIVATE: github.com/bnb-chain
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
MYSQL_USER: root
MYSQL_PASSWORD: root
MYSQL_ROOT_PASSWORD: root
MYSQL_IP: 127.0.0.1
MYSQL_PORT: 3306
- feat-*

jobs:
e2e-test:
Expand All @@ -39,54 +32,42 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Setup GitHub Token
run: git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/
# Checkout Greenfield-SP
- name: Checkout Greenfield-SP
uses: actions/checkout@v3
# Build Greenfield
- name: Build Greenfield
run: |
git clone https://github.com/bnb-chain/greenfield.git
cd greenfield
git checkout ${{ env.GreenfieldTag }}
make proto-gen & make build
cd ..
# Build Greenfield-SP
- name: Build Greenfield-SP
run: |
make install-tools
make build
# Run MySQL
- name: Run MySQL
run: |
sudo /etc/init.d/mysql start
# Run Greenfield
- name: Run Greenfield
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Install dependencies
run: npm install ethers
# generate test private key
- name: Generate private key
run: node ./.github/workflows/generate-private-key.js
id: generate-private-key
- name: set private key and account address as job variables
run: |
echo "Private key: ${{ steps.generate-private-key.outputs.private_key }}"
echo "Account address: ${{ steps.generate-private-key.outputs.account_address }}"
echo "PRIVATE_KEY=${{ steps.generate-private-key.outputs.private_key }}" >> "$GITHUB_ENV"
echo "ACCOUNT_ADDR=${{ steps.generate-private-key.outputs.account_address }}" >> "$GITHUB_ENV"
# Build and Start Greenfield Blockchain
- name: Build and Start Greenfield Blockchain
run: |
bash ./test/e2e/spworkflow/e2e_test.sh --startChain
# # Build and Start Greenfield SP
- name: Build and Start Greenfield SP
run: |
cd greenfield
bash ./deployment/localup/localup.sh all 1 7
bash ./deployment/localup/localup.sh export_sps 1 7 > sp.json
cd ..
# Run Greenfield-SPs
- name: Run Greenfield-SPs
bash ./test/e2e/spworkflow/e2e_test.sh --startSP
# Build Greenfield Cmd
- name: Build Greenfield Cmd
run: |
bash ./deployment/localup/localup.sh --generate $GITHUB_WORKSPACE/greenfield/sp.json ${{ env.MYSQL_USER }} ${{ env.MYSQL_PASSWORD }} ${{ env.MYSQL_IP }}:${{ env.MYSQL_PORT }}
bash ./deployment/localup/localup.sh --reset
bash ./deployment/localup/localup.sh --start
sleep 10
tail -n 1000 deployment/localup/local_env/sp0/gnfd-sp.log
ps -ef | grep gnfd-sp | wc -l
# Run E2E Test
bash ./test/e2e/spworkflow/e2e_test.sh --buildCmd
# # Use Greenfield Cmd Running E2E Test
- name: Run Greenfield E2E Test
run: |
git clone https://github.com/bnb-chain/greenfield-integration-test.git
cd greenfield-integration-test
git checkout ${{ env.GreenfieldIntegrationTestBranch }}
cd ..
bash ./deployment/localup/localup.sh --gene2e $GITHUB_WORKSPACE/greenfield/sp.json
cp -rf test/e2e/localup_env/integration_config/config.yml greenfield-integration-test/config/config.yml
cd greenfield-integration-test
cat config/config.yml
go test -v tests/storage/new_sdk_test.go
cd ..
bash ./test/e2e/spworkflow/e2e_test.sh --runTest
15 changes: 15 additions & 0 deletions .github/workflows/generate-private-key.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const ethers = require('ethers');

// Generate a random private key
const privateKey = ethers.Wallet.createRandom().privateKey;

// Create a wallet instance from the private key
const wallet = new ethers.Wallet(privateKey);

// Print the private key and account address
console.log(`Random Ethereum private key: ${privateKey}`);
console.log(`Account address: ${wallet.address}`);
const privateKeyString = `${privateKey}`.substring(2)
// Set environment variables for the private key and account address
console.log(`::set-output name=private_key::${privateKeyString}`);
console.log(`::set-output name=account_address::${wallet.address}`);
Loading

0 comments on commit cc083dc

Please sign in to comment.