Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): badges for hive and code coverage on devel #4793

Merged
merged 2 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,25 @@ jobs:
- name: sudo make docker
run: sudo DOCKER_TAG=thorax/erigon:ci-$GITHUB_SHA DOCKER_UID=$(id -u) DOCKER_GID=$(id -g) make docker

hive:
needs:
- tests
- tests-windows
- docker
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch git tags for "git describe"

- name: build erigon image
run: DOCKER_TAG=thorax/erigon:ci-$GITHUB_SHA DOCKER_UID=$(id -u) DOCKER_GID=$(id -g) make docker

# check with root permissions, should be cached from previous build
- name: build erigon image (root permissions)
run: sudo DOCKER_TAG=thorax/erigon:ci-$GITHUB_SHA DOCKER_UID=$(id -u) DOCKER_GID=$(id -g) make docker

- name: run hive
run: sudo mkdir /results && docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v ${{ github.workspace }}:/work gatewayfm/hive:latest --sim ethereum/engine --results-root=/work/results --client erigon_ci-$GITHUB_SHA --docker.output --loglevel 5

Expand All @@ -130,4 +149,19 @@ jobs:
if: always()
with:
name: hive-ci-output
path: results/*.xml
path: results/*.xml

event_file:
needs:
- tests
- tests-windows
- docker
name: archive event file
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
steps:
- name: upload
uses: actions/upload-artifact@v2
with:
name: event file
path: ${{ github.event_path }}
55 changes: 55 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Coverage
on:
push:
branches:
- devel

jobs:
coverage:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
- run: git submodule update --init --recursive --force

- uses: actions/setup-go@v3
with:
go-version: 1.18.x

- name: install dependencies on Linux
if: runner.os == 'Linux'
run: sudo apt update && sudo apt install build-essential

- name: run coverage
run: echo "COVERAGE=$(make coverage)" >> $GITHUB_ENV

- name: set badge color
shell: bash
run: |
if [ ${{ env.COVERAGE }} -lt 40 ]
then
echo "BADGE_COLOR=800000" >> $GITHUB_ENV
elif [ ${{ env.COVERAGE }} -lt 75 ]
then
echo "BADGE_COLOR=696969" >> $GITHUB_ENV
else
echo "BADGE_COLOR=31c653" >> $GITHUB_ENV
fi

- name: create badge
uses: emibcn/badge-action@d6f51ff11b5c3382b3b88689ae2d6db22d9737d1
with:
label: Coverage
status: ${{ env.COVERAGE }}
color: ${{ env.BADGE_COLOR }}
path: badge.svg

- name: upload badge to gist
if: >
github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'devel' ||
github.event_name != 'workflow_run' && github.ref == 'refs/heads/devel'
uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d
with:
token: ${{ secrets.GIST_TOKEN }}
gistURL: https://gist.githubusercontent.com/revittm/ee38e9beb22353eef6b88f2ad6ed7aa9
file: badge.svg
46 changes: 42 additions & 4 deletions .github/workflows/hive-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Hive results

on:
workflow_run:
workflows: ["Hive"]
workflows: ["CI"]
types:
- completed

Expand All @@ -12,8 +12,13 @@ jobs:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion != 'skipped'

permissions:
checks: write
pull-requests: write+
actions: read

steps:
- name: Download and extract artifacts
- name: download and extract artifacts
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
Expand All @@ -28,10 +33,43 @@ jobs:
unzip -d "$name" "$name.zip"
done

- name: Publish hive test results
- name: publish hive test results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "artifacts/**/*.xml"
files: "artifacts/**/*.xml"

- name: set badge color
shell: bash
run: |
case ${{ fromJSON( steps.test-results.outputs.json ).conclusion }} in
success)
echo "BADGE_COLOR=31c653" >> $GITHUB_ENV
;;
failure)
echo "BADGE_COLOR=800000" >> $GITHUB_ENV
;;
neutral)
echo "BADGE_COLOR=696969" >> $GITHUB_ENV
;;
esac

- name: create badge
uses: emibcn/badge-action@d6f51ff11b5c3382b3b88689ae2d6db22d9737d1
with:
label: Hive
status: '${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests }} tests, ${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.runs }} runs: ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}'
color: ${{ env.BADGE_COLOR }}
path: badge.svg

- name: upload badge to gist
if: >
github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'devel' ||
github.event_name != 'workflow_run' && github.ref == 'refs/heads/devel'
uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d
with:
token: ${{ secrets.GIST_TOKEN }}
gistURL: https://gist.githubusercontent.com/revittm/dc492845ba6eb694e6c7279224634b20
file: badge.svg
35 changes: 0 additions & 35 deletions .github/workflows/hive.yml

This file was deleted.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Erigon is an implementation of Ethereum (aka "Ethereum client"), on the efficien

![Build status](https://github.com/ledgerwatch/erigon/actions/workflows/ci.yml/badge.svg)

![Coverage](https://gist.githubusercontent.com/revittm/ee38e9beb22353eef6b88f2ad6ed7aa9/raw/19f7838ede42d896370aff17753346a01fc5d4ad/badge.svg)

![Hive](https://gist.githubusercontent.com/revittm/dc492845ba6eb694e6c7279224634b20/raw/51f5a73aa31c5ae2f199969321161bcb9abc5c10/badge.svg)

<!--ts-->

- [System Requirements](#system-requirements)
Expand Down