ci: update ci job #158
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: push | |
concurrency: | |
group: ci-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
GO_VERSION: "1.21" | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
if: (github.event.action != 'closed' || github.event.pull_request.merged == true) | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Install golangci-lint | |
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin | |
- name: Install shadow | |
run: go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest | |
- name: Run all the linter tools against code | |
run: make lint | |
go-bindings: | |
name: Check go bindings | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install abigen | |
run: | | |
sudo add-apt-repository ppa:ethereum/ethereum | |
sudo apt-get update | |
sudo apt-get install ethereum | |
abigen --version | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Install dependencies | |
working-directory: contracts | |
run: forge install | |
- name: Generate go bindings | |
run: make gen-go-bindings | |
- name: Check if the go bindings are up to date | |
run: | | |
if [[ -n $(git status --porcelain) ]]; then | |
echo "❌ Error: Go bindings are not up to date. Please run \`make gen-go-bindings\`." | |
git diff | |
exit 1 | |
else | |
echo "✅ Go bindings are up to date." | |
fi | |
doc: | |
name: Check documentation | |
runs-on: ubuntu-latest | |
if: (github.event.action != 'closed' || github.event.pull_request.merged == true) | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Try to update polycli documentation | |
run: make gen-doc | |
- name: Check if the documentation is up to date | |
run: | | |
if [[ -n $(git status --porcelain) ]]; then | |
echo "❌ Error: Documentation is not up to date. Please run \`make gen-doc\`." | |
git diff | |
exit 1 | |
else | |
echo "✅ The documentation is up to date." | |
fi | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
if: (github.event.action != 'closed' || github.event.pull_request.merged == true) | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Run tests | |
run: make test | |
loadtest: | |
name: Loadtest against geth | |
runs-on: ubuntu-latest | |
if: (github.event.action != 'closed' || github.event.pull_request.merged == true) | |
strategy: | |
matrix: | |
tool: [geth, anvil] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
# foundry only has nightly versions no we don't specify a version at the moment. | |
- name: Install Geth | |
run: | | |
if [ "${{ matrix.tool }}" = "geth" ]; then | |
sudo add-apt-repository ppa:ethereum/ethereum | |
sudo apt-get update | |
sudo apt-get install ethereum | |
geth --version | |
fi | |
- name: Run loadtest againt ${{ matrix.tool }} | |
run: | | |
${{ matrix.tool }} --version | |
make ${{ matrix.tool }} & | |
sleep 5 | |
make loadtest |