forked from hiddenSymmetries/simsopt
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (52 loc) · 2.06 KB
/
singularity.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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}