Skip to content

Downgrade apptainer version #405

Downgrade apptainer version

Downgrade apptainer version #405

# calin/.github/workflows/singularity-build-and-deploy.yml - Stephen Fegan - 2021-08-23
#
# Continuous build and deployment using Github Actions and Apptainer
#
# Build and deploy calin container to the Github container repository
#
# Copyright 2021, Stephen Fegan <sfegan@llr.in2p3.fr>
# 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: Install apptainer
uses: eWaterCycle/setup-apptainer@v2
with:
apptainer-version: 1.1.7
- name: Build calin apptainer container
run: |
sudo -E apptainer build calin-${{ matrix.arch }}.sif singularity_build.def
ls -l calin-${{ matrix.arch }}.sif
apptainer inspect calin-${{ matrix.arch }}.sif
- name: Login and deploy Container
run: |
echo ${{ secrets.GITHUB_TOKEN }} | apptainer remote login -u ${{ github.actor }} --password-stdin oras://ghcr.io
apptainer push -U calin-${{ matrix.arch }}.sif oras://ghcr.io/${{ github.repository }}:${{ matrix.arch }}
- name: Pull container and compare
run: |
apptainer pull calin-pulled.sif oras://ghcr.io/${{ github.repository }}:${{ matrix.arch }}
diff calin-${{ matrix.arch }}.sif calin-pulled.sif