Skip to content

Commit 425cabf

Browse files
committed
use step-security/changed-files directly
1 parent ce611ec commit 425cabf

2 files changed

Lines changed: 82 additions & 49 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "Get PR Info"
2+
3+
inputs:
4+
pr_number:
5+
type: string
6+
required: false
7+
8+
outputs:
9+
pr-info:
10+
description: "String encoded JSON object containing pull-request information"
11+
value: ${{ steps.get-pull-request.outputs.result }}
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- uses: actions/github-script@v7
17+
id: get-pull-request
18+
with:
19+
retries: 3
20+
script: |
21+
return (
22+
await github.rest.pulls.get({
23+
repo: context.repo.repo,
24+
owner: context.repo.owner,
25+
pull_number: (() => {
26+
switch('${{ github.event_name }}') {
27+
case 'pull_request':
28+
case 'pull_request_target':
29+
return '${{ github.ref }}'.split('/')[2];
30+
case 'push':
31+
const branch = '${{ github.ref_name }}';
32+
if (!branch.match(new RegExp('^pull-request/[0-9]+$'))) {
33+
throw new Error(`${branch} does not match PR branch pattern.`);
34+
}
35+
return branch.split('/')[1];
36+
}
37+
throw new Error(`Could not determine pull request number.`);
38+
})()
39+
})
40+
).data;

.github/workflows/main.pr.yml

Lines changed: 42 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -47,73 +47,61 @@ jobs:
4747
uses: actions/checkout@v6
4848
with:
4949
lfs: true
50-
path: node
5150
fetch-depth: 0
5251

5352
- name: Checkout LFS
5453
shell: bash
5554
run: git lfs checkout
56-
working-directory: node
5755

58-
- name: Get changed files
56+
- id: get-pr-info
57+
name: Get PR target branch info
58+
uses: ./.github/actions/get-pr-info
59+
60+
- name: Check if GitHub Actions or devel main Dockerfile changed
5961
id: changed
60-
uses: rapidsai/shared-actions/changed-files@main
62+
uses: step-security/changed-files@60967b822d3001fa82242f8d6b4ed46bc3600a68 # v47.0.1
6163
with:
64+
base_sha: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).base.sha }}
65+
sha: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).head.sha }}
6266
files_yaml: |
6367
dev:
6468
- dev/dockerfiles/devel/main.Dockerfile
6569
src:
66-
- node/yarn.lock
67-
- node/lerna.json
68-
- node/package.json
69-
- node/modules/**/*.c
70-
- node/modules/**/*.h
71-
- node/modules/**/*.ts
72-
- node/modules/**/*.js
73-
- node/modules/**/*.cu
74-
- node/modules/**/*.cuh
75-
- node/modules/**/*.cpp
76-
- node/modules/**/*.hpp
77-
- node/modules/**/*.json
78-
- node/modules/**/*.cmake
79-
- node/modules/**/*.tsconfig
80-
- node/modules/**/package.json
81-
- node/modules/**/CMakeLists.txt
82-
83-
- name: Check if GitHub Actions or devel main Dockerfile changed
84-
id: dev_changed
85-
uses: rapidsai/shared-actions/changed-files@main
86-
with:
87-
path: node
88-
files_yaml: |
70+
- yarn.lock
71+
- lerna.json
72+
- package.json
73+
- modules/**/*.c
74+
- modules/**/*.h
75+
- modules/**/*.ts
76+
- modules/**/*.js
77+
- modules/**/*.cu
78+
- modules/**/*.cuh
79+
- modules/**/*.cpp
80+
- modules/**/*.hpp
81+
- modules/**/*.json
82+
- modules/**/*.cmake
83+
- modules/**/*.tsconfig
84+
- modules/**/package.json
85+
- modules/**/CMakeLists.txt
8986
9087
- name: Update runner env
9188
env:
92-
dev_changed: "${{ fromJSON(steps.changed.outputs.changed_file_groups).dev == 'true' }}"
93-
src_changed: "${{ fromJSON(steps.changed.outputs.changed_file_groups).src == 'true' ||
94-
fromJSON(steps.changed.outputs.changed_file_groups).src_any_deleted == 'true' }}"
89+
dev_changed: "${{ steps.changed.outputs.dev_any_changed == 'true' }}"
90+
src_changed: "${{ steps.changed.outputs.src_any_changed == 'true' ||
91+
steps.changed.outputs.src_any_deleted == 'true' }}"
9592
shell: bash
9693
run: |
97-
VERSION="$(cat node/lerna.json | jq -r '.version')"
98-
RAPIDS_VERSION="$(cat node/package.json | jq -r '.config.rapids_version')"
94+
VERSION="$(cat lerna.json | jq -r '.version')"
95+
RAPIDS_VERSION="$(cat package.json | jq -r '.config.rapids_version')"
9996
echo "VERSION=${VERSION}" >> $GITHUB_ENV;
10097
echo "dev_changed=${dev_changed}" >> $GITHUB_ENV;
10198
echo "src_changed=${src_changed}" >> $GITHUB_ENV;
10299
echo "RAPIDS_VERSION=$RAPIDS_VERSION" >> $GITHUB_ENV;
103100
echo "MAIN_IMG=${REGISTRY}/${{ github.repository }}:${VERSION}-devel-node${NODE}-cuda${CUDA_VERSION_MAJOR}-${{ matrix.LINUX }}-main" >> $GITHUB_ENV;
104-
echo "RUN_ARGS<<EOF" >> $GITHUB_ENV;
105-
echo "\
106-
-u $(id -u):$(id -g) \
107-
-v $(pwd)/.yarn:/.yarn:rw \
108-
-v $(pwd)/.cache:/.cache:rw \
109-
-v $(pwd)/node:/opt/rapids/node:rw \
110-
--env-file ${{ runner.temp }}/.env \
111-
" >> $GITHUB_ENV;
112-
echo "EOF" >> $GITHUB_ENV;
113101
114102
- name: Free up disk space
115103
if: env.is_gha_runner == 'true' && (env.dev_changed == 'true' || env.src_changed == 'true')
116-
uses: ./node/.github/actions/free-disk-space
104+
uses: ./.github/actions/free-disk-space
117105
with:
118106
tool_cache: ${{ runner.tool_cache }}
119107

