Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
285 changes: 285 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
name: ATHENA CI/CD Pipeline

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
release:
types: [ published ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
# Build and test on multiple platforms
build-and-test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-20.04]
compiler: [gcc, clang]
include:
- os: ubuntu-22.04
compiler: gcc
cc: gcc-11
cxx: g++-11
- os: ubuntu-22.04
compiler: clang
cc: clang-14
cxx: clang++-14
- os: ubuntu-20.04
compiler: gcc
cc: gcc-9
cxx: g++-9

runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.apt-cache
key: ${{ runner.os }}-deps-${{ hashFiles('**/requirements.txt', '**/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-deps-

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
python3 \
python3-pip \
default-jre \
default-jdk \
fastqc \
trimmomatic \
velvet \
spades \
quast \
ncbi-blast+ \
samtools \
bcftools \
valgrind \
cppcheck

- name: Install compiler
if: matrix.compiler == 'clang'
run: |
sudo apt-get install -y ${{ matrix.cc }} ${{ matrix.cxx }}

- name: Setup Python dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install pytest pytest-cov

- name: Configure CMake
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: |
cmake -B ${{github.workspace}}/build \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }}

- name: Build ATHENA
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j$(nproc)

- name: Run basic tests
working-directory: ${{github.workspace}}
run: |
# Run original test suite
python3 test_cmd.py

# Run comprehensive test suite
python3 test_comprehensive.py --athena-path ./build/athena

- name: Run static analysis
run: |
# Run cppcheck
cppcheck --enable=all --std=c++17 --suppressions-list=.cppcheck-suppressions \
src/ include/ --error-exitcode=1 || true

# Run clang-tidy if clang compiler
if [[ "${{ matrix.compiler }}" == "clang" ]]; then
find src include -name "*.cpp" -o -name "*.hpp" | \
xargs clang-tidy -p build/ || true
fi

- name: Memory leak check
if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'gcc'
run: |
# Run valgrind on help command
valgrind --leak-check=full --error-exitcode=1 \
./build/athena --help || true

- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: test-results-${{ matrix.os }}-${{ matrix.compiler }}
path: |
test_report.json
build/

# Docker build and test
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: athena:test
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Test Docker image
run: |
# Test basic functionality in Docker
docker run --rm athena:test athena --help
docker run --rm athena:test athena --version

- name: Run Docker Compose tests
run: |
# Test with docker-compose
docker-compose -f docker-compose.yml up --build athena-test

# Security scanning
security-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
format: 'sarif'
output: 'trivy-results.sarif'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
if: always()
with:
sarif_file: 'trivy-results.sarif'

# Performance benchmarking
performance-test:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake fastqc trimmomatic

- name: Build ATHENA
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)

- name: Generate test data
run: |
# Create larger test datasets for performance testing
mkdir -p perf_data
# This would generate larger synthetic datasets
python3 -c "
import random
bases = 'ACGT'
with open('perf_data/large_input1.fastq', 'w') as f:
for i in range(10000):
seq = ''.join(random.choice(bases) for _ in range(100))
f.write(f'@read{i}\n{seq}\n+\n' + 'I'*100 + '\n')
"
cp perf_data/large_input1.fastq perf_data/large_input2.fastq

- name: Run performance tests
run: |
# Run performance benchmarks
python3 test_comprehensive.py --category performance --athena-path ./build/athena

- name: Store performance results
uses: actions/upload-artifact@v3
with:
name: performance-results
path: test_report.json

# Release builds
release:
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: [build-and-test, docker-build]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake

- name: Build release
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)

- name: Package release
run: |
# Create release package
mkdir -p athena-release
cp build/athena athena-release/
cp README.md athena-release/
cp -r docs athena-release/ || true
tar -czf athena-${{ github.event.release.tag_name }}-linux-x64.tar.gz athena-release/

- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./athena-${{ github.event.release.tag_name }}-linux-x64.tar.gz
asset_name: athena-${{ github.event.release.tag_name }}-linux-x64.tar.gz
asset_content_type: application/gzip

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
athena/athena:latest
athena/athena:${{ github.event.release.tag_name }}
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ temp/
# Development logs and TODO lists
DEVELOPMENT_LOG.md
PROJECT_TODO.md

FASTQC_REFACTORING_REPORT.md
# IDE files
.vscode/
.idea/
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"variant": "cpp"
"variant": "cpp",
"filesystem": "cpp"
}
}
Loading