Add license badge to README #23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
| name: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| test: | |
| name: Test Suite | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.8"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install system dependencies (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libhdf5-dev pkg-config | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt', '**/setup.py', '**/pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install flake8 pytest | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| pip install -e . | |
| - name: Lint with flake8 | |
| run: | | |
| # stop the build if there are Python syntax errors or undefined names | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| continue-on-error: true | |
| - name: Test with pytest | |
| run: | | |
| pytest | |
| - name: Test CLI installation and basic functionality | |
| run: | | |
| # Test that the CLI is properly installed | |
| crisprhawk --help | |
| crisprhawk --version | |
| # Test individual commands help | |
| crisprhawk search -h | |
| crisprhawk convert-gnomad-vcf -h | |
| crisprhawk prepare-data-crisprme -h | |
| build-test: | |
| name: Build & Installation Test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.8'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Test pip installation | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build wheel | |
| # Build the package | |
| python -m build | |
| # Test installation from wheel | |
| pip install dist/*.whl | |
| # Verify CLI works | |
| crisprhawk --help | |
| - name: Test conda/mamba compatibility (Ubuntu only) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| # Install conda | |
| wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh | |
| bash miniconda.sh -b -p $HOME/miniconda | |
| source $HOME/miniconda/bin/activate | |
| conda config --set always_yes yes --set changeps1 no | |
| # Create test environment | |
| conda create -n test-env python=${{ matrix.python-version }} | |
| conda activate test-env | |
| # Install from local package | |
| pip install . | |
| # Test CLI | |
| crisprhawk --version | |
| # Job that summarizes the test results | |
| test-summary: | |
| name: Test Summary | |
| runs-on: ubuntu-latest | |
| needs: [test, build-test] | |
| if: always() | |
| steps: | |
| - name: Check test results | |
| run: | | |
| echo "Test job status: ${{ needs.test.result }}" | |
| echo "Build test job status: ${{ needs.build-test.result }}" | |
| echo "Security scan job status: ${{ needs.security-scan.result }}" | |
| if [[ "${{ needs.test.result }}" == "failure" ]]; then | |
| echo "❌ Tests failed" | |
| exit 1 | |
| elif [[ "${{ needs.build-test.result }}" == "failure" ]]; then | |
| echo "❌ Build tests failed" | |
| exit 1 | |
| else | |
| echo "✅ All tests passed" | |
| fi |