From 4f617b14e8adc288fbf9bfac1fdf099849194675 Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Tue, 18 Jun 2024 21:25:21 -0400 Subject: [PATCH] Determine test runner and docker options in prepare. --- .github/workflows/build_and_test.yaml | 20 +++++++++++--------- .github/workflows/test.yaml | 2 -- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index ab73a7c681..f2640640d9 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -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 @@ -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";; @@ -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";; @@ -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";; @@ -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 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7125630845..37e7c9b5f5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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'}}