Skip to content

Commit db45bfe

Browse files
.github/workflows/dnmtools_release_macos.yml: adding a workflow to build macos binaries for releases
1 parent e6782e1 commit db45bfe

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: dnmtools Release (macOS)
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build-macos-binaries:
8+
strategy:
9+
matrix:
10+
os: [macos-13, macos-14]
11+
runs-on: ${{ matrix.os }}
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
submodules: recursive
16+
- name: Make dnmtools dependency directories
17+
run: sudo mkdir -p /opt/dnmtools/lib /opt/dnmtools/include
18+
- name: Install dependency headers and static libs
19+
run: |
20+
brew install zlib gsl automake
21+
sudo cp $(brew --prefix zlib)/lib/*.a /opt/dnmtools/lib
22+
sudo cp $(brew --prefix gsl)/lib/*.a /opt/dnmtools/lib
23+
sudo cp -r $(brew --prefix zlib)/include/* /opt/dnmtools/include
24+
sudo cp -r $(brew --prefix gsl)/include/* /opt/dnmtools/include
25+
- name: Build and install HTSlib
26+
run: |
27+
git clone --recursive https://github.com/samtools/htslib.git
28+
cd htslib
29+
sudo cp -r htslib /opt/dnmtools/include
30+
autoreconf -i
31+
mkdir build && cd build
32+
../configure \
33+
--disable-bz2 \
34+
--disable-libcurl \
35+
--disable-lzma \
36+
--disable-ref-cache \
37+
--without-libdeflate \
38+
LDADD="-L/usr/local/lib"
39+
make CFLAGS="-Wall -O2 -fvisibility=hidden" libhts.a
40+
sudo cp libhts.a /opt/dnmtools/lib
41+
- name: Build dnmtools
42+
run: |
43+
./autogen.sh
44+
mkdir build && cd build
45+
../configure CXX=g++-14 LDFLAGS="-L/opt/dnmtools/lib -static-libgcc -static-libstdc++ -Wl,-dead_strip" CPPFLAGS="-I/opt/dnmtools/include"
46+
make -j4
47+
- name: Rename the binary
48+
run: mv build/dnmtools dnmtools_$(uname -m)
49+
- name: Get version number
50+
id: vars
51+
run: |
52+
awk '/AC_INIT/ {print "vn="$2}' configure.ac | \
53+
sed "s/\[//; s/\]//; s/,//" >> "$GITHUB_OUTPUT"
54+
uname -m | awk '{print "arch="$0}' >> "$GITHUB_OUTPUT"
55+
env:
56+
GH_TOKEN: ${{ github.token }}
57+
- name: Upload the binary
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: dnmtools-${{ steps.vars.outputs.arch }}
61+
path: |
62+
dnmtools_${{ steps.vars.outputs.arch }}
63+
make-lipo:
64+
needs: build-macos-binaries
65+
runs-on: macos-15
66+
steps:
67+
- uses: actions/checkout@v4
68+
- name: Download artifacts
69+
uses: actions/download-artifact@v4
70+
with:
71+
path: binaries
72+
pattern: dnmtools-*
73+
merge-multiple: false
74+
- name: Create universal binary
75+
run: |
76+
lipo -create \
77+
binaries/dnmtools-*/dnmtools_* \
78+
-output dnmtools
79+
chmod +x dnmtools
80+
- name: Get version number
81+
id: vn
82+
run: awk '/AC_INIT/ {print "vn="$2}' configure.ac | sed "s/\[//; s/\]//; s/,//" >> "$GITHUB_OUTPUT"
83+
env:
84+
GH_TOKEN: ${{ github.token }}
85+
- name: Upload the lipo binary
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: dnmtools-${{ steps.vn.outputs.vn }}-macOS
89+
path: dnmtools

0 commit comments

Comments
 (0)