Skip to content
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

Implement Github CI #84

Merged
merged 40 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c4f5d79
First commit.
sandeepd-nv Aug 5, 2024
5b98229
Adding some required environment varaibles.
sandeepd-nv Aug 5, 2024
ad574fb
Use linux-x64 instead of just linux.
sandeepd-nv Aug 5, 2024
072cbd9
Copied all files from legate-gh-ci into repo.
sandeepd-nv Aug 7, 2024
e132734
Removed all references to legate-gh-ci
sandeepd-nv Aug 7, 2024
6dc8110
Fixed path to gh-build.yml in gh-build-and-test.yml.
sandeepd-nv Aug 7, 2024
784fc22
Checkout current repo in gh-build.yml instead of doing that in the se…
sandeepd-nv Aug 7, 2024
81fb7ee
Fixed path to the actions folder.
sandeepd-nv Aug 7, 2024
ec410dd
Fixed path to the actions folder. Attempt 2.
sandeepd-nv Aug 7, 2024
fe3f124
Fixed workflow name. Fixed spelling.
sandeepd-nv Aug 7, 2024
c668b8b
Render-template.py does not work with absolute paths.
sandeepd-nv Aug 7, 2024
38b5589
LEGATE_GH_CI_DIR -> REPO_DIR.
sandeepd-nv Aug 7, 2024
e4f9418
Fixed path to the scripts folder.
sandeepd-nv Aug 7, 2024
c80048d
Call init_build_env from build.
sandeepd-nv Aug 7, 2024
6fcb6a0
BUILD_TYPE is now ci.
sandeepd-nv Aug 7, 2024
b27beba
Fixed mamba command line args.
sandeepd-nv Aug 7, 2024
655c8bc
CUDA_ENV is now cupy everywhere.
sandeepd-nv Aug 7, 2024
cdc47da
Build and upload wheel.
sandeepd-nv Aug 7, 2024
0aefacd
Adding support for testing.
sandeepd-nv Aug 8, 2024
e752e31
Fix missing quote.
sandeepd-nv Aug 8, 2024
4614302
Change user org back to nv-legate in vault-s3-init.
sandeepd-nv Aug 8, 2024
f7ce771
Removed sccache.
sandeepd-nv Aug 8, 2024
ae07e03
Temporarily use legate-colossus-cluster1-node0 as a builder.
sandeepd-nv Aug 8, 2024
2a56ac6
Go back to using linux-amd64-cpu16 as a builder.
sandeepd-nv Aug 8, 2024
5554599
Minor fix.
sandeepd-nv Aug 14, 2024
3453074
Checkout current repo in gh-test*.yml.
sandeepd-nv Aug 15, 2024
6fc78f0
Fix wildcard quoting.
sandeepd-nv Aug 15, 2024
ccb9029
Use full path to conda-utils in run test step.
sandeepd-nv Aug 15, 2024
508024a
Temporarily short-circuit the build process.
sandeepd-nv Aug 15, 2024
6133839
Temporarily short-circuit the build process. Attempt 2.
sandeepd-nv Aug 15, 2024
a017fa6
Install pytest and activate conda environment from within the test sc…
sandeepd-nv Aug 15, 2024
1dfb3b0
Call set_base_defs to set CUDA_ENV.
sandeepd-nv Aug 15, 2024
3f60482
Update test environment to include run time dependencies.
sandeepd-nv Aug 15, 2024
ac42b58
Use the same environment for build and test.
sandeepd-nv Aug 16, 2024
adf94ae
Remove testing for now.
sandeepd-nv Aug 16, 2024
760ea3f
Remove inter-repos-ro-access-token and set cuda-version to 12.6 only.
sandeepd-nv Aug 23, 2024
48c7f24
Renamed platform to host-platform.
sandeepd-nv Aug 23, 2024
e5d5fe0
Rename cupy to cuda_python.
sandeepd-nv Aug 23, 2024
4149c9a
Removed darwin supportf rom setup-utils.
sandeepd-nv Aug 23, 2024
01389ef
Changed python version constraint.
sandeepd-nv Aug 23, 2024
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
90 changes: 90 additions & 0 deletions .github/actions/build/action.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: build

