Skip to content

Commit 0aefacd

Browse files
committed
Adding support for testing.
1 parent cdc47da commit 0aefacd

File tree

12 files changed

+155
-8
lines changed

12 files changed

+155
-8
lines changed

.github/actions/build/action.yml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ runs:
5353
ls -lahR ${{ env.ARTIFACTS_DIR }}
5454
<% endif %>
5555

56-
- if: github.repository_owner == 'nv-legate'
56+
- if: github.repository_owner == 'nvidia'
5757
name: Get AWS credentials for sccache bucket
5858
uses: aws-actions/configure-aws-credentials@v4
5959
with:

.github/actions/download-artifacts/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ runs:
3636
name: Cache conda artifacts
3737
uses: actions/cache@v4
3838
with:
39-
key: "nv-legate/${{ inputs.artifact-repo }}@${{ inputs.platform }}-${{ inputs.git_sha }}-${{ inputs.target-device }}"
39+
key: "nvidia/{ inputs.artifact-repo }}@${{ inputs.platform }}-${{ inputs.git_sha }}-${{ inputs.target-device }}"
4040
path: ${{ inputs.dest-dir }}
4141

4242
- if: steps.cache.outputs.cache-hit != 'true'
@@ -45,7 +45,7 @@ runs:
4545
with:
4646
github_token: ${{ inputs.inter-repos-ro-access-token }}
4747
path: ${{ inputs.dest-dir }}
48-
repo: nv-legate/${{ inputs.artifact-repo }}
48+
repo: nvidia/${{ inputs.artifact-repo }}
4949
check_artifacts: true
5050
commit: ${{ inputs.git_sha }}
5151
workflow_conclusion: ""

.github/actions/test/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ runs:
3131
pwd
3232
ls -lahR $ARTIFACTS_DIR
3333
34+
- name: Make test env
35+
shell: bash --noprofile --norc -xeuo pipefail {0}
36+
run: |
37+
"${{ env.REPO_DIR }}/continuous_integration/scripts/entrypoint" "${{ env.REPO_DIR }}/continuous_integration/scripts/make-conda-env" test
38+
3439
- name: Run test / analysis
3540
shell: bash --noprofile --norc -xeuo pipefail {0}
3641
run: |
42+
. conda-utils
43+
activate_conda_env
3744
"${{ env.REPO_DIR }}/continuous_integration/scripts/entrypoint" "${{ env.REPO_DIR }}/continuous_integration/scripts/test" ${{ inputs.test-options }}

.github/workflows/gh-build-and-test.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,93 @@ jobs:
3232
build-mode: ${{ inputs.build-mode }}
3333
upload-enabled: ${{ inputs.upload-enabled }}
3434
secrets: inherit
35+
36+
setup-test:
37+
name: Setup test
38+
if: inputs.upload-enabled == false
39+
needs:
40+
- build
41+
runs-on: linux-amd64-cpu4
42+
outputs:
43+
matrix: ${{ steps.set-matrix.outputs.matrix }}
44+
steps:
45+
- id: set-matrix
46+
run: |
47+
set -xeuo pipefail
48+
MATRIX_JSON='{"include": ['
49+
RUNNERS=('linux-amd64-gpu-v100-latest-1:gpu:linux')
50+
TEST_CONFIGS=('Unit Tests:unit' 'Samples:samples')
51+
52+
for RUNNER in "${RUNNERS[@]}"; do
53+
IFS=':' read -ra RUNNER_INFO <<< "$RUNNER"
54+
RUNNER_NAME=${RUNNER_INFO[0]}
55+
TARGET_DEVICE=${RUNNER_INFO[1]}
56+
RUNNER_PLATFORM=${RUNNER_INFO[2]}
57+
58+
if [[ "$TARGET_DEVICE" == "${{ inputs.target-device }}" && "$RUNNER_PLATFORM" == "${{ inputs.platform }}" ]]; then
59+
for TEST_CONFIG in "${TEST_CONFIGS[@]}"; do
60+
IFS=':' read -ra CONFIG_INFO <<< "$TEST_CONFIG"
61+
CONFIG_NAME=${CONFIG_INFO[0]}
62+
CONFIG_SCOPE=${CONFIG_INFO[1]}
63+
64+
MATRIX_JSON+="{\"runner\": {\"name\": \"$RUNNER_NAME\", \"type\": \"$TARGET_DEVICE\", \"platform\": \"$RUNNER_PLATFORM\"}, \"test-config\": {\"name\": \"$CONFIG_NAME\", \"test-scope\": \"$CONFIG_SCOPE\"}},"
65+
done
66+
fi
67+
done
68+
69+
MATRIX_JSON=$(echo "$MATRIX_JSON" | sed 's/,$//') # Remove the trailing comma
70+
MATRIX_JSON+=']}'
71+
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
72+
73+
test-within-container:
74+
if: github.repository_owner == 'nvidia' && (inputs.platform == 'linux-x64' || inputs.platform == 'linux-aarch64')
75+
needs:
76+
- setup-test
77+
78+
name: ${{ matrix.test-config.name }} (${{ inputs.platform }}, ${{ inputs.target-device }}, ${{ inputs.build-mode }})
79+
80+
strategy:
81+
fail-fast: false
82+
matrix: ${{fromJson(needs.setup-test.outputs.matrix)}}
83+
84+
uses:
85+
./.github/workflows/gh-test-within-container.yml
86+
with:
87+
client-repo: ${{ github.event.repository.name }}
88+
build-type: ${{ inputs.build-type }}
89+
name: ${{ matrix.test-config.name }}
90+
target-device: ${{ inputs.target-device }}
91+
runs-on: ${{ matrix.runner.name }}
92+
has-gpu: ${{ matrix.runner.type == 'gpu' }}
93+
test-options: ${{ matrix.test-config.test-scope }}
94+
platform: ${{ matrix.runner.platform }}
95+
build-mode: ${{ inputs.build-mode }}
96+
upload-enabled: ${{ inputs.upload-enabled }}
97+
secrets: inherit
98+
99+
100+
test-without-container:
101+
if: github.repository_owner == 'nv-legate' && (inputs.platform != 'linux-x64' && inputs.platform != '-aarch64')
102+
needs:
103+
- setup-test
104+
105+
name: ${{ matrix.test-config.name }} (${{ inputs.platform }}, ${{ inputs.target-device }}, ${{ inputs.build-mode }})
106+
107+
strategy:
108+
fail-fast: false
109+
matrix: ${{fromJson(needs.setup-test.outputs.matrix)}}
110+
111+
uses:
112+
./.github/workflows/gh-test-without-container.yml
113+
with:
114+
client-repo: ${{ github.event.repository.name }}
115+
build-type: ${{ inputs.build-type }}
116+
name: ${{ matrix.test-config.name }}
117+
target-device: ${{ inputs.target-device }}
118+
runs-on: ${{ matrix.runner.name }}
119+
has-gpu: ${{ matrix.runner.type == 'gpu' }}
120+
test-options: ${{ matrix.test-config.test-scope }}
121+
platform: ${{ matrix.runner.platform }}
122+
build-mode: ${{ inputs.build-mode }}
123+
upload-enabled: ${{ inputs.upload-enabled }}
124+
secrets: inherit

