Build Docker images #955
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 Docker images | |
on: | |
workflow_dispatch: | |
schedule: | |
# Every night at 03:00 UTC | |
- cron: "0 3 * * *" | |
push: | |
branches: | |
- master | |
jobs: | |
check-prerequisites: | |
runs-on: slurm-${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: ["intel", "nvidia"] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
lfs: false | |
- name: Check whether system is setup correctly for building and running Celerity CI containers | |
run: bash ./check-prerequisites.sh | |
build-sycl: | |
needs: [check-prerequisites] | |
runs-on: slurm-${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- sycl: "dpcpp" | |
sycl-version: "HEAD" | |
ubuntu-version: "22.04" | |
platform: "intel" | |
- sycl: "dpcpp" | |
sycl-version: "62ecb849" | |
ubuntu-version: "22.04" | |
platform: "intel" | |
- sycl: "dpcpp" | |
sycl-version: "61e51015" | |
ubuntu-version: "20.04" | |
platform: "intel" | |
- sycl: "hipsycl" | |
sycl-version: "HEAD" | |
ubuntu-version: "23.04" | |
platform: "nvidia" | |
- sycl: "hipsycl" | |
sycl-version: "d2bd9fc7" | |
ubuntu-version: "22.04" | |
platform: "nvidia" | |
- sycl: "hipsycl" | |
sycl-version: "d2bd9fc7" | |
ubuntu-version: "20.04" | |
platform: "nvidia" | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build Docker container for ${{ matrix.sycl }} ${{ matrix.sycl-version }} on ${{ matrix.ubuntu-version }} | |
run: bash ./build.sh ${{ matrix.ubuntu-version }} ${{ matrix.sycl }} ${{ matrix.sycl-version }} | |
if: ${{ github.event_name == 'schedule' }} | |
- name: Force-build Docker container for ${{ matrix.sycl }} ${{ matrix.sycl-version }} on ${{ matrix.ubuntu-version }} | |
run: bash ./build.sh -f ${{ matrix.ubuntu-version }} ${{ matrix.sycl }} ${{ matrix.sycl-version }} | |
if: ${{ github.event_name != 'schedule' }} | |
# NOTE: Since `docker login` is stateful, we race with other jobs that run concurrently on the same machine, which may | |
# result in spurious authentication failures. We reduce the likelihood of this by logging in right before pushing. | |
- name: Log into Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push Docker container for ${{ matrix.sycl }} ${{ matrix.sycl-version }} on ${{ matrix.ubuntu-version }} | |
run: | | |
IMAGE="celerity-build/${{ matrix.sycl }}:ubuntu${{ matrix.ubuntu-version }}-${{ matrix.sycl-version }}" | |
docker tag $IMAGE ghcr.io/celerity/$IMAGE | |
docker push ghcr.io/celerity/$IMAGE | |
build-lint: | |
needs: [check-prerequisites] | |
runs-on: [ self-hosted, slurm ] | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build Celerity linting container | |
run: bash ./build-lint.sh | |
# Same concurrency concerns as above. | |
- name: Log into Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push Celerity linting container | |
run: | | |
docker tag celerity-lint:latest ghcr.io/celerity/celerity-lint:latest | |
docker push ghcr.io/celerity/celerity-lint:latest |