@@ -184,21 +172,26 @@ jobs:
184172
if: env.dev_changed == 'true' || env.src_changed == 'true'
185173
shell: bash
186174
run: |
187-
has_image="$(docker pull -q --platform linux/${{ matrix.ARCH }} ${MAIN_IMG} && echo "true" || echo "false")";
175+
has_image="$(docker pull -q --platform linux/${{ matrix.ARCH }} "${MAIN_IMG}" && echo "true" || echo "false")";
188176
if "$has_image" || "$dev_changed"; then
189177
DOCKER_BUILDKIT=1 \
190178
DOCKER_SCAN_SUGGEST=false \
191179
docker build --pull --force-rm \
192-
--ulimit nofile=500000:500000 \
180+
--ulimit "nofile=500000:500000" \
193181
--build-arg UCX_VERSION="${{ env.UCX }}" \
194182
--build-arg NODE_VERSION="${{ env.NODE }}" \
195183
--build-arg LINUX_VERSION="${{ matrix.LINUX }}" \
196184
--build-arg AMD64_BASE="nvidia/cuda:${{ matrix.CUDA }}-devel-${{ matrix.LINUX }}" \
197185
--build-arg ARM64_BASE="nvidia/cuda:${{ matrix.CUDA }}-devel-${{ matrix.LINUX }}" \
198-
-f node/dev/dockerfiles/devel/main.Dockerfile -t ${MAIN_IMG} node
186+
-f dev/dockerfiles/devel/main.Dockerfile -t "${MAIN_IMG}" .
199187
fi
200-
docker run --rm -t ${RUN_ARGS} \
188+
docker run --rm -t \
189+
-u "$(id -u):$(id -g)" \
190+
`# -v "$(pwd)/.yarn:/.yarn:rw"` \
191+
`# -v "$(pwd)/.cache:/.cache:rw"` \
192+
-v "$(pwd):/opt/rapids/node:rw" \
201193
-v "$HOME/.gitconfig:/etc/gitconfig" \
202-
${MAIN_IMG} bash -c "set -ex; \
203-
yarn --pure-lockfile --prefer-offline \
204-
&& yarn build"
194+
--ulimit "nofile=500000:500000" \
195+
--env-file ${{ runner.temp }}/.env \
196+
"${MAIN_IMG}" \
197+
bash -cex "yarn --pure-lockfile --prefer-offline && yarn build"

0 commit comments

Comments
 (0)