Skip to content

Cloud Build Apptainer #2

Cloud Build Apptainer

Cloud Build Apptainer #2

name: Cloud Build Apptainer
on: workflow_dispatch
# only allow one copy of this workflow to run at a time (the group specified by workflow name)
# cancel current workflows if they are running, so that we just run the latest queue'd.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }} # github.repository as <account>/<repo> "abcucberkeley/opticalaberrations"
DO_SIGNING: ${{ false }}
BRANCH: ${{ github.head_ref || github.ref_name }} # 'latest-tf' or 'develop'
PYTEST: python -m pytest --cache-clear -vvv --color=yes --disable-warnings
DEF_FILE: "Apptainer_CUDA_12_3" # REPLACE with Def file in a repo.
jobs:
# # Build SIF and store SIF as an CI artifact.
# build-artifact:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Make Tmp Dir
# run: |
# mkdir -p ${{ github.workspace }}/tmp-sif-path
# - name: Build image
# env:
# SYLABS_AUTH_TOKEN: ${{ secrets.SYLABS_AUTH_TOKEN }}
# run: |
# docker run -v ${{ github.workspace }}:/app \
# -u $(id -u ${USER}):$(id -g ${USER}) \
# $DOCKER_BUILD_CLIENT build \
# --skip-verify /app/$DEF_FILE "/app/$OUTPUT_SIF"
# - name: Move Sif
# run: mv ${{ github.workspace }}/$OUTPUT_SIF ${{ github.workspace }}/tmp-sif-path/$OUTPUT_SIF
# - name: Save image
# uses: actions/upload-artifact@v2
# with:
# name: ${{ env.OUTPUT_SIF }}
# path: ${{ github.workspace }}/tmp-sif-path
# Build SIF and Push to cloud.sylabs.io
push-cloud:
env:
OUTPUT_SIF: ${{ github.workspace }}/${{ github.head_ref || github.ref_name }}_${{ matrix.CUDA_VERSION }}.sif # REPLACE with SIF name
LIBRARY_PATH: oras://ghcr.io/${{ github.repository }}:${{ github.head_ref || github.ref_name }}_${{ matrix.CUDA_VERSION }}_sif # REPLACE with library path to store sif.
runs-on: ubuntu-latest
container: sylabsio/scs-build
steps:
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }} # aka ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Build and Push SIF
env:
SYLABS_AUTH_TOKEN: ${{ secrets.SYLABS_AUTH_TOKEN }}
run: |
scs-build build --skip-verify /app/${{env.DEF_FILE}} ${{ env.LIBRARY_PATH }}