adjust tests #2
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: Singularity Build | |
on: | |
push: | |
# This recipe shows how to manually define a matrix of singularity recipes (paths) to build | |
# Edit the branches here if you want to change deploy behavior | |
branches: | |
- master | |
- mbk/singularity | |
tags: | |
- v* | |
# Do the builds on all pull requests (to test them) | |
pull_request: [] | |
workflow_dispatch: | |
jobs: | |
build-containers: | |
runs-on: ubuntu-latest | |
# container: | |
# image: quay.io/singularity/singularity:v3.9.3 | |
# options: --security-opt seccomp=unconfined --security-opt systempaths=unconfined | |
strategy: | |
fail-fast: true | |
name: Check ${{ matrix.recipe }} | |
steps: | |
- name: Check out code for the container build | |
uses: actions/checkout@v4 | |
- uses: eWaterCycle/setup-singularity@v7 | |
with: | |
singularity-version: 3.8.3 | |
- name: Fetch all history for all tags and branches | |
run: git fetch --prune --unshallow | |
- name: Step to get tag name | |
if: startsWith(github.event.ref, 'refs/tags/v') | |
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Step to get tag name | |
if: ${{ startsWith(github.ref, 'refs/heads') && github.ref == 'refs/heads/master' }} | |
#id: vars | |
#run: echo ::set-output name=tag::"latest" | |
run: echo "tag=latest" >> $GITHUB_ENV | |
- name: Step to get tag name | |
if: ${{ startsWith(github.ref, 'refs/heads') && github.ref != 'refs/heads/master' }} | |
#id: vars | |
#run: echo ::set-output name=tag::"test" | |
run: echo "tag=test" >> $GITHUB_ENV | |
- name: Build Container | |
run: | | |
ls ${SINGULARITY_ROOT} | |
sudo -E ${SINGULARITY_ROOT}/bin/singularity build simsopt.sif ci/singularity.def | |
- name: Login and Deploy Container | |
if: (github.event_name != 'pull_request') | |
run: | | |
echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io | |
singularity push simsopt.sif oras://ghcr.io/${GITHUB_REPOSITORY}:${tag} |