forked from llr-cta/calin
-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (116 loc) · 4.77 KB
/
singularity-build-and-deploy.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# calin/.github/workflows/singularity-build-and-deploy.yml - Stephen Fegan - 2021-08-23
#
# Continuous deployment using Github Actions and singularity
#
# Build and deploy calin container to the Github container repository
#
# Copyright 2021, Stephen Fegan <[email protected]>
# Laboratoire Leprince-Ringuet, CNRS/IN2P3, Ecole Polytechnique, Institut Polytechnique de Paris
#
# This file is part of "calin"
#
# "calin" is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License version 2 or later, as published by
# the Free Software Foundation.
#
# "calin" is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
name: Singularity build and deploy
on:
push:
branches:
- main
paths-ignore:
- .github/workflows/native-build-and-test.yml
- azure-pipelines.yml
- Dockerfile
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
geant: [11.2.2]
arch: [ 'generic', 'ivybridge', 'broadwell', 'cascadelake' ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install prerequisites
shell: bash
run: |
sudo apt-get update -y
sudo apt-get install -y gsl-bin libgsl0-dev libfftw3-dev \
libzmq3-dev python3 python3-dev python3-numpy libxerces-c-dev \
libpcap-dev libz-dev libprotobuf-c-dev protobuf-c-compiler \
libprotobuf-dev protobuf-compiler libprotoc-dev libzstd-dev \
build-essential libssl-dev uuid-dev libgpgme11-dev squashfs-tools \
libseccomp-dev pkg-config
curl -L https://github.com/llr-cta/CamerasToACTLRelease/releases/download/${{matrix.os}}/CamerasToACTL-${{matrix.os}}.tgz | sudo tar -zxf - -C /
curl -L https://github.com/llr-cta/Geant4Build/releases/download/${{matrix.os}}-${{matrix.geant}}-OFF/Geant4-${{matrix.os}}-${{matrix.geant}}-OFF.tbz2 | sudo tar -jxf - -C /
- name: Configure calin
shell: bash
run: |
mkdir mybuild
cd mybuild
cmake -DCALIN_BUILD_ARCH=${{ matrix.arch }} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCALIN_PYTHON_SUB_DIR=lib/python3.10 \
-DNO_GEANT4_TEST:BOOLEAN=TRUE \
..
- name: Build calin
shell: bash
run: |
cd mybuild
make -j3
- name: Install calin
shell: bash
run: |
sudo find /usr -print > /tmp/files_before.txt
cd mybuild
sudo make install
- name: Package calin in TGZ file
shell: bash
run: |
sudo find /usr -print > /tmp/files_after.txt
cat /tmp/files_before.txt /tmp/files_after.txt | sort | uniq -u > /tmp/files_added.txt
tar -zcvf /tmp/calin_installed.tgz -C / -T /tmp/files_added.txt
ls -l /tmp/calin_installed.tgz
- name: Set up Go 1.13
uses: actions/setup-go@v5
with:
go-version: 1.13
cache: false
id: go
- name: Install Singularity
env:
SINGULARITY_VERSION: 3.8.3
GOPATH: /tmp/go
run: |
mkdir -p $GOPATH
sudo mkdir -p /usr/local/var/singularity/mnt && \
mkdir -p $GOPATH/src/github.com/sylabs && \
cd $GOPATH/src/github.com/sylabs && \
wget -qO- https://github.com/sylabs/singularity/releases/download/v${SINGULARITY_VERSION}/singularity-ce-${SINGULARITY_VERSION}.tar.gz | tar -zxf - && \
cd singularity-ce-${SINGULARITY_VERSION} && \
./mconfig -p /usr/local && \
make -C builddir && \
sudo make -C builddir install
- name: Build calin singularity container
run: |
sudo -E singularity build calin-${{ matrix.arch }}.sif singularity_build.def
ls -l calin-${{ matrix.arch }}.sif
singularity inspect calin-${{ matrix.arch }}.sif
- name: Login and deploy Container
run: |
echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ github.actor }} --password-stdin oras://ghcr.io
singularity push -U calin-${{ matrix.arch }}.sif oras://ghcr.io/${{ github.repository }}:${{ matrix.arch }}
- name: Pull container and compare
run: |
singularity pull calin-pulled.sif oras://ghcr.io/${{ github.repository }}:${{ matrix.arch }}
diff calin-${{ matrix.arch }}.sif calin-pulled.sif
# - uses: actions/upload-artifact@v2
# with:
# name: calin-${{ matrix.arch }}
# path: calin-${{ matrix.arch }}.sif