From 13001382c1706e5e1247a9552570fd588c0b02c3 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Mon, 27 Mar 2023 15:28:13 -0500 Subject: [PATCH] gitea --- .gitea/workflows/on-pr.yml | 82 ++++++++++++++++++++++++++++++ .gitea/workflows/on-publish.yaml | 86 ++++++++++++++++++++++++++++++++ 2 files changed, 168 insertions(+) create mode 100644 .gitea/workflows/on-pr.yml create mode 100644 .gitea/workflows/on-publish.yaml diff --git a/.gitea/workflows/on-pr.yml b/.gitea/workflows/on-pr.yml new file mode 100644 index 000000000..4867ec99c --- /dev/null +++ b/.gitea/workflows/on-pr.yml @@ -0,0 +1,82 @@ +name: Tests for Geth that are used in multiple jobs. + +on: [pull_request] + +env: + stack-orchestrator-ref: ${{ github.event.inputs.stack-orchestrator-ref || 'e62830c982d4dfc5f3c1c2b12c1754a7e9b538f1'}} + ipld-eth-db-ref: ${{ github.event.inputs.ipld-ethcl-db-ref || 'be345e0733d2c025e4082c5154e441317ae94cf7' }} + GOPATH: /tmp/go + +jobs: + code-checks: + name: Check code + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v3 + with: + go-version: "1.19" + check-latest: true + + - uses: actions/checkout@v2 + + - name: lint + run: go run build/ci.go lint + + build: + name: Run docker build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run docker build + run: docker build -t cerc-io/go-ethereum . + + geth-unit-test: + name: Run geth unit test + runs-on: ubuntu-latest + env: + GO111MODULE: on + steps: + - name: Create GOPATH + run: mkdir -p /tmp/go + + - uses: actions/setup-go@v3 + with: + go-version: "1.19" + check-latest: true + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Run unit tests + run: make test + + + statediff-unit-test: + name: Run state diff unit test + runs-on: ubuntu-latest + steps: + - name: Create GOPATH + run: mkdir -p /tmp/go + + - uses: actions/setup-go@v3 + with: + go-version: "1.19" + check-latest: true + + - me: Checkout code + uses: actions/checkout@v2 + + - name: Run dockerd + run: | + dockerd -H unix:///var/run/docker.ci.sock --userland-proxy=false & + sleep 5 + + - name: Run docker compose + run: | + docker -H unix:///var/run/docker.ci.sock compose up -d + + - name: Give the migration a few seconds + run: sleep 30 + + - name: Run unit tests + run: make statedifftest diff --git a/.gitea/workflows/on-publish.yaml b/.gitea/workflows/on-publish.yaml new file mode 100644 index 000000000..7beb524f1 --- /dev/null +++ b/.gitea/workflows/on-publish.yaml @@ -0,0 +1,86 @@ +name: Publish geth to release +on: + release: + types: [published] + +jobs: + geth-unit-test: + name: Run geth unit test + runs-on: ubuntu-latest + env: + GO111MODULE: on + steps: + - name: Create GOPATH + run: mkdir -p /tmp/go + + - uses: actions/setup-go@v3 + with: + go-version: "1.19" + check-latest: true + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Run unit tests + run: make test + + statediff-unit-test: + name: Run state diff unit test + runs-on: ubuntu-latest + steps: + - name: Create GOPATH + run: mkdir -p /tmp/go + + - uses: actions/setup-go@v3 + with: + go-version: "1.19" + check-latest: true + + - me: Checkout code + uses: actions/checkout@v2 + + - name: Run dockerd + run: | + dockerd -H unix:///var/run/docker.ci.sock --userland-proxy=false & + sleep 5 + + - name: Run docker compose + run: | + docker -H unix:///var/run/docker.ci.sock compose up -d + + - name: Give the migration a few seconds + run: sleep 30 + + - name: Run unit tests + run: make statedifftest + + build-container: + name: Run docker build and publish + needs: [geth-unit-test, statediff-unit-test] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run docker build + run: docker build -t cerc-io/go-ethereum -f Dockerfile . + - name: Get the version + id: vars + run: | + echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7}) + echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/}) + - name: Tag docker image + run: docker tag cerc-io/go-ethereum git.vdb.to/cerc-io/go-ethereum/go-ethereum:${{steps.vars.outputs.sha}} + - name: Tag docker image + run: docker tag git.vdb.to/cerc-io/go-ethereum/go-ethereum:${{steps.vars.outputs.sha}} git.vdb.to/cerc-io/go-ethereum/go-ethereum:${{steps.vars.outputs.tag}} + - name: Docker Login + run: echo ${{ secrets.GITEA_TOKEN }} | docker login https://git.vdb.to -u cerccicd --password-stdin + - name: Docker Push + run: docker push git.vdb.to/cerc-io/go-ethereum/go-ethereum:${{steps.vars.outputs.sha}} + - name: Docker Push TAGGED + run: docker push git.vdb.to/cerc-io/go-ethereum/go-ethereum:${{steps.vars.outputs.tag}} + - name: Copy ethereum binary file + run: docker run --rm --entrypoint cat git.vdb.to/cerc-io/go-ethereum/go-ethereum:${{steps.vars.outputs.sha}} /usr/local/bin/geth > geth-linux-amd64 + - name: curl + uses: enflo/curl-action@master + with: + curl: --user cerccicd:${{ secrets.GITEA_TOKEN }} --upload-file geth-linux-amd64 https://git.vdb.to/api/packages/cerc-io/generic/go-ethereum/${{steps.vars.outputs.tag}}/geth-linux-amd64 +