Skip to content

Commit

Permalink
Merge pull request #172 from XinFinOrg/merge-xdpos-upgrade
Browse files Browse the repository at this point in the history
Catch up to changes from XDPoSChain
  • Loading branch information
wanwiset25 authored May 14, 2024
2 parents 096125b + 50e6260 commit 40eea2a
Show file tree
Hide file tree
Showing 289 changed files with 5,849 additions and 2,906 deletions.
37 changes: 37 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Proposed changes
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.

## Types of changes

What types of changes does your code introduce to XDC network?
_Put an `` in the boxes that apply_

- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation Update (if none of the other choices apply)
- [ ] Regular KTLO or any of the maintaince work. e.g code style
- [ ] CICD Improvement

## Impacted Components
Which part of the codebase this PR will touch base on,

_Put an `` in the boxes that apply_

- [ ] Consensus
- [ ] Account
- [ ] Network
- [ ] Geth
- [ ] Smart Contract
- [ ] External components
- [ ] Not sure (Please specify below)

## Checklist
_Put an `` in the boxes once you have confirmed below actions (or provide reasons on not doing so) that_

- [ ] This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage
- [ ] Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet.
- [ ] Tested the backwards compatibility.
- [ ] Tested with XDC nodes running this version co-exist with those running the previous version.
- [ ] Relevant documentation has been updated as part of this PR
- [ ] N/A
57 changes: 44 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch: #allow manual trigger to workflow

jobs:
test_build_and_push_to_docker_registry:
test_golang:
name: Test, build and push image to registry
runs-on: ubuntu-latest
env:
Expand All @@ -17,12 +17,48 @@ jobs:
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/XDC-Subnet
strategy:
fail-fast: false
matrix:
include:
- name: A-B tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/[a-b].*")
- name: C-[a-m] tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/c[a-m].*")
- name: C-[n-o] tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/c[n-o].*")
- name: C-[p-z] tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/c[p-z].*")
- name: D-I tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/[d-i].*")
- name: J-N tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/[j-n].*")
- name: O-R tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/[o-r].*")
- name: S tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/s.*")
- name: T-Z tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/[t-z].*")
steps:
- name: Check out code
uses: actions/checkout@v3
with:
path: ${{ env.GOPATH }}/src/XDC-Subnet

- name: Set up Go 1.21.x
uses: actions/setup-go@v4
with:
go-version: "1.21.x" # The Go version to download (if necessary) and use.
- name: Run tests
run: ${{ matrix.script }}
env:
GO111MODULE: auto

test_nodejs:
name: Run nodejs tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
with:
Expand All @@ -32,16 +68,12 @@ jobs:
cd contracts/validator/src
yarn
npx hardhat test
- name: Set up Go 1.21.x
uses: actions/setup-go@v4
with:
go-version: "1.21.x" # The Go version to download (if necessary) and use.
- name: Run tests
run: |
make test
env:
GO111MODULE: auto
build:
needs: [test_golang, test_nodejs]
name: Build and push image to registry
runs-on: ubuntu-latest
steps:
- name: Docker login
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
Expand All @@ -61,5 +93,4 @@ jobs:
- name: Build and push image
run: |
docker build . --file docker/Dockerfile --tag ${{ steps.image.outputs.name }}
docker push ${{ steps.image.outputs.name }}
docker push ${{ steps.image.outputs.name }}
54 changes: 43 additions & 11 deletions .github/workflows/pr_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,63 @@ on:
pull_request:
branches:
- master
#TODO: remove push trigger
push: #temporary trigger tests this way
branches:
- '*'

jobs:
test_on_pr:
name: Run tests on PR
test_golang:
name: Run golang tests
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}
GOBIN: ${{ github.workspace }}/bin
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/XDC-Subnet
strategy:
fail-fast: false
matrix:
include:
- name: A-B tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/[a-b].*")
- name: C-[a-m] tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/c[a-m].*")
- name: C-[n-o] tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/c[n-o].*")
- name: C-[p-z] tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/c[p-z].*")
- name: D-I tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/[d-i].*")
- name: J-N tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/[j-n].*")
- name: O-R tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/[o-r].*")
- name: S tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/s.*")
- name: T-Z tests
script: mv common/constants/constants.go.unittest common/constants.go; go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDC-Subnet/[t-z].*")
steps:
- name: Check out code
uses: actions/checkout@v3
with:
path: ${{ env.GOPATH }}/src/XDC-Subnet
- name: Set up Go 1.21.x
uses: actions/setup-go@v4
with:
go-version: "1.21.x" # The Go version to download (if necessary) and use.
- name: Run tests
run: ${{ matrix.script }}
env:
GO111MODULE: auto

test_nodejs:
name: Run nodejs tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
with:
Expand All @@ -28,12 +69,3 @@ jobs:
cd contracts/validator/src
yarn
npx hardhat test
- name: Set up Go 1.21.x
uses: actions/setup-go@v4
with:
go-version: "1.21.x" # The Go version to download (if necessary) and use.
- name: Run tests
run: |
make test
env:
GO111MODULE: auto
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,11 @@ profile.cov

**/yarn-error.log
coverage.txt
go.sum
<<<<<<< HEAD
go.sum
=======
go.sum
**/.terraform*
cicd/devnet/tmp
cicd/devnet/terraform/node-config.json
>>>>>>> fd8e7c9d624a085c70178ec7c8de7da274fe0a7c
Loading

0 comments on commit 40eea2a

Please sign in to comment.