Skip to content

Set up custom command in ir.py #413

Set up custom command in ir.py

Set up custom command in ir.py #413

Workflow file for this run

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/**
- scripts/**
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"
# Get the client script
# TODO: Not clear if the best is to use $commit or $branch here
wget "https://raw.githubusercontent.com/binpash/pash/$commit/scripts/ws-client.py"
# Install its dependency
python3 -m pip install websocket-client
# Issue the request and wait for it to end
python3 ws-client.py -m run -c "$commit" -b "$branch" | tee results.txt
results=$(cat results.txt)
# Process the results
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,
})