CI: Get the Slurm tests passing in CI again #6
Workflow file for this run
This file contains 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
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
concurrency: | |
# Skip intermediate builds: all builds except for builds on the `master` branch | |
# Cancel intermediate builds: only pull request builds | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.run_number }} | |
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | |
permissions: | |
contents: read | |
jobs: | |
test-unit: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
version: | |
# - '1.2' # minimum Julia version supported in Project.toml | |
# - '1.6' # previous LTS | |
# - '1.10' # current LTS | |
- '1' # automatically expands to the latest stable 1.x release of Julia | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: julia-actions/setup-julia@v2 | |
with: | |
version: ${{ matrix.version }} | |
- uses: julia-actions/julia-runtest@v1 | |
test-slurm: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
version: | |
# Please note: You must specify the full Julia version number (major.minor.patch). | |
# This is because the value here will be directly interpolated into a download URL. | |
# - '1.2.0' # minimum Julia version supported in Project.toml | |
# - '1.6.7' # previous LTS | |
# - '1.10.7' # current LTS | |
- '1.11.2' # currently the latest stable release | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Print Docker version | |
run: | | |
docker --version | |
docker version | |
# This next bit of code is taken from: | |
# https://github.com/kleinhenz/SlurmClusterManager.jl | |
# Original author: Joseph Kleinhenz | |
# License: MIT | |
- name: Setup Slurm inside Docker | |
run: | | |
docker version | |
docker compose version | |
docker build --build-arg "JULIA_VERSION=${MATRIX_JULIA_VERSION:?}" -t slurm-cluster-julia -f ci/Dockerfile . | |
docker compose -f ci/docker-compose.yml up -d | |
docker ps | |
env: | |
MATRIX_JULIA_VERSION: ${{matrix.version}} | |
- name: Instantiate package | |
run: docker exec -t slurmctld julia --project=ClusterManagers -e 'using Pkg; @show Base.active_project(); Pkg.instantiate(; verbose=true); Pkg.build(; verbose=true); Pkg.status()' | |
- name: Run tests without allocation | |
run: docker exec -t slurmctld julia --project=ClusterManagers -e 'using Pkg; Pkg.test(; test_args=["slurm"])' | |
- name: Run tests inside allocation | |
run: docker exec -t slurmctld salloc -t 00:10:00 -n 2 julia --project=ClusterManagers -e 'using Pkg; Pkg.test(test_args=["slurm"])' | |
- name: Run tests inside sbatch | |
run: | | |
cat << EOF > sbatch.sh | |
#!/bin/bash | |
#SBATCH --ntasks=2 | |
#SBATCH --time=00:10:00 | |
/julia/bin/julia --project=ClusterManagers -e 'using Pkg; Pkg.test(test_args=["slurm"])' | |
EOF | |
docker exec slurm-$SLURM sbatch --wait --output=/SlurmTools/output --error=/SlurmTools/output /SlurmTools/sbatch.sh | |
cat output |