From d58d660fcd7ebe26507c9c500e55012f96d870bb Mon Sep 17 00:00:00 2001 From: Ramil Amerzyanov Date: Wed, 26 Aug 2020 17:55:11 +0300 Subject: [PATCH] CI build (#20) * CI: run build on PR and on push to master * CI: debug building geth * CI: fix coping file * CI: fix coping file v2 * CI: temporary upload file to release asset * CI: get release upload_url by tag, upload asset to current relase * CI: fix tag name --- .github/workflows/build.yml | 12 ++++++++++++ .github/workflows/on-master.yaml | 25 +++++++++++++++++++++++++ .github/workflows/publish.yaml | 32 ++++++++++++++++++++++++++++++++ Dockerfile.amd64 | 7 +++++++ 4 files changed, 76 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/on-master.yaml create mode 100644 .github/workflows/publish.yaml create mode 100644 Dockerfile.amd64 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..8eb113c34 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,12 @@ +name: Docker Build + +on: [pull_request] + +jobs: + build: + name: Run docker build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run docker build + run: docker build -t vulcanize/go-ethereum -f Dockerfile.amd64 . diff --git a/.github/workflows/on-master.yaml b/.github/workflows/on-master.yaml new file mode 100644 index 000000000..9c0c8f89d --- /dev/null +++ b/.github/workflows/on-master.yaml @@ -0,0 +1,25 @@ +name: Docker Build and publish to Github + +on: + push: + branches: + - master + +jobs: + build: + name: Run docker build and publish + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run docker build + run: docker build -t vulcanize/go-ethereum -f Dockerfile.amd64 . + - name: Get the version + id: vars + run: echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7}) + - name: Tag docker image + run: docker tag vulcanize/go-ethereum docker.pkg.github.com/vulcanize/go-ethereum/go-ethereum:${{steps.vars.outputs.sha}} + - name: Docker Login + run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u vulcanize --password-stdin + - name: Docker Push + run: docker push docker.pkg.github.com/vulcanize/go-ethereum/go-ethereum:${{steps.vars.outputs.sha}} + diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 000000000..014c21276 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,32 @@ +name: Publish geth to release +on: + release: + types: [published] +jobs: + push_to_registries: + name: Publish assets to Release + runs-on: ubuntu-latest + steps: + - name: Get the version + id: vars + run: | + echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7}) + - name: Docker Login to Github Registry + run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u vulcanize --password-stdin + - name: Docker Pull + run: docker pull docker.pkg.github.com/vulcanize/go-ethereum/go-ethereum:${{steps.vars.outputs.sha}} + - name: Copy ethereum binary file + run: docker run --rm --entrypoint cat docker.pkg.github.com/vulcanize/go-ethereum/go-ethereum:${{steps.vars.outputs.sha}} /go-ethereum/build/bin/geth > geth-linux-amd64 + - name: Get release + id: get_release + uses: bruceadams/get-release@v1.2.0 + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.get_release.outputs.upload_url }} + asset_path: geth-linux-amd64 + asset_name: geth-linux-amd64 + asset_content_type: application/octet-stream diff --git a/Dockerfile.amd64 b/Dockerfile.amd64 new file mode 100644 index 000000000..da78b77be --- /dev/null +++ b/Dockerfile.amd64 @@ -0,0 +1,7 @@ +# Build Geth in a stock Go builder container +FROM golang:1.13 as builder + +#RUN apk add --no-cache make gcc musl-dev linux-headers git + +ADD . /go-ethereum +RUN cd /go-ethereum && make geth