-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new(ci): enable kernel testing on PRs. #1935
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# NOTE: This has read-write repo token and access to secrets, so this must | ||
# not run any untrusted code. | ||
# see: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ | ||
name: Comment with Kernel testing resulsts on pull requests | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Drivers CI Build"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
upload: | ||
runs-on: ubuntu-latest | ||
if: github.event.workflow_run.event == 'pull_request' | ||
steps: | ||
- name: 'Download artifact' | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: ${{github.event.workflow_run.id }}, | ||
}); | ||
var matchArtifact = artifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name == "pr" | ||
})[0]; | ||
var download = await github.rest.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
var fs = require('fs'); | ||
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data)); | ||
|
||
- name: 'Unpack artifact' | ||
run: unzip pr.zip | ||
|
||
- name: 'Comment on PR' | ||
uses: actions/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
var fs = require('fs'); | ||
var issue_number = Number(fs.readFileSync('./NR')); | ||
var comment_body = fs.readFileSync('./COMMENT'); | ||
await github.rest.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issue_number, | ||
body: comment_body.toString('utf8') | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,7 +185,7 @@ jobs: | |
run: echo "GIT_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV | ||
|
||
- name: Build and test drivers on ppc64le node via ssh | ||
if: needs.paths-filter.outputs.driver_needs_rebuild | ||
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a fix :) |
||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.PPC64LE_HOST }} | ||
|
@@ -325,3 +325,52 @@ jobs: | |
cd build | ||
source /opt/rh/devtoolset-9/enable | ||
make scap-open -j6 | ||
|
||
# Only runs on pull request since on master branch it is already triggered by pages CI. | ||
kernel-tests-dev: | ||
needs: paths-filter | ||
if: github.event_name == 'pull_request' && (needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true') | ||
uses: ./.github/workflows/reusable_kernel_tests.yaml | ||
with: | ||
# Use real branch's HEAD sha, not the merge commit | ||
libsversion: ${{ github.event.pull_request.head.sha }} | ||
secrets: inherit | ||
|
||
kernel-tests-upload: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Once kernel-tests-dev finish, a new job will take care of uploading PR comment and info to be used by the matching create-comment. |
||
needs: kernel-tests-dev | ||
if: github.event_name == 'pull_request' && (needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download X64 matrix | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: matrix_X64 | ||
path: matrix_X64 | ||
|
||
- name: Download ARM64 matrix | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: matrix_ARM64 | ||
path: matrix_ARM64 | ||
|
||
- name: Save PR info | ||
run: | | ||
mkdir -p ./pr | ||
echo ${{ github.event.number }} > ./pr/NR | ||
touch ./pr/COMMENT | ||
echo "# X64 kernel testing matrix" >> ./pr/COMMENT | ||
echo "$(head -n $(grep -n -v -m1 '^|' matrix_X64/matrix.md | awk -F':' '{ print $1 }') matrix_X64/matrix.md)" >> ./pr/COMMENT | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Magic to get the first line that does not start with |
||
echo "" > ./pr/COMMENT | ||
echo "# ARM64 kernel testing matrix" >> ./pr/COMMENT | ||
echo "$(head -n $(grep -n -v -m1 '^|' matrix_ARM64/matrix.md | awk -F':' '{ print $1 }') matrix_ARM64/matrix.md)" >> ./pr/COMMENT | ||
echo Uploading PR info... | ||
cat ./pr/COMMENT | ||
echo "" | ||
|
||
- name: Upload PR info as artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: pr | ||
path: pr/ | ||
retention-days: 1 | ||
if-no-files-found: warn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as create-comment.yml for perf but with diffeernt workflow_run trigger.