Skip to content

Commit

Permalink
Add invariants PR job and e2e.sh (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergerad authored Jan 16, 2025
1 parent 0851793 commit 1688e82
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/scripts/e2e.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

set -e
set -o pipefail

rpc="$1"
if [ -z "$rpc" ]; then
echo "RPC url must be provided as arg"
exit 1
fi
env=""
case "$rpc" in
"https://rpc.immutable.com")
env="mainnet"
;;
"https://rpc.testnet.immutable.com")
env="testnet"
;;
"https://rpc.dev.immutable.com")
env="devnet"
;;
*)
echo "Unknown RPC url: $rpc"
exit 1
;;
esac

if [ -z "$PRIV_KEY" ]; then
echo "PRIV_KEY env var not set"
exit 1
fi

go test -count=1 -v ./tests/immutable -rpc="$rpc" -skipvoting=true -forks="$env"
16 changes: 16 additions & 0 deletions .github/scripts/invariants.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

# Check version of geth src is aligned with changelog
changelog_version=$(grep '## \[' < CHANGELOG.md | head -n1 | tr -d ' #[]')
major=$(grep '// Major version component' < params/version.go | sed "s|//.*||" | sed "s|.* = ||")
minor=$(grep '// Minor version component' < params/version.go | sed "s|//.*||" | sed "s|.* = ||")
patch=$(grep '// Patch version component' < params/version.go | sed "s|//.*||" | sed "s|.* = ||")
meta=$(grep '// Version metadata to append' < params/version.go | sed "s|//.*||" | sed "s|.* = ||")
src_version=$(echo "v$major.$minor.$patch-$meta" | tr -d '\t" ')
if [ "$src_version" != "$changelog_version" ]; then
echo "Version in params/version.go ($src_version) is not aligned with CHANGELOG.md ($changelog_version)"
exit 1
fi
echo "Version in params/version.go is aligned with CHANGELOG.md ($changelog_version)"
12 changes: 12 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ concurrency:
cancel-in-progress: true

jobs:
invariants:
name: Invariants
runs-on: ubuntu-20-04-4-cores
timeout-minutes: 1
steps:
- uses: actions/checkout@v4
- name: Invariants
shell: bash
run: ./.github/scripts/invariants.sh
- name: TruffleHog OSS
uses: trufflesecurity/[email protected]

bootstrap:
name: Local E2E Tests
runs-on: ubuntu-20-04-4-cores
Expand Down

0 comments on commit 1688e82

Please sign in to comment.