Skip to content

Commit

Permalink
Merge pull request ethereum#433 from cffls/develop
Browse files Browse the repository at this point in the history
Merge branch 'v0.3.0-dev' into develop
  • Loading branch information
cffls committed Jun 22, 2022
2 parents 3bb1480 + 1daa659 commit 88dbfa1
Show file tree
Hide file tree
Showing 156 changed files with 7,207 additions and 2,414 deletions.
11 changes: 11 additions & 0 deletions .github/matic-cli-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
defaultStake: 10000
defaultFee: 2000
borChainId: "15001"
heimdallChainId: heimdall-15001
contractsBranch: jc/v0.3.1-backport
numOfValidators: 3
numOfNonValidators: 0
ethURL: http://ganache:9545
devnetType: docker
borDockerBuildContext: "../../bor"
heimdallDockerBuildContext: "https://github.com/maticnetwork/heimdall.git#v0.3.0-dev"
205 changes: 180 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,183 @@
name: CI
on: [push, pull_request]
on:
push:
branches:
- "master"
- "qa"
- "develop"
pull_request:
branches:
- "**"
types: [opened, synchronize, edited]

concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
tests:
if: (github.event.action != 'closed' || github.event.pull_request.merged == true)
strategy:
matrix:
os: [ ubuntu-20.04, macos-11 ] # list of os: https://github.com/actions/virtual-environments
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: "Build binaries"
run: make all
- name: "Run tests"
run: make test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./cover.out
- name: Reproducible build test
run: |
make geth
shasum -a256 ./build/bin/geth > bor1.sha256
make geth
shasum -a256 ./build/bin/geth > bor2.sha256
if ! cmp -s bor1.sha256 bor2.sha256; then
echo >&2 "Reproducible build broken"; cat bor1.sha256; cat bor2.sha256; exit 1
fi
- uses: actions/checkout@v3
- run: |
git submodule update --init --recursive --force
git fetch --no-tags --prune --depth=1 origin +refs/heads/master:refs/remotes/origin/master
- uses: actions/setup-go@v3
with:
go-version: 1.18.x

- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt update && sudo apt install build-essential

- name: Golang-ci install
if: runner.os == 'Linux'
run: make lintci-deps

- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/Library/Caches/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-

- name: Build
run: make all

- name: Lint
if: runner.os == 'Linux'
run: make lint

- name: Test
run: make test

#- name: Data race tests
# run: make test-race

- name: test-integration
run: make test-integration

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./cover.out

# # TODO: make it work
# - name: Reproducible build test
# run: |
# make geth
# shasum -a256 ./build/bin/geth > bor1.sha256
# make geth
# shasum -a256 ./build/bin/geth > bor2.sha256
# if ! cmp -s bor1.sha256 bor2.sha256; then
# echo >&2 "Reproducible build broken"; cat bor1.sha256; cat bor2.sha256; exit 1
# fi

integration-tests:
if: (github.event.action != 'closed' || github.event.pull_request.merged == true)
strategy:
matrix:
os: [ ubuntu-20.04 ] # list of os: https://github.com/actions/virtual-environments
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
path: bor
- name: Checkout submodules
run: |
cd bor
git submodule update --init --recursive --force
git fetch --no-tags --prune --depth=1 origin +refs/heads/master:refs/remotes/origin/master
- uses: actions/setup-go@v3
with:
go-version: 1.18.x

- name: Checkout matic-cli
uses: actions/checkout@v3
with:
repository: maticnetwork/matic-cli
ref: v0.3.0-dev
path: matic-cli

- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install build-essential
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
sudo snap install solc
sudo apt install python2 jq curl
sudo ln -sf /usr/bin/python2 /usr/bin/python
- uses: actions/setup-node@v3
with:
node-version: '10.17.0'
cache: 'npm'
cache-dependency-path: |
matic-cli/package-lock.json
matic-cli/devnet/code/contracts/package-lock.json
matic-cli/devnet/code/genesis-contracts/package-lock.json
matic-cli/devnet/code/genesis-contracts/matic-contracts/package-lock.json
- name: Bootstrap devnet
run: |
cd matic-cli
npm install --prefer-offline --no-audit --progress=false
mkdir devnet
cd devnet
../bin/matic-cli setup devnet -c ../../bor/.github/matic-cli-config.yml
- name: Launch devnet
run: |
cd matic-cli/devnet
bash docker-ganache-start.sh
bash docker-heimdall-start-all.sh
bash docker-bor-setup.sh
bash docker-bor-start-all.sh
sleep 120 && bash ganache-deployment-bor.sh
sleep 120 && bash ganache-deployment-sync.sh
sleep 120
docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'admin.peers'"
docker exec bor0 bash -c "bor attach /root/.bor/data/bor.ipc -exec 'eth.blockNumber'"
- name: Run smoke tests
run: |
echo "Deposit 100 matic for each account to bor network"
cd matic-cli/devnet/code/contracts
npm run truffle exec scripts/deposit.js -- --network development $(jq -r .root.tokens.MaticToken contractAddresses.json) 100000000000000000000
cd -
bash bor/integration-tests/smoke_test.sh
- name: Upload logs
if: always()
uses: actions/upload-artifact@v3
with:
name: logs_${{ github.run_id }}
path: |
matic-cli/devnet/logs
- name: Package code and chain data
if: always()
run: |
cd matic-cli/devnet
docker compose down
cd -
mkdir -p ${{ github.run_id }}/matic-cli
sudo mv bor ${{ github.run_id }}
sudo mv matic-cli/devnet ${{ github.run_id }}/matic-cli
sudo tar czf code.tar.gz ${{ github.run_id }}
- name: Upload code and chain data
if: always()
uses: actions/upload-artifact@v3
with:
name: code_${{ github.run_id }}
path: code.tar.gz
29 changes: 0 additions & 29 deletions .github/workflows/dockerimage.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/**/*dapps*
build/_vendor/pkg

cover.out

#*
.#*
*#
Expand Down
Loading

0 comments on commit 88dbfa1

Please sign in to comment.