forked from llr-cta/calin
-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (140 loc) · 5.47 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# 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
env:
geant_version: 11.2.2
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
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 libfuse3-dev
curl -L https://github.com/llr-cta/CTA_ADH_APIS_Build/releases/download/${{matrix.os}}/cta_adh_apis_installed.tgz | sudo tar -zxf - -C /
curl -L https://github.com/llr-cta/Geant4Build/releases/download/${{matrix.os}}-${{env.geant_version}}-OFF/Geant4-${{matrix.os}}-${{env.geant_version}}-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=RelWithDebInfo \
-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: Store calin TGZ file
uses: actions/upload-artifact@v4
with:
name: calin_installed_${{matrix.os}}_${{matrix.arch}}
path: /tmp/calin_installed.tgz
retention-days: 5
deploy:
needs: build
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
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 libssl-dev uuid-dev libgpgme11-dev squashfs-tools \
libseccomp-dev pkg-config libfuse3-dev
- name: Retrieve calin TGZ file
uses: actions/download-artifact@v4
with:
name: calin_installed_${{matrix.os}}_${{matrix.arch}}
path: /tmp
- name: Set up Go 1.21.1
uses: actions/setup-go@v5
with:
go-version: 1.21.1
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