.github/workflows/gh-test-within-container.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ on:
4141
jobs:
4242
test:
4343
name: ${{ inputs.name }}
44-
if: github.repository_owner == 'nv-legate'
44+
if: github.repository_owner == 'nvidia
4545
runs-on: ${{ inputs.runs-on }}
4646

4747
container:

.github/workflows/gh-test-without-container.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ on:
4141
jobs:
4242
test:
4343
name: ${{ inputs.name }}
44-
if: github.repository_owner == 'nv-legate'
44+
if: github.repository_owner == 'nvidia'
4545
runs-on: ${{ inputs.runs-on }}
4646

4747
defaults:

.github/workflows/gh-upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ on:
4040
jobs:
4141
upload:
4242
name: ${{ inputs.name }}
43-
if: github.repository_owner == 'nv-legate'
43+
if: github.repository_owner == 'nvidia'
4444
runs-on: linux-amd64-gpu-v100-earliest-1
4545

4646
container:

continuous_integration/scripts/make-conda-env

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,18 @@
33
set -x
44

55
make_ci_env() {
6-
mamba env create -n "${CONDA_ENV}" -f "${REPO_DIR}/continuous_integration/environment.yml"
6+
mamba env create -n "${CONDA_ENV}" -f "${REPO_DIR}/continuous_integration/build-environment.yml"
7+
}
8+
9+
make_test_env() {
10+
. conda-utils
11+
12+
mamba env create -n "${CONDA_ENV}" -f "${REPO_DIR}/continuous_integration/test-environment.yml"
13+
14+
activate_conda_env
15+
16+
pip install "${ARTIFACTS_DIR}/*.whl"
17+
718
}
819

920
make_conda_env() {
@@ -14,6 +25,7 @@ make_conda_env() {
1425

1526
case "$1" in
1627
ci) make_ci_env;;
28+
test) make_test_env;;
1729
*) return 1;;
1830
esac
1931

continuous_integration/scripts/test

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
run_test_or_analysis() {
4+
set -x
5+
6+
conda_info;
7+
8+
set -xeuo pipefail
9+
10+
case "$1" in
11+
"unit")
12+
echo "Executing unit tests..."
13+
python -m pytest
14+
;;
15+
"samples")
16+
echo "Running samples..."
17+
python -m pytest examples
18+
;;
19+
20+
*)
21+
echo "Invalid command: $1"
22+
return 1
23+
;;
24+
esac
25+
26+
return 0
27+
}
28+
29+
(run_test_or_analysis "$@");

continuous_integration/scripts/vault-s3-init

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ vault_s3_init() {
3939
echo ""
4040

4141
local vault_token=null;
42-
local user_orgs=nv-legate;
42+
local user_orgs=nvidia;
4343

4444
# Attempt to authenticate with GitHub
4545
eval "$(get_vault_token "${VAULT_HOST}" ${user_orgs} "$GH_TOKEN")";
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: cupy
2+
channels:
3+
- defaults
4+
dependencies:
5+
- python=3.11
6+
- pytest>=6.2.4
7+
- pip
8+
- pip:
9+
- pytest-benchmark>=3.4.1

0 commit comments

Comments
 (0)