Skip to content

Commit

Permalink
ops: enable building on x-calib-nopeak-find
Browse files Browse the repository at this point in the history
  • Loading branch information
kerberizer committed Jul 13, 2024
1 parent 5b618df commit 7365c1a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 24 deletions.
38 changes: 29 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ on: # yamllint disable-line rule:truthy
branches:
- main
- develop
- x-calib-nopeak-find
pull_request:
branches:
- main
- develop
tags:
- v*.*.*
workflow_dispatch:

env:
Expand All @@ -34,7 +37,7 @@ jobs:
steps:

- name: Checkout the repository
uses: actions/[email protected].6
uses: actions/[email protected].7

- name: Setup Python
uses: actions/[email protected]
Expand Down Expand Up @@ -74,17 +77,25 @@ jobs:
run: >-
if [[ $GITHUB_REF == refs/heads/main ]]; then
SKIP=no-commit-to-branch poetry run pre-commit run --all-files
elif [[ $GITHUB_REF == refs/heads/x-calib-nopeak-find ]]; then
echo 'Skipping pre-commit.'
else
poetry run pre-commit run --all-files
fi
- name: Run tests
env:
COVERAGE_FILE: .coverage.${{ matrix.python-version }}
run: poetry run pytest --cov
run: >-
if [[ $GITHUB_REF == refs/heads/x-calib-nopeak-find ]]; then
echo 'Skipping tests.'
else
poetry run pytest --cov
fi
- name: Store the coverage report
uses: actions/[email protected]
if: github.ref != 'refs/heads/x-calib-nopeak-find'
with:
name: coverage-${{ matrix.python-version }}
path: .coverage.${{ matrix.python-version }}
Expand All @@ -93,6 +104,7 @@ jobs:

runs-on: ubuntu-latest
needs: test
if: github.ref != 'refs/heads/x-calib-nopeak-find'
permissions:
pull-requests: write
contents: write
Expand All @@ -111,7 +123,7 @@ jobs:

- name: Process the coverage reports
id: coverage_processing
uses: py-cov-action/python-coverage-comment-action@v3.23
uses: py-cov-action/python-coverage-comment-action@v3.25
with:
COVERAGE_DATA_BRANCH: 'COVERAGE-REPORT'
GITHUB_TOKEN: ${{ github.token }}
Expand All @@ -136,8 +148,9 @@ jobs:
id-token: write

steps:

- name: Checkout repository
uses: actions/[email protected].6
uses: actions/[email protected].7

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
Expand Down Expand Up @@ -168,8 +181,15 @@ jobs:
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: |
org.opencontainers.image.description=Spectra Search Interface
org.opencontainers.image.licenses=MIT
org.opencontainers.image.source=https://github.com/h2020charisma/spectrasearch
org.opencontainers.image.title=spectra-search
org.opencontainers.image.url=https://github.com/h2020charisma/spectrasearch/blob/main/README.md
org.opencontainers.image.vendor=IDEAconsult
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/develop' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/x-calib-nopeak-find' }}
type=raw,value=stable,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch
type=ref,event=tag
Expand All @@ -179,14 +199,14 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5.3.0
uses: docker/build-push-action@v6.2.0
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
Expand Down
19 changes: 4 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12-slim as requirements-stage
FROM python:3.12-slim AS requirements-stage

WORKDIR /tmp

Expand All @@ -10,17 +10,6 @@ RUN poetry export -f requirements.txt --output requirements.txt --without=dev --

FROM python:3.12-slim

LABEL maintainer="Luchesar ILIEV <[email protected]>" \
org.opencontainers.image.created=$BUILD_DATE \
org.opencontainers.image.description="A web-based spectra harmonization tool" \
org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.schema-version="1.0" \
org.opencontainers.image.source="https://github.com/h2020charisma/spectrastream" \
org.opencontainers.image.title="spectrastream" \
org.opencontainers.image.url="https://github.com/h2020charisma/spectrastream/blob/main/README.md" \
org.opencontainers.image.vendor="IDEAconsult" \
org.opencontainers.image.version="latest"

RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -31,12 +20,12 @@ RUN sed -i 's/^-e //' /tmp/requirements.txt \
&& pip install --no-cache-dir --upgrade -r /tmp/requirements.txt \
&& rm /tmp/requirements.txt

COPY ./src/spectrastream /app
COPY ./src /app

WORKDIR /app

EXPOSE 8501

HEALTHCHECK CMD curl --fail http://127.0.0.1:8501/_stcore/health
HEALTHCHECK CMD curl --fail http://127.0.0.1:8501/stream/_stcore/health

ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
ENTRYPOINT ["streamlit", "run", "streamlit_app.py", "--server.address=0.0.0.0", "--server.port=8501", "--server.baseUrlPath=/stream"]

0 comments on commit 7365c1a

Please sign in to comment.