Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 63 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
name: "Build"

on:
pull_request:
branches: [ main ]
issue_comment:
types: [created]

jobs:
trigger-comment:
if: github.event.issue.pull_request && contains(github.event.comment.body, '/build')
runs-on: ubuntu-latest
steps:
- name: "Post trigger comment"
uses: actions/github-script@v7
with:
script: |
const workflowUrl = `${context.payload.repository.html_url}/actions/runs/${context.runId}`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `🚀 Build workflow triggered! [View run](${workflowUrl})`
});

build:
needs: trigger-comment
if: github.event.issue.pull_request && contains(github.event.comment.body, '/build')
strategy:
matrix:
include:
Expand All @@ -22,8 +40,27 @@ jobs:
image: ${{ matrix.image }}

steps:
- name: "Checkout code"
- name: "Free disk space"
run: |
sudo rm -rf /usr/local/lib/android || true
sudo rm -rf /usr/share/dotnet || true

- name: "Retrieve PR info"
uses: actions/github-script@v7
id: pr-info
with:
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
core.setOutput('sha', pr.data.head.sha);

- name: "Checkout PR code"
uses: actions/checkout@v4
with:
ref: ${{ steps.pr-info.outputs.sha }}

- name: "Full build with NVSHMEM"
run: |
Expand All @@ -38,3 +75,26 @@ jobs:
cd build-no-nvshmem
cmake ..
make -j$(nproc)

result-comment:
needs: build
if: always() && github.event.issue.pull_request && contains(github.event.comment.body, '/build')
runs-on: ubuntu-latest
steps:
- name: "Post result comment"
uses: actions/github-script@v7
with:
script: |
const workflowUrl = `${context.payload.repository.html_url}/actions/runs/${context.runId}`;
const success = '${{ needs.build.result }}' === 'success';

const message = success
? `✅ Build workflow passed! [View run](${workflowUrl})`
: `❌ Build workflow failed! [View run](${workflowUrl})`;

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: message
});