Skip to content

Commit

Permalink
Improve tests using Singularity (#189)
Browse files Browse the repository at this point in the history
* Add login for tests using Singularity

* Secure singularity login

* Disable other tests and builds

* Try to login differently

* Revert "Disable other tests and builds"

This reverts commit 52584a7.

* Use variable to use Singularity

* Use action to login to GHCR and use it for tests too
  • Loading branch information
pzehner authored Nov 4, 2024
1 parent 6b410e8 commit bbd4ec6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/__build_base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ jobs:
sudo apt-get install ./singularity-ce_${{ env.SINGULARITY_VERSION }}-jammy_amd64.deb
- name: Login in GitHub Containers Repository with Docker
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login in GitHub Containers Repository with Singularity
run: echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ github.actor }} --password-stdin oras://ghcr.io
Expand Down
27 changes: 23 additions & 4 deletions .github/workflows/build_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -312,22 +312,26 @@ jobs:
strategy:
matrix:
backend:
# run CUDA tests on Ruche supercomputer
# run CUDA tests on Ruche supercomputer with Singularity
- name: cuda
image: nvcc
runner: [self-hosted, cuda]
use_singularity: true
# run OpenMP tests on Azure server
- name: openmp
image: gcc
runner: ubuntu-latest
use_singularity: false
# run Threads tests on Azure server
- name: threads
image: gcc
runner: ubuntu-latest
use_singularity: false
# run Serial tests on Azure server
- name: serial
image: gcc
runner: ubuntu-latest
use_singularity: false

steps:
- name: Get artifacts
Expand All @@ -338,13 +342,28 @@ jobs:
- name: Deploy artifacts
run: tar -xvf tests_${{ matrix.backend.name }}.tar

- name: Login in GitHub Containers Repository with Singularity
run: |
run \
-m "singularity/3.8.3/gcc-11.2.0" \
"echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ github.actor }} --password-stdin oras://ghcr.io"
if: ${{ matrix.backend.use_singularity }}

- name: Login in GitHub Containers Repository with Docker
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: ${{ ! matrix.backend.use_singularity }}

- name: Pull Singularity image
# pulling the image in advance seems necessary as sometimes invoking `singularity run` on the image URL fails because it cannot find ghcr.io
run: |
run \
-m "singularity/3.8.3/gcc-11.2.0" \
singularity pull oras://ghcr.io/kokkos/kokkos-fft/base_${{ matrix.backend.image }}_singularity_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }}
if: ${{ matrix.backend.name == 'cuda' }}
if: ${{ matrix.backend.use_singularity }}

- name: Run CUDA tests within Slurm job and Singularity image
run: |
Expand All @@ -353,10 +372,10 @@ jobs:
-m "singularity/3.8.3/gcc-11.2.0" \
singularity run --nv --bind $PWD/build:/work/build -H /work/build base_${{ matrix.backend.image }}_singularity_${{ needs.check_docker_files.outputs.image_suffix }}_${{ needs.check_docker_files.outputs.image_tag }}.sif \
ctest --output-on-failure
if: ${{ matrix.backend.name == 'cuda' }}
if: ${{ matrix.backend.use_singularity }}

- name: Run OpenMP/Threads/Serial tests within Docker image
run: |
docker run -v $PWD/build:/work/build -w /work/build ghcr.io/kokkos/kokkos-fft/base_${{ matrix.backend.image }}_${{ needs.check_docker_files.outputs.image_suffix }}:${{ needs.check_docker_files.outputs.image_tag }} \
ctest --output-on-failure
if: ${{ matrix.backend.name == 'openmp' || matrix.backend.name == 'threads' || matrix.backend.name == 'serial' }}
if: ${{ ! matrix.backend.use_singularity }}

0 comments on commit bbd4ec6

Please sign in to comment.