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

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

* feat(ci): hive CI tidy up (#2)

run hive on successful CI only
run on non-draft PR only
This commit is contained in:
Max Revitt 2022-07-22 16:09:50 +01:00 committed by GitHub
parent d6001225e7
commit 37ba45a627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 136 additions and 40 deletions

View File

@ -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
@ -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
.github/workflows/coverage.yml vendored Normal file
View File

@ -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

View File

@ -2,7 +2,7 @@ name: Hive results
on:
workflow_run:
workflows: ["Hive"]
workflows: ["CI"]
types:
- completed
@ -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: |
@ -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

View File

@ -1,35 +0,0 @@
name: Hive
on:
workflow_run:
workflows: ["CI"]
types:
- completed
jobs:
hive:
runs-on: ubuntu-20.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
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
- name: parse hive output
run: docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v ${{ github.workspace }}:/work --entrypoint /app/hivecioutput gatewayfm/hive:latest --resultsdir=/work/results --outdir=/work/results
- name: archive hive results
uses: actions/upload-artifact@v3
if: always()
with:
name: hive-ci-output
path: results/*.xml

View File

@ -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)