chore(ci): Fix GoVuln and formatting (#1468)

* chore: CI improvements

* revert comment deletions

* add cache for windows build

* chore

* Remove windows build check
This commit is contained in:
Krishang Shah 2025-03-03 17:20:29 +05:30 committed by GitHub
commit cdd61bdd96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 249 additions and 254 deletions

View file

@ -1,26 +1,36 @@
defaultStake: 10000
devnetType: docker
defaultFee: 2000
defaultStake: 10000
borChainId: 15001
heimdallChainId: heimdall-15001
contractsBranch: mardizzone/node-16
borDockerBuildContext: '../../bor'
heimdallDockerBuildContext: 'https://github.com/maticnetwork/heimdall.git#develop'
genesisContractsBranch: master
sprintSize:
- '64'
blockNumber:
- '0'
contractsBranch: mardizzone/node-16
blockTime:
- '2'
blockNumber:
- '0'
sprintSize:
- '64'
sprintSizeBlockNumber:
- '0'
numOfBorValidators: 3
numOfBorSentries: 0
numOfBorArchiveNodes: 0
devnetBorFlags: config,config,config
numOfErigonValidators: 0
numOfErigonSentries: 0
numOfErigonArchiveNodes: 0
ethURL: http://ganache:9545
ethHostUser: ubuntu
devnetType: docker
borDockerBuildContext: "../../bor"
heimdallDockerBuildContext: "https://github.com/maticnetwork/heimdall.git#develop"
sprintSizeBlockNumber:
- '0'
devnetBorFlags: config,config,config

View file

@ -1,7 +1,7 @@
# Number of days of inactivity before an Issue is closed for lack of response
daysUntilClose: 30
# Label requiring a response
responseRequiredLabel: "need:more-information"
responseRequiredLabel: 'need:more-information'
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
closeComment: >
This issue has been automatically closed because there has been no response

2
.github/stale.yml vendored
View file

@ -7,7 +7,7 @@ exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: "status:inactive"
staleLabel: 'status:inactive'
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had

View file

@ -29,7 +29,6 @@ jobs:
NUMERIC_VERSION=$( echo ${{ env.GIT_TAG }} | sed 's/[^0-9.]//g' )
echo "VERSION=$NUMERIC_VERSION" >> $GITHUB_ENV
- name: Making directory structure for yaml
run: mkdir -p packaging/deb/bor/var/lib/bor
- name: making directory structure for the systemd
@ -391,14 +390,3 @@ jobs:
packaging/deb/bor-pbss-amoy-**.deb
packaging/deb/bor-amoy-**.deb.checksum
packaging/deb/bor-pbss-amoy-**.deb.checksum

View file

@ -2,12 +2,12 @@ name: CI
on:
push:
branches:
- "master"
- "qa"
- "develop"
- 'master'
- 'qa'
- 'develop'
pull_request:
branches:
- "**"
- '**'
types: [opened, synchronize]
concurrency:
@ -16,267 +16,270 @@ concurrency:
jobs:
build:
name: Build
if: (github.event.action != 'closed' || github.event.pull_request.merged == true)
strategy:
matrix:
os: [ ubuntu-22.04 ] # list of os: https://github.com/actions/virtual-environments
os: [ubuntu-22.04] # List of OS: https://github.com/actions/virtual-environments
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: |
git submodule update --init --recursive --force
git fetch --no-tags --prune --depth=1 origin +refs/heads/master:refs/remotes/origin/master
- uses: actions/checkout@v4
- 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@v5
with:
go-version: 1.23.x
- uses: actions/setup-go@v5
with:
go-version: 1.23.x
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt update && sudo apt install build-essential
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt update && sudo apt install build-essential
- 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-
- 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: Build
run: make all
lint:
if: (github.event.action != 'closed' || github.event.pull_request.merged == true)
strategy:
matrix:
os: [ ubuntu-22.04 ] # list of os: https://github.com/actions/virtual-environments
os: [ubuntu-22.04] # List of OS: https://github.com/actions/virtual-environments
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: |
git submodule update --init --recursive --force
git fetch --no-tags --prune --depth=1 origin +refs/heads/master:refs/remotes/origin/master
- uses: actions/checkout@v4
- 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@v5
with:
go-version: 1.23.x
- uses: actions/setup-go@v5
with:
go-version: 1.23.x
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt update && sudo apt install build-essential
- 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
- name: Golang-ci install
if: runner.os == 'Linux'
run: make lintci-deps
- name: Lint
if: runner.os == 'Linux'
run: make lint
- name: Lint
if: runner.os == 'Linux'
run: make lint
unit-tests:
if: (github.event.action != 'closed' || github.event.pull_request.merged == true)
strategy:
matrix:
os: [ ubuntu-22.04 ] # list of os: https://github.com/actions/virtual-environments
os: [ubuntu-22.04] # List of OS: https://github.com/actions/virtual-environments
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: |
git submodule update --init --recursive --force
git fetch --no-tags --prune --depth=1 origin +refs/heads/master:refs/remotes/origin/master
- uses: actions/checkout@v4
- 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@v5
with:
go-version: 1.23.x
- uses: actions/setup-go@v5
with:
go-version: 1.23.x
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt update && sudo apt install build-essential
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt update && sudo apt install build-essential
- 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-
- 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: Test
run: make test
- name: Test
run: make test
- uses: actions/upload-artifact@v4.4.0
with:
name: unitTest-coverage
path: cover.out
- uses: actions/upload-artifact@v4.4.0
with:
name: unitTest-coverage
path: cover.out
#- name: Data race tests
# run: make test-race
# - name: Data race tests
# run: make test-race
# # 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
# # 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-22.04 ] # list of os: https://github.com/actions/virtual-environments
os: [ubuntu-22.04] # List of OS: https://github.com/actions/virtual-environments
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: |
git submodule update --init --recursive --force
git fetch --no-tags --prune --depth=1 origin +refs/heads/master:refs/remotes/origin/master
- uses: actions/checkout@v4
- 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@v5
with:
go-version: 1.23.x
- uses: actions/setup-go@v5
with:
go-version: 1.23.x
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt update && sudo apt install build-essential
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt update && sudo apt install build-essential
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/Library/Caches/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- uses: actions/cache@v4
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: test-integration
run: make test-integration
- name: test-integration
run: make test-integration
- uses: actions/upload-artifact@v4.4.0
with:
name: integrationTest-coverage
path: cover.out
- uses: actions/upload-artifact@v4.4.0
with:
name: integrationTest-coverage
path: cover.out
codecov:
if: (github.event.action != 'closed' || github.event.pull_request.merged == true)
strategy:
matrix:
os: [ ubuntu-22.04 ] # list of os: https://github.com/actions/virtual-environments
os: [ubuntu-22.04] # List of OS: https://github.com/actions/virtual-environments
runs-on: ${{ matrix.os }}
needs: [unit-tests, integration-tests]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4.1.8
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4.1.8
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
e2e-tests:
if: (github.event.action != 'closed' || github.event.pull_request.merged == true)
strategy:
matrix:
os: [ ubuntu-22.04 ] # list of os: https://github.com/actions/virtual-environments
os: [ubuntu-22.04] # List of OS: https://github.com/actions/virtual-environments
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
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/checkout@v4
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@v5
with:
go-version: 1.23.x
- uses: actions/setup-go@v5
with:
go-version: 1.23.x
- name: Checkout matic-cli
uses: actions/checkout@v4
with:
repository: maticnetwork/matic-cli
ref: master
path: matic-cli
- name: Checkout matic-cli
uses: actions/checkout@v4
with:
repository: maticnetwork/matic-cli
ref: master
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
- 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: '18.19.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
- uses: actions/setup-node@v3
with:
node-version: '18.19.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.js setup devnet -c ../../bor/.github/matic-cli-config.yml
- name: Bootstrap devnet
run: |
cd matic-cli
npm install --prefer-offline --no-audit --progress=false
mkdir devnet
cd devnet
../bin/matic-cli.js setup devnet -c ../../bor/.github/matic-cli-config.yml
- name: Launch devnet
run: |
cd matic-cli/devnet
bash ../util-scripts/docker/devnet_setup.sh
cd -
timeout 2m bash bor/integration-tests/bor_health.sh
- name: Run smoke tests
run: |
echo "Funding ganache accounts..."
timeout 10m bash bor/integration-tests/fund_ganache_accounts.sh
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
- name: Launch devnet
run: |
cd matic-cli/devnet
bash ../util-scripts/docker/devnet_setup.sh
cd -
timeout 60m bash bor/integration-tests/smoke_test.sh
timeout 2m bash bor/integration-tests/bor_health.sh
- name: Run RPC Tests
run: |
echo "Starting RPC Tests..."
timeout 5m bash bor/integration-tests/rpc_test.sh
- name: Run smoke tests
run: |
echo "Funding ganache accounts..."
timeout 10m bash bor/integration-tests/fund_ganache_accounts.sh
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 -
timeout 60m bash bor/integration-tests/smoke_test.sh
- name: Upload logs
if: always()
uses: actions/upload-artifact@v4.4.0
with:
name: logs_${{ github.run_id }}
path: |
matic-cli/devnet/logs
- name: Run RPC Tests
run: |
echo "Starting RPC Tests..."
timeout 5m bash bor/integration-tests/rpc_test.sh
- name: Package code and chain data
if: always()
run: |
cd matic-cli/devnet
docker compose down --remove-orphans
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 logs
if: always()
uses: actions/upload-artifact@v4.4.0
with:
name: logs_${{ github.run_id }}
path: |
matic-cli/devnet/logs
- name: Upload code and chain data
if: always()
uses: actions/upload-artifact@v4.4.0
with:
name: code_${{ github.run_id }}
path: code.tar.gz
- name: Package code and chain data
if: always()
run: |
cd matic-cli/devnet
docker compose down --remove-orphans
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@v4.4.0
with:
name: code_${{ github.run_id }}
path: code.tar.gz

View file

@ -1,10 +1,10 @@
name: "CodeQL"
name: 'CodeQL'
on:
push:
branches: [ "master", "develop" ]
branches: ['master', 'develop']
pull_request:
branches: [ "master", "develop" ]
branches: ['master', 'develop']
schedule:
- cron: '0 0 * * *'
@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
language: ['go']
steps:
- name: Checkout repository
@ -43,4 +43,4 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
category: '/language:${{matrix.language}}'

View file

@ -1,5 +1,5 @@
name: Govuln
on: [ push, pull_request ]
on: [push, pull_request]
jobs:
govulncheck:
@ -8,7 +8,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.23.6"
go-version: '1.23.6'
check-latest: true
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
@ -20,4 +20,4 @@ jobs:
Makefile
- name: govulncheck
run: make vulncheck
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF != ''

View file

@ -29,7 +29,6 @@ jobs:
NUMERIC_VERSION=$( echo ${{ env.GIT_TAG }} | sed 's/[^0-9.]//g' )
echo "VERSION=$NUMERIC_VERSION" >> $GITHUB_ENV
- name: Making directory structure for yaml
run: mkdir -p packaging/deb/bor/var/lib/bor
- name: making directory structure for the systemd
@ -387,8 +386,6 @@ jobs:
NODE: archive
NETWORK: mainnet
############ Check and Upload ##########################
- name: Confirming package built
run: ls -ltr packaging/deb/ | grep bor

View file

@ -25,7 +25,7 @@ jobs:
uses: actions/setup-go@master
with:
go-version: 1.23.6
# Variables
# Variables
- name: Adding TAG to ENV
run: echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV
- name: adding version
@ -97,7 +97,6 @@ jobs:
echo "Maintainer: devops@polygon.technology" >> packaging/deb/bor/DEBIAN/control
echo "Description: bor binary package" >> packaging/deb/bor/DEBIAN/control
- name: Creating package for binary for bor ${{ env.ARCH }}
run: cp -rp packaging/deb/bor packaging/deb/bor-${{ env.GIT_TAG }}-${{ env.ARCH }}
env:

View file

@ -26,8 +26,8 @@ jobs:
- name: Prepare
id: prepare
run: |
TAG=${GITHUB_REF#refs/tags/}
echo ::set-output name=tag_name::${TAG}
TAG=${GITHUB_REF#refs/tags/}
echo ::set-output name=tag_name::${TAG}
- name: Login to Docker Hub
uses: docker/login-action@v2
@ -40,7 +40,7 @@ jobs:
- name: Run GoReleaser
run: |
make release
make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.prepare.outputs.tag_name }}

View file

@ -7,26 +7,25 @@ name: Mark stale issues and pull requests
on:
schedule:
- cron: '0 0 * * *'
- cron: '0 0 * * *'
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.'
stale-pr-message: 'This PR is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 14 days.'
close-issue-message: 'This issue was closed because it has been stalled for 28 days with no activity.'
close-pr-message: 'This PR was closed because it has been stalled for 35 days with no activity.'
days-before-issue-stale: 14
days-before-pr-stale: 21
days-before-issue-close: 14
days-before-pr-close: 14
exempt-draft-pr: true
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.'
stale-pr-message: 'This PR is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 14 days.'
close-issue-message: 'This issue was closed because it has been stalled for 28 days with no activity.'
close-pr-message: 'This PR was closed because it has been stalled for 35 days with no activity.'
days-before-issue-stale: 14
days-before-pr-stale: 21
days-before-issue-close: 14
days-before-pr-close: 14
exempt-draft-pr: true

View file

@ -90,7 +90,6 @@ lintci-deps:
vulncheck:
@go run golang.org/x/vuln/cmd/govulncheck@latest ./...
goimports:
goimports -local "$(PACKAGE)" -w .