Skip to content

Commit a0533e7

Browse files
committed
added github actions
1 parent 815c61a commit a0533e7

File tree

4 files changed

+566
-0
lines changed

4 files changed

+566
-0
lines changed

.github/workflows/ci.yml

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
pull_request:
7+
branches: [ main, master, develop ]
8+
workflow_dispatch:
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
RUST_BACKTRACE: 1
13+
14+
jobs:
15+
test:
16+
name: Test on ${{ matrix.os }}
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
os: [ubuntu-latest, macos-latest]
21+
rust: [stable, beta]
22+
include:
23+
- os: ubuntu-latest
24+
rust: stable
25+
cache-key: linux-stable
26+
- os: macos-latest
27+
rust: stable
28+
cache-key: macos-stable
29+
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
34+
- name: Install system dependencies (Ubuntu)
35+
if: matrix.os == 'ubuntu-latest'
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y \
39+
libcurl4-openssl-dev \
40+
libssl-dev \
41+
zlib1g-dev \
42+
libbz2-dev \
43+
liblzma-dev \
44+
samtools \
45+
bcftools
46+
47+
- name: Install system dependencies (macOS)
48+
if: matrix.os == 'macos-latest'
49+
run: |
50+
brew install samtools bcftools || true
51+
52+
- name: Install Rust toolchain
53+
uses: dtolnay/rust-toolchain@stable
54+
with:
55+
toolchain: ${{ matrix.rust }}
56+
57+
- name: Cache cargo registry
58+
uses: actions/cache@v4
59+
with:
60+
path: |
61+
~/.cargo/bin/
62+
~/.cargo/registry/index/
63+
~/.cargo/registry/cache/
64+
~/.cargo/git/db/
65+
target/
66+
key: ${{ runner.os }}-cargo-${{ matrix.cache-key }}-${{ hashFiles('**/Cargo.lock') }}
67+
restore-keys: |
68+
${{ runner.os }}-cargo-${{ matrix.cache-key }}-
69+
70+
- name: Build project
71+
run: cargo build --release --verbose
72+
73+
- name: Test help command
74+
run: |
75+
cargo run --release -- --help || true
76+
cargo run --release -- quick-start --help || true
77+
cargo run --release -- filter --help || true
78+
cargo run --release -- build --help || true
79+
cargo run --release -- correct --help || true
80+
cargo run --release -- call --help || true
81+
cargo run --release -- asm --help || true
82+
cargo run --release -- methyl --help || true
83+
84+
integration-test:
85+
name: Integration Test
86+
runs-on: ubuntu-latest
87+
needs: test
88+
89+
steps:
90+
- name: Checkout code
91+
uses: actions/checkout@v4
92+
93+
- name: Install system dependencies
94+
run: |
95+
sudo apt-get update
96+
sudo apt-get install -y \
97+
libcurl4-openssl-dev \
98+
libssl-dev \
99+
zlib1g-dev \
100+
libbz2-dev \
101+
liblzma-dev \
102+
samtools \
103+
bcftools
104+
105+
- name: Install Rust toolchain
106+
uses: dtolnay/rust-toolchain@stable
107+
108+
- name: Build project
109+
run: cargo build --release
110+
111+
- name: Test Himito quick-start command
112+
run: |
113+
if [ -f "test_data/HG005_100x.bam" ] && [ -f "test_data/HG005_100x.bai" ]; then
114+
cargo run --release -- quick-start \
115+
-i test_data/HG005_100x.bam \
116+
-c "chrM" \
117+
-k 21 \
118+
--sampleid HG005 \
119+
-r test_data/rCRS.fasta \
120+
--output-prefix test_output/himito_test || echo "Himito test skipped - may require additional dependencies"
121+
else
122+
echo "Test data not available, skipping evaluate test"
123+
fi
124+
125+
- name: Cleanup test outputs
126+
if: always()
127+
run: |
128+
rm -rf test_output test_data || true
129+
130+
lint:
131+
name: Lint
132+
runs-on: ubuntu-latest
133+
134+
steps:
135+
- name: Checkout code
136+
uses: actions/checkout@v4
137+
138+
- name: Install Rust toolchain
139+
uses: dtolnay/rust-toolchain@stable
140+
141+
- name: Check for common issues
142+
run: |
143+
# Check for unsafe code usage
144+
if grep -r "unsafe" src/ --include="*.rs" | grep -v "// SAFETY" | grep -v "unsafe {"; then
145+
echo "Warning: Found unsafe code without safety comments"
146+
fi
147+

