Build slurm packages #6
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: Build slurm packages | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
build: | |
permissions: | |
contents: write # for softprops/action-gh-release to create GitHub release | |
runs-on: self-hosted | |
strategy: | |
fail-fast: false | |
matrix: | |
slurm: | |
- version: 24.05.5 | |
image: | |
- file: slurm-packages/Dockerfile | |
push: false | |
platforms: linux/amd64 | |
load: true | |
build_args: | |
BASE_IMAGE=nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04 | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 | |
with: | |
egress-policy: audit | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca # v3.9.0 | |
- name: Get short commit hash | |
run: echo "SHORT_SHA=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV | |
- name: Build docker images | |
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0 | |
with: | |
file: ${{ matrix.image.file }} | |
push: ${{ matrix.image.push }} | |
tags: slurm_packages:${{ matrix.slurm.version }}-${{ env.SHORT_SHA }} | |
platforms: ${{ matrix.image.platforms }} | |
load: ${{ matrix.image.load }} | |
build-args: | | |
${{ matrix.image.build_args }} | |
SLURM_VERSION=${{ matrix.slurm.version }} | |
cache-from: type=local,src=.buildx-cache | |
cache-to: type=local,dest=.buildx-cache,mode=max | |
- name: Create slurm_packages_output directory | |
run: mkdir -p slurm_packages_output | |
- name: Run Docker container and copy files | |
run: | | |
container_id=$(docker create slurm_packages:${{ matrix.slurm.version }}) | |
docker start $container_id | |
docker cp $container_id:/usr/src/debs/ ./slurm_packages_output/ | |
docker rm $container_id | |
- name: Create GitHub Release and Upload DEB packages | |
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: slurm-packages-${{ matrix.slurm.version }} | |
name: Slurm packages ${{ matrix.slurm.version }} | |
draft: false | |
prerelease: false | |
files: | | |
slurm_packages_output/debs/*.deb | |
- name: Cleanup | |
run: rm -rf slurm_packages_output/*.deb |