-
Notifications
You must be signed in to change notification settings - Fork 274
126 lines (107 loc) · 4.38 KB
/
linux-build.yml
File metadata and controls
126 lines (107 loc) · 4.38 KB
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
name: Linux CI
on: [push, pull_request]
jobs:
build-linux:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Fully declare each matrix entry here, as otherwise it's possible
# to get unexpected results due to the way the entries get expanded
# (See https://magmanu.github.io/blog/tech/matrices-github-actions/)
include:
# x86-64, clang, configure
- os: ubuntu-latest
use-configure: use-configure
htssrc: hidden-htslib
compiler: clang
sanitize: no-sanitize
# x86-64, gcc, configure, sanitize
- os: ubuntu-latest
use-configure: use-configure
htssrc: hidden-htslib
compiler: gcc
sanitize: sanitize
# x86-64, gcc, no configure, run extra checks
- os: ubuntu-latest
use-configure: no-configure
htssrc: htslib
compiler: gcc
sanitize: no-sanitize
# arm, gcc, configure
- os: ubuntu-24.04-arm
use-configure: use-configure
htssrc: hidden-htslib
compiler: gcc
sanitize: no-sanitize
defaults:
run:
working-directory: ./bcftools
steps:
- name: Checkout
# This is actions/checkout@v6.0.2
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
persist-credentials: false
path: bcftools
- name: Run apt
working-directory: .
run: |
sudo apt-get update
sudo apt-get install -y --no-install-suggests --no-install-recommends autoconf automake make ${{ matrix.compiler }} perl zlib1g-dev libbz2-dev liblzma-dev libcurl4-gnutls-dev libssl-dev libdeflate-dev libperl-dev libgsl0-dev libio-pty-perl
- name: Clone htslib
working-directory: .
run: |
mkdir -p ${{ matrix.htssrc }}
htslib_pr=`git log -2 --format='%s' | sed -n 's/.*htslib#\([0-9]*\).*/\1/p'`
./bcftools/.ci_helpers/clone ${GITHUB_REPOSITORY_OWNER} htslib ${{ matrix.htssrc }} ${GITHUB_HEAD_REF:-$GITHUB_REF_NAME} $htslib_pr
- name: Set build options
run: |
cc='clang'
configure_opts='--enable-werror --enable-perl-filters --enable-libgsl'
cflags='-g -O3'
ldflags=''
if [ '${{ matrix.sanitize }}' = 'sanitize' ] ; then
cflags="-g -Og -fsanitize=address,undefined -Wno-format-truncation -Wno-format-overflow -DHTS_ALLOW_UNALIGNED=0"
ldflags='-fsanitize=address,undefined'
fi
echo "cc=${cc}" >> "$GITHUB_ENV"
echo "configure_opts=${configure_opts}" >> "$GITHUB_ENV"
echo "cflags=${cflags}" >> "$GITHUB_ENV"
echo "ldflags=${ldflags}" >> "$GITHUB_ENV"
- name: Build htslib
working-directory: ${{ matrix.htssrc }}
run: |
htsdir="`realpath ..`/installed-htslib"
echo "htsdir=${htsdir}" >> "$GITHUB_ENV"
autoreconf -i
{ ./configure --prefix="$htsdir" ${configure_opts} ${cc:+CC="$cc"} ${cflags:+CFLAGS="$cflags"} ${ldflags:+LDFLAGS="$ldflags"} ||
{ cat config.log ; false ; } ; } &&
make -j 5 &&
make install
- name: Configure bcftools
if: ${{ matrix.use-configure == 'use-configure' }}
run: |
autoreconf -i
with_htslib="--with-htslib=$htsdir"
ldflags="${ldflags:+$ldflags }-Wl,-rpath=${htsdir}/lib"
printf "\nRunning ./configure ${with_htslib} ${configure_opts}${cc:+ CC='$cc'}${cflags:+ CFLAGS='$cflags'}${ldflags:+ LDFLAGS='$ldflags'} ...\n\n"
{ ./configure $with_htslib ${configure_opts} ${cc:+CC="$cc"} ${cflags:+CFLAGS="$cflags"} ${ldflags:+LDFLAGS="$ldflags"} &&
{ grep -qE 'CFLAGS *=.*-Werror' config.mk ||
{ printf "\nStopping as -Werror was not set.\n" 1>&2 ; false ; } ;
} ;
} || { printf "\n### config.log content follows...\n\n" 1>&2 ; cat config.log ; false ; }
- name: Compile bcftools
run: |
if [ '${{ matrix.use-configure }}' = 'use-configure' ] ; then
make -j5
else
make -j5 ${cc:+CC="$cc"} ${cflags:+CFLAGS="$cflags -Werror"}
fi
- name: Check
run: |
if [ '${{ matrix.use-configure }}' = 'use-configure' ] ; then
make check BGZIP=$htsdir/bin/bgzip TABIX=$htsdir/bin/tabix
else
make check ${cc:+CC="$cc"} ${cflags:+CFLAGS="$cflags -Werror"}
fi