-
Notifications
You must be signed in to change notification settings - Fork 28
228 lines (200 loc) · 7.73 KB
/
build.yaml
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
name: Mykrobe builds
on:
push:
tags:
- 'v*.*.*'
branches:
- master
pull_request:
branches:
- master
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build_containers:
name: Build linux/singularity container
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v1
with:
go-version: 1.16
id: go
- name: Install Dependencies
run: |
sudo apt-get update && sudo apt-get install -y \
build-essential \
libssl-dev \
uuid-dev \
libgpgme11-dev \
squashfs-tools \
libseccomp-dev \
pkg-config \
debootstrap \
debian-keyring \
debian-archive-keyring \
rsync
- name: Install Singularity
env:
SINGULARITY_VERSION: 3.5.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 https://github.com/hpcng/singularity/releases/download/v${SINGULARITY_VERSION}/singularity-${SINGULARITY_VERSION}.tar.gz
tar -xzf singularity-${SINGULARITY_VERSION}.tar.gz
cd singularity
./mconfig -v -p /usr/local
make -j `nproc 2>/dev/null || echo 1` -C ./builddir all
sudo make -C ./builddir install
- name: Check out code for the container build
uses: actions/checkout@v3
- name: Set release version if is a release
if: startsWith(github.event.ref, 'refs/tags/v')
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set release version if not a release
if: false == startsWith(github.event.ref, 'refs/tags/v')
run: echo "RELEASE_VERSION=test" >> $GITHUB_ENV
- name: Build Singularity container
env:
SINGULARITY_RECIPE: Singularity.def
OUTPUT_CONTAINER: mykrobe_${{env.RELEASE_VERSION}}.img
run: |
ls
if [ -f "${SINGULARITY_RECIPE}" ]; then
sudo -E singularity build ${OUTPUT_CONTAINER} ${SINGULARITY_RECIPE}
else
echo "${SINGULARITY_RECIPE} is not found."
echo "Present working directory: $PWD"
ls
fi
- name: Release
if: startsWith(github.event.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: mykrobe*.img
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
mac_build:
name: Build mac os command line
runs-on: macos-11
steps:
- name: Check out code for the build
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install dependencies
run: |
git clone -b v0.0.5 --recursive https://github.com/Mykrobe-tools/mccortex mccortex
cd mccortex
make MAXK=31
cd ..
cp mccortex/bin/mccortex31 src/mykrobe/cortex/
python -m pip install -r requirements.txt wheel pyinstaller
sudo python -m pip install .
- name: Set release version if is a release
if: startsWith(github.event.ref, 'refs/tags/v')
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set release version if not a release
if: false == startsWith(github.event.ref, 'refs/tags/v')
run: echo "RELEASE_VERSION=test" >> $GITHUB_ENV
- name: Test and build command line tarball
env:
OUTPUT_TARBALL: mykrobe.command_line.osx.${{env.RELEASE_VERSION}}.tar.gz
run: |
# mongod default data directory is /data/db, which is not writeable.
mkdir $HOME/mongodb_data
chown -R `id -un` $HOME/mongodb_data
sudo mongod --dbpath=$HOME/mongodb_data --quiet &> /dev/null &
sleep 3s
pytest --cov-report term-missing --cov=mykrobe
mykrobe panels update_metadata --panels_dir src/mykrobe/data
mykrobe panels update_species --panels_dir src/mykrobe/data --debug all
cd dist
pyinstaller --workpath='./pyinstaller_build/binary_cache' --distpath='./pyinstaller_build' mykrobe_atlas_pyinstaller.spec
cd pyinstaller_build
tar cvfz ../../${OUTPUT_TARBALL} mykrobe_atlas/
- name: Release
if: startsWith(github.event.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: mykrobe.command_line.osx.*.tar.gz
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
windows_build:
if: false # disable for now because is broken
name: Build Windows command line
runs-on: windows-2019
steps:
- uses: msys2/setup-msys2@v2
with:
update: true
install: >-
autotools gcc git libcurl-devel bzip2 liblzma zip libbz2-devel xz zlib zlib-devel libtool wget liblzma-devel ncurses-devel base-devel openssl-devel mingw64/mingw-w64-x86_64-python3 mingw64/mingw-w64-x86_64-python3-pip mingw-w64-x86_64-python3-numpy mingw-w64-x86_64-python3-setuptools mingw-w64-x86_64-python3-wheel mingw-w64-x86_64-python-biopython
- name: Check out code for the build
uses: actions/checkout@v3
- name: Set release version if is a release
if: startsWith(github.event.ref, 'refs/tags/v')
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
shell: msys2 {0}
- name: Set release version if not a release
if: false == startsWith(github.event.ref, 'refs/tags/v')
run: echo "RELEASE_VERSION=test" >> $GITHUB_ENV
shell: msys2 {0}
- name: Start MongoDB service
run: |
sc.exe config MongoDB start= auto
sc.exe start MongoDB
- name: Test and build command line tarball
env:
OUTPUT_TARBALL: mykrobe.command_line.windows.${{env.RELEASE_VERSION}}.tar.gz
run: |
export PYTHONPATH="/mingw64/lib/python3.11/:/mingw64/lib/python3.11/site-packages:${PYTHONPATH}"
C:\\msys64\\mingw64\\bin\\python3.exe -m ensurepip --upgrade
C:\\msys64\\mingw64\\bin\\python3.exe -m pip install pyinstaller requests pytest
echo "clone mccortex"
rm -rf mccortex
git clone -b v0.0.5 --recursive https://github.com/Mykrobe-tools/mccortex mccortex
cd mccortex/libs/htslib
git checkout bcf9bff178f81c9c1cf3a052aeb6cbe32fe5fdcc
cd ../bcftools
git checkout b406a3906b153faa8bec0a53df07b2adf18a3052
cd ../samtools
git checkout 2d4907cf9a34ccf7cde60143158b39e1cb40ac0c
cd ../../../
python ./ci/windows_file_fixes.py
cd mccortex
echo "make mccortex"
make all
echo "make tests mccortex"
make tests
cd ..
echo "pip install requirements"
C:\\msys64\\mingw64\\bin\\python3.exe -m pip install -r requirements.txt
echo "pip install ."
C:\\msys64\\mingw64\\bin\\python3.exe -m pip install .
echo "pytest"
export MYKROBE_MCCORTEX="${PWD}/mccortex/bin/mccortex31"
C:\\msys64\\mingw64\\bin\\python3.exe -m pytest
echo "update panels"
C:\\msys64/mingw64/bin/mykrobe.exe panels update_metadata --panels_dir src/mykrobe/data
C:\\msys64/mingw64/bin/mykrobe.exe panels update_species --panels_dir src/mykrobe/data --debug all
cd dist
C:\\msys64/mingw64/bin/pyinstaller.exe --workpath='./pyinstaller_build/binary_cache' --distpath='./pyinstaller_build' mykrobe_atlas_pyinstaller_windows.spec
cd pyinstaller_build
tar cvfz ../../${OUTPUT_TARBALL} mykrobe_atlas/
shell: msys2 {0}
- name: Release
if: startsWith(github.event.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: mykrobe.command_line.windows.*.tar.gz
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}