From f5e7394185e95b27a6f605f44c923362ab45cbd6 Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Wed, 25 Nov 2020 09:37:29 -0800 Subject: [PATCH] Add Slurm Docker tests Start on #105, alternative to #125 Uses container from https://github.com/giovtorres/docker-centos7-slurm --- .github/workflows/UnitTests.jl | 44 ++++++++++++++++++++++++++++++++++ test/runtests.jl | 12 ++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/UnitTests.jl diff --git a/.github/workflows/UnitTests.jl b/.github/workflows/UnitTests.jl new file mode 100644 index 0000000..59e7a81 --- /dev/null +++ b/.github/workflows/UnitTests.jl @@ -0,0 +1,44 @@ +name: Unit Tests + +on: + pull_request: + + push: + branches: + - master + +jobs: + test-slurm: + timeout-minutes: 20 + strategy: + matrix: + os: [ubuntu-latest] + julia_version: ["1.5", "nightly"] + julia_arch: [x64] + fail-fast: false + + runs-on: ${{ matrix.os }} + + env: + SLURM: "latest" + + steps: + - name: Checkout + uses: actions/checkout@v2.2.0 + + - uses: julia-actions/setup-julia@latest + with: + arch: ${{ matrix.julia_arch }} + version: ${{ matrix.julia_version }} + + - name: Start Slurm Docker image + run: | + docker pull giovtorres/docker-centos7-slurm:$SLURM + docker run -d -it -h ernie -v $(pwd):/SlurmTools -v $(julia -e 'print(dirname(Sys.BINDIR))'):/julia --name slurm-$SLURM giovtorres/docker-centos7-slurm:$SLURM + + - name: Instantiate package + run: docker exec slurm-$SLURM /julia/bin/julia --project=/SlurmTools -e 'using Pkg; Pkg.instantiate(verbose=true); Pkg.build(verbose=true)' + + - name: Run tests + run: docker exec slurm-$SLURM /julia/bin/julia --project=/SlurmTools -e 'using Pkg; Pkg.test(test_args=["slurm"])' + diff --git a/test/runtests.jl b/test/runtests.jl index e4ccfbd..a33d423 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -18,6 +18,18 @@ using Distributed wait(rmprocs(workers())) end +if "slurm" in ARGS + @testset "Slurm" begin + p = addprocs_slurm(1) + @test nprocs() == 2 + @test workers() == p + @test fetch(@spawnat :any myid()) == p[1] + @test remotecall_fetch(+,p[1],1,1) == 2 + rmprocs(p) + @test nprocs() == 1 + @test workers() == [1] + end +end @static if Sys.iswindows() windows_which(command) = `powershell.exe -Command Get-Command $command`