Add citation file #522
Workflow file for this run
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
# workflow that builds docker container images | |
# from the singularity apptainer definition files | |
# we use for local development, and runs any tests. | |
# Uses tar archives to convert between the formats | |
# in order to handle the large memory footprints of | |
# our containers without toppling over the | |
# GitHub runner nodes this executes on. | |
name: project build and tests | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
push: | |
branches: | |
- main | |
# TODO: currently combining path for nvidia variables | |
# necessary to launch triton in export container | |
# with path required by train / data projects. | |
# Should add conditionals in this workflow to set these dynamically | |
env: | |
REGISTRY: ghcr.io | |
PATH: /opt/env/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/cuda-11.8/bin:/opt/tritonserver/bin:/usr/local/mpi/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/ucx/bin | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
outputs: | |
projects: ${{ steps.filter.outputs.changes }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Filter project changes | |
id: filter | |
uses: dorny/paths-filter@v2 | |
with: | |
filters: .github/project-filters.yaml | |
if: github.event.pull_request.draft == false | |
build-test: | |
runs-on: ubuntu-latest | |
needs: changes | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
project: ${{ fromJSON(needs.changes.outputs.projects) }} | |
exclude: | |
- project: 'workflow' # Fixed the exclusion key | |
steps: | |
- | |
name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: false | |
- | |
name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- | |
name: log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# build the singularity image as a sandbox directory | |
# inside a docker container that has singularity | |
# installed (take a big breath). Then tar that directory | |
# so that we can import it into docker. Doing everything | |
# in one fell swoop because of permissions discrepancies | |
# inside and outside the container. | |
- | |
name: build singularity image | |
run: | | |
docker run \ | |
--rm \ | |
-v ${{ github.workspace }}:/opt/aframe \ | |
--workdir /opt/aframe/projects/${{ matrix.project }} \ | |
--privileged \ | |
--entrypoint /bin/bash \ | |
quay.io/singularity/singularity:v3.8.1 \ | |
-c 'singularity build --sandbox /opt/aframe/sandbox apptainer.def' | |
# run tests inside the sandbox; | |
# if this is a push event, tar the sandbox | |
# so that we can import it into docker | |
# container and push it to the registry; | |
# otherwise (e.g. for a PR) just run the tests | |
- name: run tests and tar sandbox | |
run: | | |
docker run \ | |
--rm \ | |
-v ${{ github.workspace }}:/opt/aframe \ | |
--workdir /opt/aframe/projects/${{ matrix.project }} \ | |
--privileged \ | |
--entrypoint /bin/bash \ | |
quay.io/singularity/singularity:v3.8.1 \ | |
-c 'singularity exec --env PATH=${{ env.PATH }} /opt/aframe/sandbox pytest && if [ "${{ github.event_name == 'push'}}" == "true" ]; then tar -czf /opt/aframe/app.tar.gz -C /opt/aframe/sandbox .; fi' | |
# now copy the fs contents into an empty | |
# container and push it to the registry, | |
# using a lowercase version of the tag since | |
# the github environment variables are case-sensitive | |
- | |
name: build and push docker image | |
# only run on pushes so that we aren't | |
# building containers for PRs | |
if: ${{ github.event_name == 'push' }} | |
env: | |
tag: ${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.project }}:${{ github.ref_name }} | |
run: | | |
export TAG_LC=${tag,,} | |
cat app.tar.gz | docker import --change "ENV PATH=${{ env.PATH }}" - $TAG_LC | |
docker push $TAG_LC | |