Skip to content

Commit

Permalink
Use jq to get patch author information and fix pr fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
jlb6740 committed Sep 14, 2022
1 parent 486b77d commit a230efa
Showing 1 changed file with 40 additions and 26 deletions.
66 changes: 40 additions & 26 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,23 @@ jobs:
Wasmtime_Repo_On_PR_Comment:
name: Benchmark x64 on PR comment Wasmtime repo
runs-on: ubuntu-latest
# if: (github.event_name == 'push') && (github.repository != 'bytecodealliance/wasmtime-sightglass-benchmarking')
# if: |
# startsWith(github.event.review_comment.body, '/bench_x64')
if: |
(github.event_name == 'pull_request_review') &&
(startsWith(github.event.review.body, '/bench_x64')) &&
(('abrown' == github.event.review.user.login)
|| ('afonso360' == github.event.review.user.login)
|| ('akirilov-arm' == github.event.review.user.login)
|| ('alexcrichton' == github.event.review.user.login)
|| ('bbouvier' == github.event.review.user.login)
|| ('bjorn3' == github.event.review.user.login)
|| ('cfallin' == github.event.review.user.login)
|| ('fitzgen' == github.event.review.user.login)
|| ('jlb6740' == github.event.review.user.login)
|| ('sparker-arm' == github.event.review.user.login)
|| ('uweigand' == github.event.review.user.login))
steps:
- run: echo "MESSAGE=Requested from pull request comment." >> $GITHUB_ENV
- run: echo "ACTOR=${{ github.event.comment.user.login }}" >> $GITHUB_ENV
- run: echo "ACTOR=${{ github.event.review.user.login }}" >> $GITHUB_ENV
- run: echo "REPOSITORY=${{ github.repository }}" >> $GITHUB_ENV
- run: echo "REFS=${{ github.ref }}" >> $GITHUB_ENV
- run: echo "PR_NUMBER=${{ github.event.issue.number }}" >> $GITHUB_ENV
Expand All @@ -40,16 +51,19 @@ jobs:
git clone https://jlb6740:${{env.TOKEN}}@github.com/bytecodealliance/wasmtime-sightglass-benchmarking.git
cd wasmtime-sightglass-benchmarking
git remote add wasmtime ${{ github.event.repository.clone_url }}
git fetch wasmtime
git checkout wasmtime/${{ github.ref_name }} -b ${{ github.ref_name }}
git fetch wasmtime refs/pull/*/merge:refs/remotes/wasmtime/pull/*/merge
git checkout wasmtime/pull/${{ github.ref_name }} -b ${{ github.ref_name }}
git submodule update --init --recursive
git checkout -b wasmtime-performance-testing/FB/${{ github.ref_name }}/${{ github.sha }}
echo ${{ github.event.commits[0].committer.name }}
echo "email - ${{ github.event.commits[0].committer.email }}"
git config user.name '${{ github.event.commits[0].committer.name }}'
git config user.email '${{ github.event.commits[0].committer.email }}'
git commit --allow-empty -m "${GITHUB_CONTEXT}"
git push origin wasmtime-performance-testing/FB/${{ github.ref_name }}/${{ github.sha }}
git checkout -b wasmtime-performance-testing/${{ github.ref }}/${{ github.sha }}
sudo apt install jq
export commit_url=${{ github.event.pull_request._links.commits.href }}
echo $commit_url
echo $(curl -sSL $commit_url | jq -r '.[].commit.committer.name' | tail -n 1)
echo $(curl -sSL $commit_url | jq -r '.[].commit.committer.email' | tail -n 1)
git config user.name $(curl -sSL $commit_url | jq -r '.[].commit.committer.name' | tail -n 1)
git config user.email $(curl -sSL $commit_url | jq -r '.[].commit.committer.email' | tail -n 1)
git commit --allow-empty -m "${{ github.event.pull_request._links.comments.href }}"
git push origin wasmtime-performance-testing/${{ github.ref }}/${{ github.sha }}
#curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${{ env.TOKEN }}" https://api.github.com/repos/bytecodealliance/wasmtime-sightglass-benchmarking/dispatches -d '{"event_type":"Performance Testing", "client_payload":{"message":"${{ env.MESSAGE }}", "actor":"${{ env.ACTOR }}", "repository":"${{ env.REPOSITORY }}", "ref":"${{ env.REFS }}", "pr_number":"${{ env.PR_NUMBER }}", "publish":"${{ env.PUBLISH }}" }'
Performance_Repo_On_Push:
Expand All @@ -59,20 +73,20 @@ jobs:
steps:
- run: echo "$GITHUB_CONTEXT"
- run: echo "${{ github.event.head_commit.message }}"
# - name: "Build sightglass commit '${{ env.SG_COMMIT }}'"
# run: |
# cd ../ && ls -l && rm -rf ./sightglass
# git clone https://github.com/bytecodealliance/sightglass.git && cd ./sightglass
# git checkout ${{env.SG_COMMIT}}
# cargo build --release
- name: "Build sightglass commit '${{ env.SG_COMMIT }}'"
run: |
cd ../ && ls -l && rm -rf ./sightglass
git clone https://github.com/bytecodealliance/sightglass.git && cd ./sightglass
git checkout ${{env.SG_COMMIT}}
cargo build --release
# - name: Checkout ${{ env.event.ref_name }}
# uses: actions/checkout@v3
# with:
# submodules: true
# repository: ${{ env.repository }}
# ref: ${{ env.event.ref_name }}
# path: wasmtime_commit
- name: Checkout ${{ env.event.ref_name }}
uses: actions/checkout@v3
with:
submodules: true
repository: ${{ env.repository }}
ref: ${{ env.event.ref_name }}
path: wasmtime_commit


# - name: Build ${{ env.REF }} from ${{ env.REPOSITORY }}
Expand Down

0 comments on commit a230efa

Please sign in to comment.