Use runs-on GPU runners for CI #250
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| name: R-CMD-check | |
| jobs: | |
| check-cran: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| r: ['release', 'devel'] | |
| runs-on: ubuntu-latest | |
| name: 'CRAN (R: ${{ matrix.r }})' | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| R_KEEP_PKG_SOURCE: yes | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: r-lib/actions/setup-pandoc@v2 | |
| - uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: ${{ matrix.r }} | |
| use-public-rspm: true | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| needs: check | |
| - name: Build | |
| run: R CMD build . | |
| - name: Check | |
| run: R CMD check --no-manual --as-cran cuda.ml_*.tar.gz | |
| env: | |
| _R_CHECK_CRAN_INCOMING_: false | |
| build-image: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - cuml: '21.12' | |
| cuda_image: 'nvidia/cuda:11.2.2-devel-ubuntu20.04' | |
| - cuml: '25.12' | |
| cuda_image: 'nvidia/cuda:12.8.1-devel-ubuntu22.04' | |
| runs-on: ubuntu-latest | |
| name: 'Build (cuML ${{ matrix.cuml }})' | |
| permissions: | |
| contents: read | |
| packages: write | |
| timeout-minutes: 120 | |
| outputs: | |
| image-21: ${{ steps.meta.outputs.image-21 }} | |
| image-26: ${{ steps.meta.outputs.image-26 }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: .github/docker/Dockerfile | |
| push: true | |
| tags: ghcr.io/${{ github.repository }}-ci:cuml${{ matrix.cuml }}-${{ github.sha }} | |
| build-args: | | |
| CUDA_IMAGE=${{ matrix.cuda_image }} | |
| CUML_VERSION=${{ matrix.cuml }} | |
| CMAKE_CUDA_ARCHITECTURES=75 | |
| - name: Export image tag | |
| id: meta | |
| run: | | |
| TAG="ghcr.io/${{ github.repository }}-ci:cuml${{ matrix.cuml }}-${{ github.sha }}" | |
| if [[ "${{ matrix.cuml }}" == "21.12" ]]; then | |
| echo "image-21=${TAG}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "image-26=${TAG}" >> "$GITHUB_OUTPUT" | |
| fi | |
| test-gpu: | |
| needs: build-image | |
| if: ${{ always() && needs.build-image.result == 'success' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - cuml: '21.12' | |
| image: ghcr.io/${{ github.repository }}-ci:cuml21.12-${{ github.sha }} | |
| - cuml: '25.12' | |
| image: ghcr.io/${{ github.repository }}-ci:cuml25.12-${{ github.sha }} | |
| concurrency: | |
| group: gpu-tests-cuml${{ matrix.cuml }} | |
| runs-on: | |
| - "runs-on=${{ github.run_id }}/family=g4dn.xlarge/image=ubuntu24-gpu-x64/spot=true" | |
| name: 'Test GPU (cuML ${{ matrix.cuml }})' | |
| container: | |
| image: ${{ matrix.image }} | |
| credentials: | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| options: --gpus all --runtime=nvidia | |
| timeout-minutes: 60 | |
| env: | |
| NOT_CRAN: true | |
| steps: | |
| - name: Verify GPU access | |
| run: nvidia-smi | |
| - name: Session info | |
| run: | | |
| Rscript -e "sessionInfo()" | |
| Rscript -e "library(cuda.ml)" | |
| - name: Run tests | |
| run: | | |
| Rscript -e "testthat::test_package('cuda.ml', reporter = 'progress')" |