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
48 changes: 48 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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 }}"

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 --rm ${{ steps.build.outputs.imageid }} poetry run pytest
- name: Run coverage
run: docker run --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-common.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}
21 changes: 1 addition & 20 deletions dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
ARG SOURCE_IMAGE=source

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
Expand All @@ -16,20 +14,3 @@

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


# This is a workaround that allows the COPY --from location to be defined as a build argument.
# With this, we can reference the built source image from Harbor in our pipelines, while still
# defaulting to using the previous stage for local builds.
FROM $SOURCE_IMAGE as source_image



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_image /src/dist /dist
RUN pip install /dist/*.whl