.github/workflows/release.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Release version'
10+
required: true
11+
12+
jobs:
13+
build-release:
14+
name: Build Release Artifacts
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, macos-latest, windows-latest]
19+
include:
20+
- os: ubuntu-latest
21+
artifact_name: haplograph-linux-x86_64
22+
binary_name: haplograph
23+
- os: macos-latest
24+
artifact_name: haplograph-macos-x86_64
25+
binary_name: haplograph
26+
- os: windows-latest
27+
artifact_name: haplograph-windows-x86_64
28+
binary_name: haplograph.exe
29+
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
34+
- name: Install system dependencies (Ubuntu)
35+
if: matrix.os == 'ubuntu-latest'
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y \
39+
libcurl4-openssl-dev \
40+
libssl-dev \
41+
zlib1g-dev \
42+
libbz2-dev \
43+
liblzma-dev
44+
45+
- name: Install system dependencies (macOS)
46+
if: matrix.os == 'macos-latest'
47+
run: |
48+
brew install openssl || true
49+
50+
- name: Install Rust toolchain
51+
uses: dtolnay/rust-toolchain@stable
52+
53+
- name: Build release binary
54+
run: cargo build --release --verbose
55+
56+
- name: Create release archive
57+
shell: bash
58+
run: |
59+
mkdir -p release
60+
cp target/release/${{ matrix.binary_name }} release/
61+
tar czf ${{ matrix.artifact_name }}.tar.gz -C release ${{ matrix.binary_name }}
62+
63+
if [ "${{ matrix.os }}" == "windows-latest" ]; then
64+
zip -r ${{ matrix.artifact_name }}.zip release/
65+
fi
66+
67+
- name: Upload artifacts
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: ${{ matrix.artifact_name }}
71+
path: |
72+
${{ matrix.artifact_name }}.tar.gz
73+
${{ matrix.artifact_name }}.zip
74+

.github/workflows/test-small.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Small Integration Tests
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
quick-test:
12+
name: Quick Integration Test
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 30
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Install system dependencies
21+
run: |
22+
sudo apt-get update
23+
sudo apt-get install -y \
24+
libcurl4-openssl-dev \
25+
libssl-dev \
26+
zlib1g-dev \
27+
libbz2-dev \
28+
liblzma-dev \
29+
samtools \
30+
bcftools
31+
32+
- name: Install Rust toolchain
33+
uses: dtolnay/rust-toolchain@stable
34+
35+
- name: Build project
36+
run: cargo build --release
37+
38+
- name: Test help command
39+
run: |
40+
cargo run --release -- --help || true
41+
cargo run --release -- quick-start --help || true
42+
cargo run --release -- filter --help || true
43+
cargo run --release -- build --help || true
44+
cargo run --release -- correct --help || true
45+
cargo run --release -- call --help || true
46+
cargo run --release -- asm --help || true
47+
cargo run --release -- methyl --help || true
48+
49+
- name: Test Himito quick-start command
50+
run: |
51+
if [ -f "test_data/HG005_100x.bam" ] && [ -f "test_data/HG005_100x.bai" ]; then
52+
cargo run --release -- quick-start \
53+
-i test_data/HG005_100x.bam \
54+
-c "chrM" \
55+
-k 21 \
56+
--sampleid HG005 \
57+
-r test_data/rCRS.fasta \
58+
--output-prefix test_output/himito_test || echo "Himito test skipped - may require additional dependencies"
59+
else
60+
echo "Test data not available, skipping evaluate test"
61+
fi
62+
63+
64+
- name: Cleanup
65+
if: always()
66+
run: rm -rf test_output test_data
67+

0 commit comments

Comments
 (0)