Skip to content
Merged
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
50 changes: 50 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and Test

on: push

concurrency:
group: "${{ github.ref }}"
cancel-in-progress: true

env:
NDIP_DOCKER_REPOSITORY: "${{ secrets.NDIP_DOCKER_REPOSITORY }}"
READTHEDOCS_WEBHOOK_URL: "${{ secrets.READTHEDOCS_WEBHOOK_URL }}"
READTHEDOCS_WEBHOOK_SECRET: "${{ secrets.READTHEDOCS_WEBHOOK_SECRET }}"
GALAXY_URL: "${{ secrets.GALAXY_URL }}"
GALAXY_KEY: "${{ secrets.GALAXY_KEY }}"

jobs:
build-and-test:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
GIT_STRATEGY: clone
IMAGE_NAME: "${NDIP_DOCKER_REPOSITORY}/${{ github.repository }}"
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 20
lfs: true
- name: Build
uses: docker/build-push-action@v6
id: build
with:
file: dockerfiles/Dockerfile
load: true
- name: Run ruff check
run: docker run --rm ${{ steps.build.outputs.imageid }} poetry run ruff check
- name: Run format check
run: docker run --rm ${{ steps.build.outputs.imageid }} poetry run ruff format --check
- name: Run mypy
run: docker run --rm ${{ steps.build.outputs.imageid }} poetry run mypy .
- name: Unit tests
run: docker run -e NOVA_GALAXY_TEST_GALAXY_KEY=${{ env.GALAXY_KEY }} -e NOVA_GALAXY_TEST_GALAXY_URL=${{ env.GALAXY_URL }} --rm ${{ steps.build.outputs.imageid }} poetry run pytest
- name: Run coverage
run: docker run -e NOVA_GALAXY_TEST_GALAXY_KEY=${{ env.GALAXY_KEY }} -e NOVA_GALAXY_TEST_GALAXY_URL=${{ env.GALAXY_URL }} --rm ${{ steps.build.outputs.imageid }} sh -c "poetry run coverage run && poetry run coverage report"
- name: Docs test
run: docker run --rm ${{ steps.build.outputs.imageid }} bash build_docs.sh
61 changes: 61 additions & 0 deletions .github/workflows/nova-galaxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Publish Package

on: workflow_dispatch

concurrency:
group: "${{ github.ref }}"
cancel-in-progress: true

env:
PYPI_API_TOKEN: "${{ secrets.PYPI_API_TOKEN }}"

jobs:
tag-release:
runs-on: ubuntu-latest
timeout-minutes: 60
permissions: write-all
env:
GIT_STRATEGY: clone
IMAGE_NAME: "${NDIP_DOCKER_REPOSITORY}/${{ github.repository }}"
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 20
lfs: true
- name: Parse version
run: echo "VERSION=$(cat pyproject.toml | grep "version =" | head -n 1 | awk '{ print $3 }' | tr -d '"')" >> $GITHUB_ENV
- name: Create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}

publish-package:
needs: tag-release
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
timeout-minutes: 60
env:
GIT_STRATEGY: clone
IMAGE_NAME: "${NDIP_DOCKER_REPOSITORY}/${{ github.repository }}"
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 20
lfs: true
- name: Build
uses: docker/build-push-action@v6
id: build
with:
file: dockerfiles/Dockerfile
load: true
- name: Publish
run: docker run --rm ${{ steps.build.outputs.imageid }} poetry publish -u __token__ -p ${PYPI_API_TOKEN}
17 changes: 2 additions & 15 deletions dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
FROM --platform=amd64 regproxy.ornl.gov/hub_proxy/python:3.10-slim AS source
FROM --platform=amd64 python:3.10-slim AS source

Check warning on line 1 in dockerfiles/Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-test

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

# make sure image can run as non-root user


ENV POETRY_CACHE_DIR=/poetry/.cache
ENV POETRY_CONFIG_DIR=/poetry/.config
ENV POETRY_HOME=/poetry
Expand All @@ -14,16 +12,5 @@
RUN poetry install
RUN poetry build --format=wheel

RUN chmod og+rwX /poetry
RUN chmod og+rwX -R /poetry
RUN chmod og+rwX -R /src



FROM --platform=amd64 regproxy.ornl.gov/hub_proxy/ubuntu:22.04 AS run

RUN DEBIAN_FRONTEND="noninteractive" apt-get update && apt-get -y install tzdata
RUN apt-get install -y python3.10 curl
RUN curl -ksS https://bootstrap.pypa.io/get-pip.py | python3.10

COPY --from=source /src/dist /dist
RUN pip install /dist/*.whl
24 changes: 11 additions & 13 deletions tests/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
GALAXY_API_KEY = os.environ.get("NOVA_GALAXY_TEST_GALAXY_KEY", "")


WORKFLOW_NAME = "Simple_test_workflow"
TEST_HISTORY_NAME_WF = "nova_galaxy_workflow_test_history"


Expand All @@ -23,13 +22,9 @@ def test_workflow_lifecycle_with_placeholder_id(nova_instance: Connection) -> No
"""
with nova_instance.connect() as connection:
ds = connection.get_data_store(name=TEST_HISTORY_NAME_WF)
workflows = connection.galaxy_instance.workflows.get_workflows(name=WORKFLOW_NAME, published=True)
workflow_id = workflows[0]["id"]
params = WorkflowParameters()

workflow = Workflow(id=workflow_id)
workflow = Workflow(id="placeholder_id")

outputs = workflow.run(data_store=ds, params=params, wait=True)
outputs = workflow.run(data_store=ds, wait=False)
assert outputs is None

status = workflow.get_status()
Expand All @@ -40,9 +35,10 @@ def test_workflow_lifecycle_with_placeholder_id(nova_instance: Connection) -> No
print(f"Invocation ID after run(wait=True): {invocation_id}")
print(f"Full status details: {full_status.details if full_status else 'N/A'}")

assert status in [WorkState.ERROR, WorkState.QUEUED], (
f"Expected ERROR or QUEUED state after run(wait=False), got {status}"
)
assert status in [
WorkState.ERROR,
WorkState.QUEUED,
], f"Expected ERROR or QUEUED state after run(wait=False), got {status}"

if status == WorkState.ERROR:
assert full_status is not None
Expand All @@ -64,9 +60,11 @@ def test_workflow_lifecycle_with_placeholder_id(nova_instance: Connection) -> No
assert len(step_jobs) == 0, "Expected no step jobs for a placeholder/failed workflow"

final_status = workflow.get_status()
assert final_status in [WorkState.ERROR, WorkState.CANCELED, WorkState.QUEUED], (
f"Unexpected final state: {final_status}"
)
assert final_status in [
WorkState.ERROR,
WorkState.CANCELED,
WorkState.QUEUED,
], f"Unexpected final state: {final_status}"


def test_simple_test_workflow_with_dataset(nova_instance: Connection) -> None:
Expand Down