Naive Fault Tolerance Support #371
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Posix Correctness | |
on: | |
pull_request_target: | |
types: [assigned, opened, synchronize, reopened, ready_for_review] | |
# the paths that trigger the ci | |
paths: | |
- compiler/** | |
- runtime/** | |
- evaluation/** | |
- annotations/** | |
jobs: | |
issue-jobs: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.draft == false | |
steps: | |
- name: Inject slug/short variables | |
uses: rlespinasse/[email protected] | |
- name: Trigger Posix CI | |
run: | | |
# get the current commit | |
commit=${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }} | |
# get the current branch | |
branch=${{ env.GITHUB_HEAD_REF_SLUG }} | |
echo "Status: $id $commit $branch" | |
# craft the execution request | |
request="http://ctrl.pash.ndr.md/job=issue&branch=$branch&commit=$commit&benchmark=CORRECTNESS" | |
echo "$request" | |
# issue the request | |
curl -s "$request" | |
# poll until we get the results | |
while true; do | |
echo "Sleeping" | |
sleep 360; | |
# fetch some of the latest results in case some other actions happened | |
data=$(curl -s "ctrl.pash.ndr.md/job=fetch_runs&count=50"); | |
results=$(echo $data | jq '.rows | .[] | select((.commit=='\"$commit\"') and .bench=="CORRECTNESS")') | |
if [ ! -z "$results" ]; then | |
# results are found | |
break; | |
fi | |
done | |
data_result="$(echo $results | jq -r 'select(.commit=='\"$commit\"') | .tests' | jq . | jq -r '.[].csv' | sed 's/# //g')" | |
os=$(echo $results | jq -r ' select(.commit=='\"$commit\"') | .specs.os') | |
ram=$(echo $results | jq -r ' select(.commit=='\"$commit\"') | .specs.ram') | |
kernel=$(echo $results | jq -r ' select(.commit=='\"$commit\"') | .specs.kernel') | |
cpu=$(echo $results | jq -r ' select(.commit=='\"$commit\"') | .specs.cpu') | |
echo "OS = $os" > t | |
echo "CPU = $cpu" >> t | |
echo "Ram = $ram" >> t | |
echo "Hash = $commit" >> t | |
echo "Kernel= $kernel" >> t | |
echo "$data_result" | sed 's/,/|/g' | awk 'NR==1{print; print "-|-|-|-|-|-|-|-|-" } NR!=1' | sed 's/^/|/' | sed 's/$/|/' | sed 's/bench/benchmark/' >> t | |
final="$(cat t)" | |
echo "OUTPUT<<EOF" >> $GITHUB_ENV | |
echo "$final" >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
# generate the Github Artifact | |
mkdir ~/artifact | |
echo $results | jq -r 'select(.commit=='\"$commit\"') | .tests' | jq . | jq -r '.[].posix_log' > ~/artifact/posix.log | |
mv t ~/artifact/all_tests.log | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: correctness-artifact | |
path: ~/artifact | |
- name: Comment on PR | |
uses: actions/github-script@v3 | |
with: | |
script: | | |
let body = `${{ env.OUTPUT }}` | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body, | |
}) |