Debian Codegraph @

.github/workflows/build.yaml

raw
1 name: Build ariba images
2
3 on:
4 push:
5 tags:
6 - 'v*.*.*'
7 branches:
8 - master
9 pull_request:
10 branches:
11 - master
12
13 env:
14 REGISTRY: ghcr.io
15 IMAGE_NAME: ${{ github.repository }}
16
17 jobs:
18 build:
19 name: Build
20 runs-on: ubuntu-20.04
21 steps:
22
23 - name: Set up Go 1.16
24 uses: actions/setup-go@v1
25 with:
26 go-version: 1.16
27 id: go
28
29 - name: Install Dependencies
30 run: |
31 sudo apt-get update && sudo apt-get install -y \
32 build-essential \
33 libssl-dev \
34 uuid-dev \
35 libgpgme11-dev \
36 squashfs-tools \
37 libseccomp-dev \
38 pkg-config \
39 debootstrap \
40 debian-keyring \
41 debian-archive-keyring \
42 rsync
43
44 - name: Install Singularity
45 env:
46 SINGULARITY_VERSION: 3.5.3
47 GOPATH: /tmp/go
48 run: |
49 mkdir -p $GOPATH
50 sudo mkdir -p /usr/local/var/singularity/mnt
51 mkdir -p $GOPATH/src/github.com/sylabs
52 cd $GOPATH/src/github.com/sylabs
53 wget https://github.com/hpcng/singularity/releases/download/v${SINGULARITY_VERSION}/singularity-${SINGULARITY_VERSION}.tar.gz
54 tar -xzf singularity-${SINGULARITY_VERSION}.tar.gz
55 cd singularity
56 ./mconfig -v -p /usr/local
57 make -j `nproc 2>/dev/null || echo 1` -C ./builddir all
58 sudo make -C ./builddir install
59
60
61 - name: Check out code for the container build
62 uses: actions/checkout@v2
63
64 - name: Set release version if is a release
65 if: startsWith(github.event.ref, 'refs/tags/v')
66 run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
67
68 - name: Set release version if not a release
69 if: false == startsWith(github.event.ref, 'refs/tags/v')
70 run: echo "RELEASE_VERSION=test" >> $GITHUB_ENV
71
72 - name: Build Singularity container
73 env:
74 SINGULARITY_RECIPE: Singularity.def
75 OUTPUT_CONTAINER: ariba_${{env.RELEASE_VERSION}}.img
76 run: |
77 ls
78 if [ -f "${SINGULARITY_RECIPE}" ]; then
79 sudo -E singularity build ${OUTPUT_CONTAINER} ${SINGULARITY_RECIPE}
80 else
81 echo "${SINGULARITY_RECIPE} is not found."
82 echo "Present working directory: $PWD"
83 ls
84 fi
85
86 - name: Release
87 if: startsWith(github.event.ref, 'refs/tags/v')
88 uses: softprops/action-gh-release@v1
89 with:
90 files: ariba*.img
91 env:
92 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93
94 - name: Log in to github container registry
95 if: startsWith(github.event.ref, 'refs/tags/v')
96 uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
97 with:
98 registry: ${{ env.REGISTRY }}
99 username: ${{ github.actor }}
100 password: ${{ secrets.GITHUB_TOKEN }}
101
102 - name: Extract metadata (tags, labels) for Docker
103 if: startsWith(github.event.ref, 'refs/tags/v')
104 id: meta
105 uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
106 with:
107 images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
108
109 - name: Build and push Docker image
110 if: startsWith(github.event.ref, 'refs/tags/v')
111 uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
112 with:
113 context: .
114 push: true
115 tags: ${{ steps.meta.outputs.tags }}
116 labels: ${{ steps.meta.outputs.labels }}