description: Build specified project

inputs:
build-type:
required: true
type: string
description: One of ci / release
target-device:
required: true
type: string
host-platform:
required: true
type: string
use-container:
required: true
type: boolean
docker-image:
type: string
required: true
upload-enabled:
required: true
type: boolean

runs:
using: composite
steps:

<% for package_id, package_info in packages.items() %>
- name: Download <<package_info.repo>> (artifacts)
uses: ./.github/actions/download-artifacts
with:
artifact-repo: "<<package_info.repo>>"
artifact-name: "<<package_info.artifact_name | replace_placeholder('repo', package_info.repo) | replace_placeholder('git_tag', package_info.git_tag) >>"
target-device: "${{ inputs.target-device }}"
git_sha: "<<package_info.git_tag>>"
host-platform: ${{ inputs.host-platform }}
dest-dir: ${{ env.ARTIFACTS_DIR }}
dependencies-workflow: <<package_info.artifact_workflow>>
<% endfor %>

<% if packages %>

- name: Display structure of downloaded artifacts
shell: bash --noprofile --norc -xeuo pipefail {0}
run: |
pwd
ls -lahR ${{ env.ARTIFACTS_DIR }}
<% endif %>

- if: ${{ inputs.use-container }}
name: Build (in container)
shell: bash --noprofile --norc -xeuo pipefail {0}
run: |

docker run \
-e AWS_REGION \
-e AWS_SESSION_TOKEN \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
-e GITHUB_TOKEN \
-e ARTIFACTS_DIR="$ARTIFACTS_DIR" \
-e UPLOAD_ENABLED="$UPLOAD_ENABLED" \
-e USE_CUDA="$USE_CUDA" \
-e REPO_DIR="$REPO_DIR" \
-e LEGATE_CORE_BUILD_MODE="$LEGATE_CORE_BUILD_MODE" \
-e PYTHON_VERSION="$PYTHON_VERSION" \
-v "${{ env.REPO_DIR }}:${{ env.REPO_DIR }}" \
-v "${{ env.ARTIFACTS_DIR }}:${{ env.ARTIFACTS_DIR }}" \
--rm "${{ inputs.docker-image }}" \
/bin/bash -c "${{ env.REPO_DIR }}/continuous_integration/scripts/entrypoint ${{ env.REPO_DIR }}/continuous_integration/scripts/build ${{ inputs.build-type}} ${{ inputs.target-device }}"

- if: ${{ !inputs.use-container }}
name: Build (without container)
shell: bash --noprofile --norc -xeuo pipefail {0}
run: |
"${{ env.REPO_DIR }}/continuous_integration/scripts/entrypoint" "${{ env.REPO_DIR }}/continuous_integration/scripts/build" "${{ inputs.build-type}}" "${{ inputs.target-device }}"

- name: Display structure of the artifacts folder (post build)
shell: bash --noprofile --norc -xeuo pipefail {0}
run: |
sudo chown -R $(whoami) ${{ env.ARTIFACTS_DIR }}
ls -lahR ${{ env.ARTIFACTS_DIR }}

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACTS_DIR }}
59 changes: 59 additions & 0 deletions .github/actions/download-artifacts/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: download-artifacts

description: Download dependencies (artifacts)

inputs:
artifact-repo:
type: string
require: true
artifact-name:
type: string
require: true
target-device:
type: string
required: true
git_sha:
type: string
required: true
host-platform:
type: string
required: true
dest-dir:
type: string
required: true
dependencies-workflow:
required: true
type: string

runs:
using: composite
steps:

- id: cache
name: Cache conda artifacts
uses: actions/cache@v4
with:
key: "nvidia/{ inputs.artifact-repo }}@${{ inputs.host-platform }}-${{ inputs.git_sha }}-${{ inputs.target-device }}"
path: ${{ inputs.dest-dir }}

- if: steps.cache.outputs.cache-hit != 'true'
name: Download ${{ inputs.artifact-repo }} artifacts
uses: dawidd6/action-download-artifact@v3
with:
path: ${{ inputs.dest-dir }}
repo: nvidia/${{ inputs.artifact-repo }}
check_artifacts: true
commit: ${{ inputs.git_sha }}
workflow_conclusion: ""
workflow: ${{ inputs.dependencies-workflow }}
name: ${{ inputs.artifact-name }}
skip_unpack: true
if_no_artifact_found: fail
allow_forks: false

