Skip to content

Commit

Permalink
Add GHA workflow to build binary and push image to ECR (ethereum#55, e…
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanschneider committed Jan 24, 2024
1 parent 99e956f commit 7e30c24
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21.4
go-version: 1.21.6
- name: Run tests
run: go test -short ./...
env:
Expand Down
89 changes: 89 additions & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: build artifacts on every new commit
on:
workflow_dispatch:
push:
branches:
- '!main'
- '**omnibus**'
paths-ignore:
- '.github/**'
- 'patches/**'
- README.md
- Makefile
- update-patch.go
- .gitignore
permissions:
id-token: write
contents: read

jobs:
test:
name: Run tests
runs-on: ubuntu-20.04
env:
GOPRIVATE: github.com/INFURA
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v1
with:
# keep this version in sync w/ build step below and .tool-versions file
go-version: 1.21.6
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: run tests
run: |
go test ./eth ./rpc ./core ./internal/ethapi
build:
name: Build Artifacts
runs-on: ubuntu-20.04
env:
GOPRIVATE: github.com/INFURA
outputs:
geth-version: ${{ steps.output-version.outputs.geth-version }}
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v1
with:
# keep this version in sync w/ test step above and .tool-versions file
go-version: 1.21.6
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: build artifacts
run: |
make geth
cp ./build/bin/geth ./geth-linux-amd64
- name: Output Geth version
id: output-version
run: |
export GETH_VERSION=$(./geth-linux-amd64 version | grep -e "^Version" | cut -f 2 -d' ')-$(./geth-linux-amd64 version | grep -e "^Git" | cut -f 3 -d' ' | cut -c 1-8)
echo "geth-version=${GETH_VERSION}" >> $GITHUB_OUTPUT
echo "### Built Omnibus Version" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "\`${GETH_VERSION}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
- name: upload artifacts
uses: actions/upload-artifact@v1
with:
name: geth-linux-amd64
path: ./geth-linux-amd64

push_docker_image:
name: Build and push Omnibus Docker image to ECR
uses: consensys/github-toolkit/.github/workflows/ecr-login-push.yml@v2
needs: build
with:
role_to_assume: ecr-read-write-infura-evm-omnibus
aws_account_id: 580947410102
ecr_repo_name: infura/evm/omnibus
push_to_ecr: true
image_tag: ${{ needs.build.outputs.geth-version }}
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# keep golang version here in sync w/ versions in .github/workflows/push.yaml
golang 1.21.6

0 comments on commit 7e30c24

Please sign in to comment.