Skip to content

Merge pull request #33 from daichengxin/dev #30

Merge pull request #33 from daichengxin/dev

Merge pull request #33 from daichengxin/dev #30

# name: QuantMS-Rescoring Containers Build and Sync
# on:
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
# paths:
# - 'Dockerfile'
# - '.github/workflows/**'
# release:
# types: [published]
# workflow_dispatch:
# inputs:
# push_images:
# description: 'Push images to registry'
# required: false
# default: true
# type: 'boolean'
# push_release:
# description: 'Push as release version'
# required: false
# default: false
# type: boolean
# jobs:
# build-quantms-rescoring:
# name: Build and Push QuantMS-Rescoring Docker Images
# runs-on: ubuntu-latest
# permissions:
# contents: read
# packages: write
# env:
# RETRY_TIMES: 3
# RETRY_DELAY: 30
# SINGULARITY_TMPDIR: ${{ github.workspace }}/.singularity-tmp
# SINGULARITY_CACHEDIR: ${{ github.workspace }}/.singularity
# SINGULARITY_LIBRARYDIR: ${{ github.workspace }}/.singularity
# steps:
# - name: Free up disk space before build
# run: |
# sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
# docker system prune -af || true
# sudo apt-get clean
# sudo rm -rf /var/lib/apt/lists/*
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Log in to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GHCR_TOKEN }}
# - name: Extract version from pyproject.toml
# id: version
# run: |
# VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2)
# echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
# echo "Extracted version: $VERSION"
# # Extract major and minor version
# MAJOR=$(echo $VERSION | cut -d'.' -f1)
# MINOR=$(echo $VERSION | cut -d'.' -f2)
# echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT
# echo "MINOR=$MINOR" >> $GITHUB_OUTPUT
# echo "Major.Minor: $MAJOR.$MINOR"
# - name: Build and Push QuantMS-Rescoring image
# uses: docker/build-push-action@v5
# with:
# context: .
# push: ${{ (github.event.inputs.push_images == true || github.event.inputs.push_images == '') }}
# tags: |
# ghcr.io/bigbio/quantms-rescoring:latest
# ghcr.io/bigbio/quantms-rescoring:${{ steps.version.outputs.VERSION }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
# provenance: false
# # Note: Only building for linux/amd64 as pyopenms doesn't have ARM64 wheels
# platforms: linux/amd64
# - name: Free up disk space after build
# run: |
# docker system prune -af || true
# sudo apt-get clean
# sudo rm -rf /var/lib/apt/lists/*
# - name: Set up Singularity
# if: ${{ (github.event.inputs.push_images == true || github.event.inputs.push_images == '') }}
# uses: eWaterCycle/setup-singularity@v7
# with:
# singularity-version: 3.8.7
# - name: Pull Docker image for Singularity conversion
# if: ${{ (github.event.inputs.push_images == true || github.event.inputs.push_images == '') }}
# run: |
# docker pull ghcr.io/bigbio/quantms-rescoring:latest
# docker save ghcr.io/bigbio/quantms-rescoring:latest -o quantms-rescoring.tar
# - name: Remove Docker image to free up space
# if: ${{ (github.event.inputs.push_images == true || github.event.inputs.push_images == '') }}
# run: |
# docker rmi ghcr.io/bigbio/quantms-rescoring:latest || true
# docker system prune -af || true
# df -h
# - name: Prepare Singularity temp dir
# run: mkdir -p ${{ github.workspace }}/.singularity-tmp
# - name: Convert Docker image to Singularity
# if: ${{ (github.event.inputs.push_images == true || github.event.inputs.push_images == '') }}
# run: |
# singularity build quantms-rescoring.sif docker-archive://quantms-rescoring.tar
# ls -la quantms-rescoring.sif
# - name: Login and Deploy Container
# if: (github.event_name != 'pull_request')
# env:
# IS_RELEASE: ${{ github.event_name == 'release' }}
# run: |
# echo ${{ secrets.GHCR_TOKEN }} | singularity remote login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io
# singularity push quantms-rescoring.sif oras://ghcr.io/bigbio/quantms-rescoring-sif:${{ steps.version.outputs.VERSION }}
# if [[ "${{ env.IS_RELEASE }}" == "true" || "${{ github.event_name }}" == "release" ]]; then
# singularity push quantms-rescoring.sif oras://ghcr.io/bigbio/quantms-rescoring-sif:latest
# fi
# - name: Notify on success
# if: success()
# run: |
# echo "::notice::Successfully built and pushed QuantMS-Rescoring Docker and Singularity images to ghcr.io/bigbio"
# - name: Notify on failure
# if: failure()
# run: |
# echo "::error::Failed to build or push QuantMS-Rescoring images. Check the logs for details."