Skip to content
Closed
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
130 changes: 68 additions & 62 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
name: "Build"

on:
issue_comment:
types: [created]
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})`
});
#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')
#needs: trigger-comment
#if: github.event.issue.pull_request && contains(github.event.comment.body, '/build')
strategy:
matrix:
include:
Expand All @@ -36,65 +38,69 @@ jobs:

name: ${{ matrix.name }}
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}
#container:
# image: ${{ matrix.image }}

steps:
- 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: "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 }}
#with:
# ref: ${{ steps.pr-info.outputs.sha }}

- name: "Full build with NVSHMEM"
run: |
mkdir -p build-nvshmem
cd build-nvshmem
cmake -DCUDECOMP_ENABLE_NVSHMEM=1 -DCUDECOMP_BUILD_EXTRAS=1 ..
make -j$(nproc)
docker run --rm -v $PWD:/workspace -w /workspace ${{ matrix.image }} bash -c '
mkdir -p build-nvshmem
cd build-nvshmem
cmake -DCUDECOMP_ENABLE_NVSHMEM=1 -DCUDECOMP_BUILD_EXTRAS=1 ..
make -j$(nproc)
'

- name: "Library only build without NVSHMEM"
run: |
mkdir -p build-no-nvshmem
cd build-no-nvshmem
cmake ..
make -j$(nproc)
docker run --rm -v $PWD:/workspace -w /workspace ${{ matrix.image }} bash -c '
mkdir -p build-no-nvshmem
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';
#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})`;
# 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
});
# github.rest.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: message
# });