run clang-format #886
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build pull request | |
on: | |
push: | |
branches: | |
- 'pull-request/**' | |
jobs: | |
build-pull-request: | |
name: Build pull request | |
# runs-on: ubuntu-20.04 | |
runs-on: linux-amd64-cpu4 | |
strategy: | |
fail-fast: true | |
matrix: | |
CUDA: ["11.6.2"] | |
LINUX: ["ubuntu20.04"] | |
env: | |
UCX: "1.12.1" | |
NODE: "16.15.1" | |
REGISTRY: "ghcr.io" | |
steps: | |
- name: Dump runner context | |
shell: bash | |
run: | | |
echo "${{ toJSON(runner) }}" | |
echo "is_gha_runner=${{ !contains(runner.name, 'rapidsai') }}" >> $GITHUB_ENV | |
echo "CUDA_VERSION_MAJOR=$(echo "${{ matrix.CUDA }}" | cut -d'.' -f1)" >> $GITHUB_ENV | |
echo "CUDA_VERSION_MINOR=$(echo "${{ matrix.CUDA }}" | cut -d'.' -f2)" >> $GITHUB_ENV | |
echo "CUDA_VERSION_PATCH=$(echo "${{ matrix.CUDA }}" | cut -d'.' -f3)" >> $GITHUB_ENV | |
- name: Set up self-hosted runner | |
if: env.is_gha_runner != 'true' | |
shell: bash | |
run: | | |
sudo apt update && sudo apt install -y --no-install-recommends jq git-lfs openssh-client | |
sudo sed -ri "s@$HOME@${{ runner.workspace }}@g" /etc/passwd | |
sudo chown -R $(id -u):$(id -g) "${{ runner.workspace }}" | |
echo "HOME=${{ runner.workspace }}" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
path: node | |
fetch-depth: 0 | |
- name: Checkout LFS | |
shell: bash | |
run: git lfs checkout | |
working-directory: node | |
- name: Get last successful main commit sha | |
uses: nrwl/last-successful-commit-action@v1 | |
id: last_main_commit | |
with: | |
branch: main | |
workflow_id: "merge.pr.yml" | |
github_token: "${{ github.token }}" | |
- name: Check if source files changed | |
id: src_changed | |
uses: tj-actions/[email protected] | |
with: | |
path: node | |
base_sha: ${{ steps.last_main_commit.outputs.commit_hash }} | |
files: | | |
yarn.lock | |
lerna.json | |
package.json | |
modules/**/*.c | |
modules/**/*.h | |
modules/**/*.ts | |
modules/**/*.js | |
modules/**/*.cu | |
modules/**/*.cuh | |
modules/**/*.cpp | |
modules/**/*.hpp | |
modules/**/*.json | |
modules/**/*.cmake | |
modules/**/*.tsconfig | |
modules/**/package.json | |
modules/**/CMakeLists.txt | |
- name: Check if GitHub Actions or devel main Dockerfile changed | |
id: dev_changed | |
uses: tj-actions/[email protected] | |
with: | |
path: node | |
base_sha: ${{ steps.last_main_commit.outputs.commit_hash }} | |
files: | | |
dev/dockerfiles/devel/main.Dockerfile | |
- name: Update runner env | |
env: | |
dev_changed: "${{ steps.dev_changed.outputs.any_changed == 'true' }}" | |
src_changed: "${{ steps.src_changed.outputs.any_changed == 'true' || steps.src_changed.outputs.any_deleted == 'true' }}" | |
shell: bash | |
run: | | |
VERSION="$(cat node/lerna.json | jq -r '.version')" | |
RAPIDS_VERSION="$(cat node/package.json | jq -r '.config.rapids_version')" | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV; | |
echo "dev_changed=${dev_changed}" >> $GITHUB_ENV; | |
echo "src_changed=${src_changed}" >> $GITHUB_ENV; | |
echo "RAPIDS_VERSION=$RAPIDS_VERSION" >> $GITHUB_ENV; | |
echo "MAIN_IMG=${REGISTRY}/${{ github.repository }}:${VERSION}-devel-node${NODE}-cuda${CUDA_VERSION_MAJOR}-${{ matrix.LINUX }}-main" >> $GITHUB_ENV; | |
echo "RUN_ARGS<<EOF" >> $GITHUB_ENV; | |
echo "\ | |
-u $(id -u):$(id -g) \ | |
-v $(pwd)/.yarn:/.yarn:rw \ | |
-v $(pwd)/.cache:/.cache:rw \ | |
-v $(pwd)/node:/opt/rapids/node:rw \ | |
--env-file ${{ runner.temp }}/.env \ | |
" >> $GITHUB_ENV; | |
echo "EOF" >> $GITHUB_ENV; | |
- name: Free up disk space | |
if: env.is_gha_runner == 'true' && (env.dev_changed == 'true' || env.src_changed == 'true') | |
uses: ./node/.github/actions/free-disk-space | |
with: | |
tool_cache: ${{ runner.tool_cache }} | |
- name: Cache C++ dependencies | |
if: env.dev_changed == 'true' || env.src_changed == 'true' | |
uses: actions/cache@v2 | |
with: | |
key: ${{ runner.os }}-${{ env.VERSION }}-node${{ env.NODE }}-cuda${{ env.CUDA_VERSION_MAJOR }}-${{ matrix.LINUX }}-cache-${{ hashFiles('**/modules/**/CMakeLists.txt', '**/modules/**/*.cmake') }} | |
path: | | |
node/.cache/binary | |
node/.cache/source | |
- name: Cache node_modules | |
if: env.dev_changed == 'true' || env.src_changed == 'true' | |
uses: actions/cache@v2 | |
with: | |
key: ${{ runner.os }}-${{ env.VERSION }}-node${{ env.NODE }}-cuda${{ env.CUDA_VERSION_MAJOR }}-${{ matrix.LINUX }}-node_modules-${{ hashFiles('**/yarn.lock', '**/package.json') }} | |
path: | | |
.yarn | |
.cache | |
node/node_modules | |
- name: Set up ssh-agent | |
if: env.dev_changed == 'true' || env.src_changed == 'true' | |
uses: webfactory/[email protected] | |
with: | |
ssh-auth-sock: ${{ env.HOME }}/ssh-agent | |
ssh-private-key: | | |
${{ secrets.CUMLPRIMS_SSH_PRIVATE_DEPLOY_KEY }} | |
${{ secrets.CUGRAPH_OPS_SSH_PRIVATE_DEPLOY_KEY }} | |
- name: Make container .env | |
if: env.dev_changed == 'true' || env.src_changed == 'true' | |
shell: bash | |
run: | | |
n_archs=2 | |
PARALLEL_LEVEL=${PARALLEL_LEVEL:-1} | |
threads=$((PARALLEL_LEVEL / n_archs)) | |
if [[ "$threads" == 0 ]]; then | |
threads=1; | |
fi | |
cat << EOF > "${{ runner.temp }}/.env" | |
CUDAARCHS=ALL | |
PARALLEL_LEVEL=${threads} | |
NVCC_APPEND_FLAGS=--threads=${n_archs} | |
RAPIDS_VERSION=${RAPIDS_VERSION} | |
SCCACHE_REGION=us-west-2 | |
SCCACHE_IDLE_TIMEOUT=32768 | |
SCCACHE_BUCKET=node-rapids-sccache | |
SCCACHE_SERVER_PORT=$((4220 + $RANDOM % 5000)) | |
EOF | |
echo -e "container .env:\n$(cat "${{ runner.temp }}/.env")" | |
cat << EOF >> "${{ runner.temp }}/.env" | |
AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
EOF | |
- name: Build | |
if: env.dev_changed == 'true' || env.src_changed == 'true' | |
shell: bash | |
run: | | |
has_image="$(docker pull -q --platform linux/amd64 ${MAIN_IMG} && echo 1 || echo 0)"; | |
if [[ ${has_image} == '0' || ${dev_changed} == 'true' ]]; then | |
DOCKER_BUILDKIT=1 \ | |
DOCKER_SCAN_SUGGEST=false \ | |
docker build --pull --force-rm \ | |
--build-arg UCX_VERSION="${{ env.UCX }}" \ | |
--build-arg NODE_VERSION="${{ env.NODE }}" \ | |
--build-arg LINUX_VERSION="${{ matrix.LINUX }}" \ | |
--build-arg AMD64_BASE="nvidia/cuda:${{ matrix.CUDA }}-devel-${{ matrix.LINUX }}" \ | |
--build-arg ARM64_BASE="nvidia/cuda:${{ matrix.CUDA }}-devel-${{ matrix.LINUX }}" \ | |
-f node/dev/dockerfiles/devel/main.Dockerfile -t ${MAIN_IMG} node | |
fi | |
docker run --rm -t ${RUN_ARGS} \ | |
-v "$HOME/.ssh:$HOME/.ssh" \ | |
-e "SSH_AUTH_SOCK=/ssh-agent" \ | |
-v "$SSH_AUTH_SOCK:/ssh-agent" \ | |
-v "$HOME/.ssh:/opt/rapids/.ssh" \ | |
-v "$HOME/.gitconfig:/etc/gitconfig" \ | |
${MAIN_IMG} bash -c "set -ex; \ | |
yarn --pure-lockfile --prefer-offline \ | |
&& yarn build" |