Skip to content

Apptainer Builds

Apptainer Builds #266

name: openstudio-docker
on: [push, pull_request]
# example of how to restrict to one branch and push event
#on:
# push:
# branches:
# - test_branch
env:
USE_TESTING_TIMEOUTS: "true"
OPENSTUDIO_VERSION: 3.8.0
OPENSTUDIO_SHA: f953b6fcaf
OPENSTUDIO_VERSION_EXT: ""
jobs:
docker:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8.x'
- name: test and build
shell: bash
run: |
docker build -t openstudio:latest \
--build-arg OPENSTUDIO_VERSION=$OPENSTUDIO_VERSION \
--build-arg OPENSTUDIO_SHA=$OPENSTUDIO_SHA \
--build-arg OPENSTUDIO_VERSION_EXT=$OPENSTUDIO_VERSION_EXT \
--build-arg DOWNLOAD_PREFIX=$DOWNLOAD_PREFIX .
docker run openstudio:latest openstudio openstudio_version
docker run openstudio:latest /usr/local/openstudio-$OPENSTUDIO_VERSION/Radiance/bin/rtrace -version
docker run -v $(pwd):/var/simdata/openstudio openstudio:latest ruby /var/simdata/openstudio/test/test_run.rb
docker run -v $(pwd)/test:/var/simdata/openstudio openstudio:latest ./test_gemfile.sh
- name: deploy docker
if: ${{ success() }} &&
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/develop' ||
github.ref == 'refs/heads/custom_branch_name'
shell: bash
run: ./deploy_docker.sh
env:
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
DOCKER_USER: ${{ secrets.DOCKER_USER }}
apptainer:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8.x'
- name: install apptainer
shell: bash
run: |
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt update
sudo apt install -y apptainer
- name: build apptainer
shell: bash
run: |
apptainer build \
OpenStudio-$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT.$OPENSTUDIO_SHA-Apptainer.sif \
docker://nrel/openstudio:$OPENSTUDIO_VERSION$OPENSTUDIO_VERSION_EXT
- uses: actions/upload-artifact@v3
with:
name: apptainer-image
path: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Upload artifacts to AWS S3
uses: usualdesigner/s3-artifact-upload@main
with:
bucket-name: openstudio-builds
prefix: ${{env.OPENSTUDIO_VERSION}}
file: OpenStudio-${{ env.OPENSTUDIO_VERSION }}${{ env.OPENSTUDIO_VERSION_EXT }}.${{ env.OPENSTUDIO_SHA }}-Apptainer.sif