Skip to content

Commit f79c494

Browse files
committed
fix example and try to build osx binary
1 parent 40bb75d commit f79c494

File tree

2 files changed

+82
-18
lines changed

2 files changed

+82
-18
lines changed

.github/workflows/release.yml

Lines changed: 80 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,19 @@ env:
1010

1111
jobs:
1212
build-and-release:
13-
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
include:
16+
- os: ubuntu-latest
17+
target: x86_64-unknown-linux-gnu
18+
binary_name: bedder-static-linux-x86_64
19+
use_staticx: true
20+
- os: macos-latest
21+
target: x86_64-apple-darwin
22+
binary_name: bedder-static-macos-x86_64
23+
use_staticx: false
24+
25+
runs-on: ${{ matrix.os }}
1426
permissions:
1527
contents: write # Required for creating releases
1628

@@ -22,6 +34,7 @@ jobs:
2234
uses: dtolnay/rust-toolchain@stable
2335
with:
2436
toolchain: stable
37+
targets: ${{ matrix.target }}
2538

2639
- name: Cache cargo registry
2740
uses: actions/cache@v4
@@ -35,7 +48,8 @@ jobs:
3548
restore-keys: |
3649
${{ runner.os }}-cargo-
3750
38-
- name: Install system dependencies
51+
- name: Install Linux system dependencies
52+
if: matrix.os == 'ubuntu-latest'
3953
run: |
4054
sudo apt-get update
4155
sudo apt-get install -y \
@@ -46,26 +60,62 @@ jobs:
4660
zlib1g-dev \
4761
pkg-config
4862
49-
- name: Install staticx
63+
- name: Install staticx (Linux only)
64+
if: matrix.use_staticx
5065
run: |
5166
python3 -m pip install --user staticx
5267
echo "$HOME/.local/bin" >> $GITHUB_PATH
5368
5469
- name: Build release binary
55-
run: cargo build --release
70+
run: cargo build --release --target ${{ matrix.target }}
5671

57-
- name: Create static binary with staticx
72+
- name: Create static binary with staticx (Linux)
73+
if: matrix.use_staticx
5874
run: |
59-
staticx ./target/release/bedder ./bedder-static-linux-x86_64
60-
chmod +x ./bedder-static-linux-x86_64
75+
staticx ./target/${{ matrix.target }}/release/bedder ./${{ matrix.binary_name }}
76+
chmod +x ./${{ matrix.binary_name }}
77+
78+
- name: Create mostly static binary (macOS)
79+
if: matrix.os == 'macos-latest'
80+
run: |
81+
# Copy the binary and rename it
82+
cp ./target/${{ matrix.target }}/release/bedder ./${{ matrix.binary_name }}
83+
chmod +x ./${{ matrix.binary_name }}
84+
85+
# Show dependencies for verification
86+
echo "Dependencies for macOS binary:"
87+
otool -L ./${{ matrix.binary_name }} || true
6188
62-
- name: Test static binary
89+
- name: Test binary
6390
run: |
64-
./bedder-static-linux-x86_64 --help || echo "Binary test failed"
65-
ldd ./bedder-static-linux-x86_64 || echo "Static binary verified (no dynamic dependencies)"
66-
ls -lh ./bedder-static-linux-x86_64
91+
./${{ matrix.binary_name }} --help || echo "Binary test failed"
92+
ls -lh ./${{ matrix.binary_name }}
6793
68-
- name: Create Release and Upload Asset
94+
# Platform-specific dependency checks
95+
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
96+
ldd ./${{ matrix.binary_name }} || echo "Static binary verified (no dynamic dependencies)"
97+
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
98+
echo "macOS binary dependencies:"
99+
otool -L ./${{ matrix.binary_name }} || true
100+
fi
101+
102+
- name: Upload binary artifact
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: ${{ matrix.binary_name }}
106+
path: ${{ matrix.binary_name }}
107+
108+
release:
109+
needs: build-and-release
110+
runs-on: ubuntu-latest
111+
permissions:
112+
contents: write
113+
114+
steps:
115+
- name: Download all artifacts
116+
uses: actions/download-artifact@v4
117+
118+
- name: Create Release and Upload Assets
69119
uses: softprops/action-gh-release@v2
70120
with:
71121
name: Release ${{ github.ref_name }}
@@ -74,8 +124,11 @@ jobs:
74124
75125
### Downloads
76126
- **bedder-static-linux-x86_64**: Static binary for Linux x86_64 (no dependencies required)
127+
- **bedder-static-macos-x86_64**: Mostly static binary for macOS x86_64 (minimal system dependencies)
77128
78129
### Installation
130+
131+
#### Linux
79132
```bash
80133
# Download and make executable
81134
wget https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/bedder-static-linux-x86_64
@@ -85,12 +138,23 @@ jobs:
85138
sudo mv bedder-static-linux-x86_64 /usr/local/bin/bedder
86139
```
87140
141+
#### macOS
142+
```bash
143+
# Download and make executable
144+
wget https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/bedder-static-macos-x86_64
145+
chmod +x bedder-static-macos-x86_64
146+
147+
# Optional: Move to PATH
148+
sudo mv bedder-static-macos-x86_64 /usr/local/bin/bedder
149+
```
150+
88151
### Binary Info
89-
- **Size**: ~6MB
90-
- **Dependencies**: None (fully static)
152+
- **Linux binary**: Fully static (~6MB, no dependencies)
153+
- **macOS binary**: Mostly static (~6MB, minimal system dependencies)
91154
- **Python**: Works with any Python 3.8+ system
92-
- **Architecture**: x86_64 Linux
155+
- **Architecture**: x86_64
93156
files: |
94-
bedder-static-linux-x86_64
157+
bedder-static-linux-x86_64/bedder-static-linux-x86_64
158+
bedder-static-macos-x86_64/bedder-static-macos-x86_64
95159
draft: false
96160
prerelease: false

tests/examples/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,6 @@ def bedder_vcf_dp(fragment) -> int:
252252
"""return depth (DP) of passing variant"""
253253
v = fragment.a.vcf() # get the concrete type
254254
if v.filter != "PASS": return 0
255-
dp = v.info("DP")
256-
return dp
255+
dp = v.info("DP") # this is list of length 1 so we return the first element
256+
return dp[0]
257257
```

0 commit comments

Comments
 (0)