Skip to content

Commit

Permalink
Determine test runner and docker options in prepare.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed Jun 19, 2024
1 parent fe47d8c commit 4f617b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ on:
python:
type: string
required: true
test_runner:
type: string
required: true
test_docker_options:
type: string
required: true
validate:
type: string
required: true
Expand Down Expand Up @@ -55,13 +49,16 @@ jobs:
runs-on: ubuntu-24.04
outputs:
image: ${{ steps.set.outputs.image }}
cuda: ${{ steps.set.outputs.cuda }}
test_runner: ${{ steps.set.outputs.test_runner }}
test_docker_options: ${{ steps.set.outputs.test_docker_options }}
steps:
- name: Set outputs
id: set
run: |
if [[ "${{ inputs.compiler_family }}" == "gcc" ]]
then
echo 'test_runner="ubuntu-24.04"' >> "$GITHUB_OUTPUT";;
case ${{ inputs.compiler_version }} in
10|11)
echo "image=glotzerlab/ci:ubuntu-22.04" >> "$GITHUB_OUTPUT";;
Expand All @@ -72,6 +69,8 @@ jobs:
esac
elif [[ "${{ inputs.compiler_family }}" == "clang" ]]
then
echo 'test_runner="ubuntu-24.04"' >> "$GITHUB_OUTPUT";;
case "${{ inputs.compiler_version }}" in
13|14|15)
echo "image=glotzerlab/ci:ubuntu-22.04" >> "$GITHUB_OUTPUT";;
Expand All @@ -83,6 +82,9 @@ jobs:
elif [[ "${{ inputs.compiler_family }}" == "cuda" ]]
then
echo "cuda=cuda${{ inputs.compiler_version }}" >> "$GITHUB_OUTPUT"
echo 'test_runner=["self-hosted", "GPU"]' >> "$GITHUB_OUTPUT";;
echo 'test_docker_optios=--gpus=all' >> "$GITHUB_OUTPUT";;
case "${{ inputs.compiler_version }}" in
125)
echo "image=nvidia/cuda:12.5.0-devel-ubuntu22.04" >> "$GITHUB_OUTPUT";;
Expand Down Expand Up @@ -205,10 +207,10 @@ jobs:

test:
needs: [prepare, build]
runs-on: ${{ fromJson(inputs.test_runner) }}
runs-on: ${{ fromJson(needs.prepare.outputs.test_runner) }}
container:
image: ${{ needs.prepare.outputs.image }}
options: ${{ inputs.test_docker_options }} -e CUDA_VISIBLE_DEVICES
options: ${{ needs.prepare.outputs.test_docker_options }}

steps:
- name: Clean workspace
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ jobs:

# Use self-hosted runners or fall back to GitHub hosted runners when self-hosted are offline.
build_runner: ${{ needs.start_action_runners.outputs.active != '0' && '["self-hosted","jetstream2","CPU"]' || toJson('ubuntu-24.04') }}
test_runner: ${{ !matrix.test_runner == '' && toJson(matrix.test_runner) || toJson('ubuntu-24.04') }}
test_docker_options: ${{ matrix.test_docker_options }}

# Default to false when unset
validate: ${{ matrix.validate && 'true' || 'false'}}
Expand Down

0 comments on commit 4f617b1

Please sign in to comment.