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
61 changes: 61 additions & 0 deletions .github/workflows/_ptypy-workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
on:
workflow_call:
inputs:
publish:
type: boolean
description: If true, pushes image to container registry

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Docker Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and export to Docker local cache
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: images/ptypy_workflows
file: images/ptypy_workflows/Dockerfile
# Need load and tags so we can test it below
load: true
tags: tag_for_testing

- name: Create tags for publishing image
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=tag
type=raw,value=latest

- name: Push cached image to container registry
if: inputs.publish && github.ref_type == 'tag'
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_RECORD_UPLOAD: false
# This does not build the image again, it will find the image in the
# Docker cache and publish it
with:
context: images/ptypy_workflows
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
13 changes: 9 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ on:
branches:
- main
tags:
- '*'
- "*"
pull_request:

jobs:

lint:
uses: ./.github/workflows/_tox.yml
with:
Expand All @@ -36,16 +35,22 @@ jobs:
contents: read
packages: write

ptypy-workflows:
uses: ./.github/workflows/_ptypy-workflows.yml
permissions:
contents: read
packages: write

dist:
uses: ./.github/workflows/_dist.yml

pypi:
needs: [dist, test]
if: github.ref_type == 'tag'
uses: ./.github/workflows/_pypi.yml
permissions:
id-token: write

release:
needs: [dist, test]
if: github.ref_type == 'tag'
Expand Down
24 changes: 24 additions & 0 deletions images/ptypy_workflows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM quay.io/condaforge/miniforge3 AS build

COPY environment.yaml .
RUN conda env create -f environment.yaml && \
conda install -c conda-forge conda-pack && \
conda clean --all --yes && \
conda-pack -n ptypy_workflow -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar && \
rm -rf /opt/conda/pkgs

RUN /venv/bin/conda-unpack

# Install system dependencies and clean up
RUN apt-get update && \
apt-get install -y curl unzip && \
rm -rf /var/lib/apt/lists/*


FROM ubuntu:resolute AS runtime

COPY --from=build /venv /venv

ENV PATH="/venv/bin:$PATH"
21 changes: 21 additions & 0 deletions images/ptypy_workflows/environment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: ptypy_workflow
channels:
- conda-forge
dependencies:
- python=3.14
- numpy
- scipy
- pyzmq
- mpi4py
- packaging
- pillow
- pyfftw
- pyyaml
- matplotlib
- jupyter
- nbconvert
- papermill
- h5py
- pip
- pip:
- git+https://github.com/ptycho/ptypy@master
Loading