- if: steps.cache.outputs.cache-hit != 'true'
name: Unpack artifact
shell: bash --noprofile --norc -xeuo pipefail {0}
run: |
cd ${{ inputs.dest-dir }}
unzip *.zip
68 changes: 68 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Common setup

inputs:
client-repo:
required: true
type: string
build-type:
required: true
type: string
target-device:
required: true
type: string
host-platform:
required: true
type: string
build-mode:
required: true
type: string
upload-enabled:
required: true
type: boolean
python-version:
required: false
type: string

runs:
using: composite
steps:
- name: Set REPO_DIR and Dump environment
shell: bash --noprofile --norc -xeuo pipefail {0}
run: |
echo "REPO_DIR=$(pwd)" >> $GITHUB_ENV
env

- name: Set environment variables
shell: bash --noprofile --norc -xeuo pipefail {0}
run: |

WITH_TESTS_STR=''
if [[ ("${{ inputs.upload-enabled }}" == "false") && ("${{ inputs.build-type }}" != "ci") ]]; then
WITH_TESTS_STR='-with_tests'
fi

TARGET_PLATFORM='linux-64'
if [[ "${{ inputs.host-platform }}" == "linux-aarch64" ]]; then
TARGET_PLATFORM='linux-aarch64'
fi

BUILD_MODE="${{ inputs.build-mode }}"
BUILD_MODE_STR=""
[ -n "${BUILD_MODE}" ] && BUILD_MODE_STR="-${BUILD_MODE}"

if [[ ("${BUILD_MODE}" == "") || ("${BUILD_MODE}" == "release") ]]; then
# We upload release versions in the default folder.
PKG_DIR="${TARGET_PLATFORM}"
else
PKG_DIR="${BUILD_MODE}/${TARGET_PLATFORM}"
fi

echo "ARTIFACT_NAME=${{ inputs.host-platform }}-${{ inputs.build-type }}-${{ inputs.client-repo }}-python${{ inputs.python-version }}-${{ inputs.target-device }}${BUILD_MODE_STR}${WITH_TESTS_STR}-${{ github.sha }}" >> $GITHUB_ENV
echo "ARTIFACTS_DIR=$(realpath "$(pwd)/dist")" >> $GITHUB_ENV
echo "USE_CUDA=${{ (inputs.target-device == 'cpu' && 'OFF') || 'ON' }}" >> $GITHUB_ENV
echo "UPLOAD_ENABLED=${{ (inputs.upload-enabled == 'true' && 'ON') || 'OFF' }}" >> $GITHUB_ENV
echo "LEGATE_CORE_BUILD_MODE=${BUILD_MODE}" >> $GITHUB_ENV
echo "BUILD_DATE=$(date +%Y%m%d)" >> $GITHUB_ENV
echo "TARGET_PLATFORM=${TARGET_PLATFORM}" >> $GITHUB_ENV
echo "PKG_DIR=${PKG_DIR}" >> $GITHUB_ENV
echo "PYTHON_VERSION=${{ inputs.python-version }}" >> $GITHUB_ENV
35 changes: 35 additions & 0 deletions .github/workflows/ci-gh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and test

concurrency:
group: ${{ startsWith(github.ref_name, 'main') && format('unique-{0}', github.run_id) || format('ci-build-and-test-on-{0}-from-{1}', github.event_name, github.ref_name) }}
cancel-in-progress: true

on:
push:
branches:
- "pull-request/[0-9]+"
- "main"

