|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | +concurrency: |
| 8 | + # Skip intermediate builds: all builds except for builds on the `master` branch |
| 9 | + # Cancel intermediate builds: only pull request builds |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.run_number }} |
| 11 | + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | +jobs: |
| 15 | + finalize: |
| 16 | + timeout-minutes: 10 |
| 17 | + needs: |
| 18 | + - unit-tests |
| 19 | + - test-slurm |
| 20 | + # Important: the next line MUST be `if: always()`. |
| 21 | + # Do not change that line. |
| 22 | + # That line is necessary to make sure that this job runs even if tests fail. |
| 23 | + if: always() |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - run: | |
| 27 | + echo unit-tests: ${{ needs.unit-tests.result }} |
| 28 | + echo test-slurm: ${{ needs.test-slurm.result }} |
| 29 | + - run: exit 1 |
| 30 | + # The last line must NOT end with || |
| 31 | + # All other lines MUST end with || |
| 32 | + if: | |
| 33 | + (needs.unit-tests.result != 'success') || |
| 34 | + (needs.test-slurm.result != 'success') |
| 35 | + unit-tests: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + timeout-minutes: 20 |
| 38 | + strategy: |
| 39 | + fail-fast: false |
| 40 | + matrix: |
| 41 | + version: |
| 42 | + - '1.2' # minimum Julia version supported in Project.toml |
| 43 | + - '1.6' # previous LTS |
| 44 | + - '1.10' # current LTS |
| 45 | + - '1' # automatically expands to the latest stable 1.x release of Julia |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + persist-credentials: false |
| 50 | + - uses: julia-actions/setup-julia@v2 |
| 51 | + with: |
| 52 | + version: ${{ matrix.version }} |
| 53 | + - uses: julia-actions/julia-runtest@v1 |
| 54 | + test-slurm: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + timeout-minutes: 20 |
| 57 | + strategy: |
| 58 | + fail-fast: false |
| 59 | + matrix: |
| 60 | + version: |
| 61 | + # Please note: You must specify the full Julia version number (major.minor.patch). |
| 62 | + # This is because the value here will be directly interpolated into a download URL. |
| 63 | + # - '1.2.0' # minimum Julia version supported in Project.toml |
| 64 | + - '1.6.7' # previous LTS |
| 65 | + - '1.10.7' # current LTS |
| 66 | + - '1.11.2' # currently the latest stable release |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@v4 |
| 69 | + with: |
| 70 | + persist-credentials: false |
| 71 | + - name: Print Docker version |
| 72 | + run: | |
| 73 | + docker --version |
| 74 | + docker version |
| 75 | + # This next bit of code is taken from: |
| 76 | + # https://github.com/kleinhenz/SlurmClusterManager.jl |
| 77 | + # Original author: Joseph Kleinhenz |
| 78 | + # License: MIT |
| 79 | + - name: Setup Slurm inside Docker |
| 80 | + run: | |
| 81 | + docker version |
| 82 | + docker compose version |
| 83 | + docker build --build-arg "JULIA_VERSION=${MATRIX_JULIA_VERSION:?}" -t slurm-cluster-julia -f ci/Dockerfile . |
| 84 | + docker compose -f ci/docker-compose.yml up -d |
| 85 | + docker ps |
| 86 | + env: |
| 87 | + MATRIX_JULIA_VERSION: ${{matrix.version}} |
| 88 | + - name: Print some information for debugging purposes |
| 89 | + run: | |
| 90 | + docker exec -t slurmctld pwd |
| 91 | + docker exec -t slurmctld ls -la |
| 92 | + docker exec -t slurmctld ls -la ClusterManagers |
| 93 | + - name: Instantiate package |
| 94 | + run: docker exec -t slurmctld julia --project=ClusterManagers -e 'import Pkg; @show Base.active_project(); Pkg.instantiate(); Pkg.status()' |
| 95 | + - name: Run tests without a Slurm allocation |
| 96 | + run: docker exec -t slurmctld julia --project=ClusterManagers -e 'import Pkg; Pkg.test(; test_args=["slurm"])' |
| 97 | + - name: Run tests inside salloc |
| 98 | + run: docker exec -t slurmctld salloc -t 00:10:00 -n 2 julia --project=ClusterManagers -e 'import Pkg; Pkg.test(test_args=["slurm"])' |
| 99 | + - name: Run tests inside sbatch |
| 100 | + run: docker exec -t slurmctld ClusterManagers/ci/run_my_sbatch.sh |
0 commit comments