Skip to content

Commit 4b6c07b

Browse files
Simplify
1 parent c9f6324 commit 4b6c07b

File tree

1 file changed

+26
-31
lines changed

1 file changed

+26
-31
lines changed

.github/workflows/test-runner.yml

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,27 @@ env:
3737
BNB_SKIP_CMAKE: 1
3838

3939
jobs:
40-
setup:
41-
runs-on: ubuntu-latest
40+
build:
41+
runs-on: >-
42+
${{
43+
inputs.platform == 'linux-x64' && 'ubuntu-22.04' ||
44+
inputs.platform == 'linux-aarch64' && 'ubuntu-22.04-arm' ||
45+
inputs.platform == 'macos' && 'macos-15' ||
46+
'windows-2025'
47+
}}
4248
outputs:
43-
build_runner: ${{ steps.map.outputs.build_runner }}
44-
test_runner: ${{ steps.map.outputs.test_runner }}
45-
build_os: ${{ steps.map.outputs.build_os }}
46-
arch: ${{ steps.map.outputs.arch }}
47-
artifact_name: ${{ steps.map.outputs.artifact_name }}
49+
test_runner: ${{ steps.config.outputs.test_runner }}
50+
artifact_name: ${{ steps.config.outputs.artifact_name }}
51+
build_os: ${{ steps.config.outputs.build_os }}
52+
arch: ${{ steps.config.outputs.arch }}
4853
steps:
49-
- name: Map configuration to runners
50-
id: map
54+
- name: Configure test runner and paths
55+
id: config
5156
run: |
52-
# Map platform to concrete runner names, OS identifiers, and architecture
57+
# Map platform to OS identifiers, architecture, and test runner
5358
case "${{ inputs.platform }}" in
5459
linux-x64)
5560
BUILD_OS="ubuntu-22.04"
56-
BUILD_RUNNER="ubuntu-22.04"
5761
ARCH="x64"
5862
if [[ "${{ inputs.backend }}" == "cuda" ]]; then
5963
case "${{ inputs.gpu_type }}" in
@@ -69,7 +73,6 @@ jobs:
6973
;;
7074
esac
7175
else
72-
# CPU backend
7376
case "${{ inputs.cpu_type }}" in
7477
icelake)
7578
TEST_RUNNER="banb-aws-general-8-plus-use1-public-80"
@@ -78,7 +81,6 @@ jobs:
7881
TEST_RUNNER="bandb-aws-g4dn-4xlarge-plus-use1-public-80"
7982
;;
8083
"")
81-
# Default: GitHub-provided runner (AMD EPYC 7763)
8284
TEST_RUNNER="ubuntu-22.04"
8385
;;
8486
*)
@@ -90,19 +92,16 @@ jobs:
9092
;;
9193
linux-aarch64)
9294
BUILD_OS="ubuntu-22.04-arm"
93-
BUILD_RUNNER="ubuntu-22.04-arm"
9495
ARCH="aarch64"
9596
TEST_RUNNER="ubuntu-22.04-arm"
9697
;;
9798
macos)
9899
BUILD_OS="macos-15"
99-
BUILD_RUNNER="macos-15"
100100
ARCH="arm64"
101101
TEST_RUNNER="macos-15"
102102
;;
103103
windows)
104104
BUILD_OS="windows-2025"
105-
BUILD_RUNNER="windows-2025"
106105
ARCH="x64"
107106
if [[ "${{ inputs.backend }}" == "cuda" ]]; then
108107
TEST_RUNNER="CUDA-Windows-x64"
@@ -123,24 +122,20 @@ jobs:
123122
else
124123
ARTIFACT="${ARTIFACT}_${{ inputs.cpu_type }}"
125124
fi
126-
# Add torch version and run ID to ensure uniqueness
127125
ARTIFACT="${ARTIFACT}_torch${{ inputs.torch_version }}_${{ github.run_id }}_${{ github.run_attempt }}"
128126
129-
echo "build_runner=${BUILD_RUNNER}" >> $GITHUB_OUTPUT
130127
echo "test_runner=${TEST_RUNNER}" >> $GITHUB_OUTPUT
128+
echo "artifact_name=${ARTIFACT}" >> $GITHUB_OUTPUT
131129
echo "build_os=${BUILD_OS}" >> $GITHUB_OUTPUT
132130
echo "arch=${ARCH}" >> $GITHUB_OUTPUT
133-
echo "artifact_name=${ARTIFACT}" >> $GITHUB_OUTPUT
134131
135-
build:
136-
needs: setup
137-
runs-on: ${{ needs.setup.outputs.build_runner }}
138-
env:
139-
build_os: ${{ needs.setup.outputs.build_os }}
140-
build_arch: ${{ needs.setup.outputs.arch }}
141-
steps:
142132
- uses: actions/checkout@v4
143133

134+
- name: Set build environment variables
135+
run: |
136+
echo "build_os=${{ steps.config.outputs.build_os }}" >> $GITHUB_ENV
137+
echo "build_arch=${{ steps.config.outputs.arch }}" >> $GITHUB_ENV
138+
144139
# Windows + CUDA: Install CUDA Toolkit
145140
- name: Install CUDA Toolkit
146141
if: inputs.backend == 'cuda' && inputs.platform == 'windows'
@@ -172,13 +167,13 @@ jobs:
172167
- name: Upload build artifact
173168
uses: actions/upload-artifact@v4
174169
with:
175-
name: ${{ needs.setup.outputs.artifact_name }}
176-
path: output/${{ needs.setup.outputs.build_os }}/${{ needs.setup.outputs.arch }}/*
170+
name: ${{ steps.config.outputs.artifact_name }}
171+
path: output/${{ steps.config.outputs.build_os }}/${{ steps.config.outputs.arch }}/*
177172
retention-days: 7
178173

179174
test:
180-
needs: [setup, build]
181-
runs-on: ${{ needs.setup.outputs.test_runner }}
175+
needs: build
176+
runs-on: ${{ needs.build.outputs.test_runner }}
182177
env:
183178
BNB_TEST_DEVICE: ${{ inputs.backend }}
184179
steps:
@@ -192,7 +187,7 @@ jobs:
192187
- name: Download build artifact
193188
uses: actions/download-artifact@v4
194189
with:
195-
name: ${{ needs.setup.outputs.artifact_name }}
190+
name: ${{ needs.build.outputs.artifact_name }}
196191
path: bitsandbytes/
197192
merge-multiple: true
198193

0 commit comments

Comments
 (0)