Post a comment on each performance check completing

(Or at least try to 😬)
This commit is contained in:
Damian Mee 2020-01-19 09:59:01 +07:00 committed by GitHub
parent 7546a830ab
commit 19c7010f9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,10 @@ on:
schedule: schedule:
- cron: '2 1 * * *' - cron: '2 1 * * *'
push:
branches:
- 'perf'
jobs: jobs:
build: build:
name: Build name: Build
@ -31,6 +35,9 @@ jobs:
steps: steps:
- uses: actions/checkout@v1.0.0 - uses: actions/checkout@v1.0.0
- name: Log start time
run: touch /tmp/start
- name: Register self-compiled qemu - name: Register self-compiled qemu
run: docker run --rm --privileged meedamian/simple-qemu:${{matrix.qemu}}-${{matrix.arch}} -p yes run: docker run --rm --privileged meedamian/simple-qemu:${{matrix.qemu}}-${{matrix.arch}} -p yes
@ -59,3 +66,78 @@ jobs:
docker run --rm --entrypoint=uname bitcoind -a docker run --rm --entrypoint=uname bitcoind -a
docker run --rm bitcoind --version docker run --rm bitcoind --version
- name: Calculate execution time
run: |
START=$(date -r /tmp/start +%s)
NOW=$(date +%s)
DIFF=$(( NOW - START ))
SEC=1
MIN=$(( 60 * SEC ))
HOUR=$(( 60 * MIN ))
DAY=$(( 24 * HOUR ))
secs=$(( DIFF % 60 ))
mins=$(( $(( DIFF / MIN )) % 60 ))
hours=$(( $(( DIFF / HOUR )) % 24 ))
days=$(( DIFF / DAY ))
OUT=""
if [[ "${days}" -ne "0" ]]; then
# Days-long jobs shouldn't happen, but 🤷🏻‍♂️
OUT="${days}d "
fi
OUT="${OUT}${hours}h:${mins}m:${secs}s"
mkdir -p stat
echo "${OUT}" > stat/${{matrix.qemu}}-${{matrix.arch}}
- name: Save execution time as an artifact
uses: actions/upload-artifact@v1.0.0
with:
name: stats
path: stat/
comment:
name: Report result
needs: build
runs-on: ubuntu-18.04
steps:
- name: Download perf stats
uses: actions/download-artifact@v1.0.0
with:
name: stats
- name: Aggregate results
run: |
touch ./all-stats
echo "| version | arm32v7 | arm64" >> ./all-stats
echo "|:-------:|--------:|-----:" >> ./all-stats
for ver in $(ls ./stats/* | awk -F/ '{print $NF}' | cut -d- -f1 | uniq); do
line="| **${ver}**"
line="${line} | $(cat ./stats/${ver}-arm32v7 | tr -d '\n')"
line="${line} | $(cat ./stats/${ver}-arm64 | tr -d '\n')"
echo "${line}" >> ./all-stats
done
cat ./all-stats
echo ::set-env name=RESULTS::"$(cat ./all-stats | sed -z 's/\n/\\n/g')"
- uses: actions/github-script@0.4.0
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
owner: 'lncm',
repo: 'docker-bitcoind',
issue_number: 9,
body: `Today's results:\n\n${process.env.RESULTS.replace(/\\n/g, '\n')}`
})