diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c90382c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,69 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.9', '3.12'] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Upgrade pip, setuptools, and packaging + run: | + python -m pip install --upgrade pip setuptools packaging + + - name: Install package with tests + run: | + pip install matplotlib + pip install .[tests] + + - name: Run plot example + run: | + python3 sigProfilerPlotting/examples/plot_example.py + + - name: Run unit tests + run: | + pytest -s -rw tests + + - name: Build and push Docker image + if: github.ref == 'refs/heads/master' && github.event_name == 'push' && matrix.python-version == '3.12' + env: + GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }} + GHCR_PASSWORD: ${{ secrets.GHCR_PASSWORD }} + run: | + echo "Starting Docker deployment to GHCR for sigprofilersuite..." + + VERSION_TAG=$(grep "VERSION = " setup.py | cut -d'"' -f2) + + # Get the repository name and convert it to lowercase + REPO_NAME=$(basename ${{ github.repository }} | tr '[:upper:]' '[:lower:]') + IMAGE_NAME="ghcr.io/sigprofilersuite/$REPO_NAME" + + echo "Building version: $VERSION_TAG for image: $IMAGE_NAME" + + echo "$GHCR_PASSWORD" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin + + docker build \ + --build-arg COMMIT_SHA=${{ github.sha }} \ + -t $IMAGE_NAME:$VERSION_TAG \ + -t $IMAGE_NAME:latest . + + docker push $IMAGE_NAME:$VERSION_TAG + docker push $IMAGE_NAME:latest + + echo "Docker deployment to GHCR successful" diff --git a/Dockerfile b/Dockerfile index 5ee1db1..2b03527 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ ARG COMMIT_SHA=master WORKDIR /usr/src/app # Install the package directly from the specific commit on GitHub -RUN pip3 install 'git+https://github.com/AlexandrovLab/SigProfilerPlotting.git@'${COMMIT_SHA} +RUN pip3 install 'git+https://github.com/sigprofilersuite/SigProfilerPlotting.git@'${COMMIT_SHA} # Create a non-root user RUN useradd -m -s /bin/bash spm_user diff --git a/README.md b/README.md index e038ff7..86f491a 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Docs](https://img.shields.io/badge/docs-latest-blue.svg)](https://osf.io/2aj6t/wiki/home/) [![License](https://img.shields.io/badge/License-BSD\%202--Clause-orange.svg)](https://opensource.org/licenses/BSD-2-Clause) [![Build Status](https://app.travis-ci.com/AlexandrovLab/SigProfilerPlotting.svg?branch=master)](https://app.travis-ci.com/AlexandrovLab/SigProfilerPlotting) +[![Docs](https://img.shields.io/badge/docs-latest-blue.svg)](https://osf.io/2aj6t/wiki/home/) [![License](https://img.shields.io/badge/License-BSD\%202--Clause-orange.svg)](https://opensource.org/licenses/BSD-2-Clause) [![CI](https://github.com/sigprofilersuite/SigProfilerPlotting/actions/workflows/ci.yml/badge.svg)](https://github.com/sigprofilersuite/SigProfilerPlotting/actions/workflows/ci.yml) # SigProfilerPlotting SigProfilerPlotting provides a standard tool for displaying all types of mutational signatures as well as all types of mutational patterns in cancer genomes. The tool seamlessly integrates with other SigProfiler tools.