jobs:
build-and-test:
name: Build and test (${{ matrix.host-platform }}, ${{ matrix.target-device }}, ${{ matrix.build-mode }})
strategy:
fail-fast: false
matrix:
host-platform:
- linux-x64
target-device:
- gpu
build-mode:
- release
upload-enabled:
- false
uses:
./.github/workflows/gh-build-and-test.yml
with:
host-platform: ${{ matrix.host-platform }}
target-device: ${{ matrix.target-device }}
build-mode: ${{ matrix.build-mode }}
build-type: ci
upload-enabled: ${{ matrix.upload-enabled }}
secrets: inherit
34 changes: 34 additions & 0 deletions .github/workflows/gh-build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
workflow_call:
inputs:
host-platform:
type: string
required: true
target-device:
type: string
required: true
build-mode:
type: string
required: true
build-type:
type: string
required: true
upload-enabled:
type: boolean
required: true
jobs:
build:
if: ${{ github.repository_owner == 'nvidia' }}
uses:
./.github/workflows/gh-build.yml
with:
client-repo: ${{ github.event.repository.name }}
target-device: ${{ inputs.target-device }}
runs-on: ${{ (inputs.host-platform == 'linux-x64' && 'linux-amd64-cpu16') || (inputs.host-platform == 'linux-aarch64' && 'linux-arm64-cpu16') || (inputs.host-platform == 'mac' && 'macos-latest') }}
build-type: ${{ inputs.build-type }}
use-container: ${{ inputs.host-platform == 'linux-x64' || inputs.host-platform == 'linux-aarch64'}}
host-platform: ${{ inputs.host-platform }}
dependencies-file: ""
build-mode: ${{ inputs.build-mode }}
upload-enabled: ${{ inputs.upload-enabled }}
secrets: inherit
95 changes: 95 additions & 0 deletions .github/workflows/gh-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Build

on:
workflow_call:
inputs:
client-repo:
required: true
type: string
target-device:
required: true
type: string
runs-on:
required: true
type: string
build-type:
required: true
type: string
description: One of ci / release
use-container:
required: true
type: boolean
host-platform:
required: true
type: string
dependencies-file:
required: true
type: string
description: path to versions.json relative to the target repo dir
build-mode:
required: true
type: string
upload-enabled:
required: true
type: boolean
python-version:
required: false
type: string

jobs:
build:
name: Build (${{ inputs.host-platform }}, ${{ inputs.target-device }}, ${{ inputs.build-type }}, CMake build-mode=${{ inputs.build-mode }}, Python "${{ inputs.python-version }}", Use container=${{ inputs.use-container }} )

permissions:
id-token: write # This is required for configure-aws-credentials
contents: read # This is required for actions/checkout

runs-on: ${{ inputs.runs-on }}

steps:
- name: Checkout ${{ inputs.client-repo }}
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup
uses: ./.github/actions/setup
with:
client-repo: ${{ inputs.client-repo }}
build-type: ${{ inputs.build-type }}
target-device: "${{ inputs.target-device }}"
host-platform: ${{ inputs.host-platform }}
build-mode: ${{ inputs.build-mode }}
upload-enabled: ${{ inputs.upload-enabled }}
python-version: ${{ inputs.python-version }}

- name: Render templates
shell: bash --noprofile --norc -xeuo pipefail {0}
run: |
pip -q install jinja2

DEPENDENCIES_FILE=""

if [ -z "${{ inputs.dependencies-file }}" ]; then
DEPENDENCIES_FILE="${REPO_DIR}/continuous_integration/no_dependencies.json"
else
DEPENDENCIES_FILE="${REPO_DIR}/${{ inputs.dependencies-file }}"
fi

${REPO_DIR}/continuous_integration/scripts/render-template.py .github/actions/build/action.yml.j2 "${DEPENDENCIES_FILE}" .github/actions/build/action.yml

- name: Dump templates
shell: bash --noprofile --norc -xeuo pipefail {0}
run: |
echo ${REPO_DIR}/.github/actions/build/action.yml
cat ${REPO_DIR}/.github/actions/build/action.yml

- name: Call build action
uses: ./.github/actions/build
with:
build-type: ${{ inputs.build-type }}
target-device: "${{ inputs.target-device }}"
host-platform: ${{ inputs.host-platform }}
use-container: ${{ inputs.use-container }}
docker-image: "condaforge/miniforge3:latest"
upload-enabled: ${{ inputs.upload-enabled }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,6 @@ dmypy.json

# Cython debug symbols
cython_debug/

# Dont ignore
!.github/actions/build/
Loading