From 245c90f9f32a285d363d8fa807d4926fcbb3fa11 Mon Sep 17 00:00:00 2001 From: Matt James Date: Mon, 29 Dec 2025 22:27:58 +0000 Subject: [PATCH 1/2] Updates to workflows --- .github/workflows/monthly_test.yml | 6 ++- .github/workflows/package_test.yml | 15 ++++-- .github/workflows/release.yml | 14 +++-- .github/workflows/reusable_package.yml | 9 +++- Dockerfile | 71 +++----------------------- 5 files changed, 39 insertions(+), 76 deletions(-) diff --git a/.github/workflows/monthly_test.yml b/.github/workflows/monthly_test.yml index ecdf6cd..7e54a25 100644 --- a/.github/workflows/monthly_test.yml +++ b/.github/workflows/monthly_test.yml @@ -4,13 +4,15 @@ on: schedule: - cron: '0 0 1 * *' # Runs at midnight UTC on the 1st of every month +run-name: "Monthly Package Test" + jobs: package_and_test: uses: ./.github/workflows/reusable_package.yml strategy: fail-fast: false matrix: - python_version: ["3.10","3.11","3.12","3.13"] + python_version: ["3.10","3.11","3.12","3.13","3.14"] with: python_version: "${{ matrix.python_version }}" - run_tests: "true" \ No newline at end of file + run_tests: "true" diff --git a/.github/workflows/package_test.yml b/.github/workflows/package_test.yml index 7627b7a..8f55d77 100644 --- a/.github/workflows/package_test.yml +++ b/.github/workflows/package_test.yml @@ -10,12 +10,13 @@ on: python_version: type: choice description: "Python version to run package test on" - default: "3.13" + default: "3.14" options: - "3.10" - "3.11" - "3.12" - "3.13" + - "3.14" run_tests: type: boolean description: "Run tests" @@ -25,8 +26,11 @@ on: description: "Run all tests" default: false +run-name: "Package and Test Workflow" + jobs: manual_test: + name: Run Manual Package Test if: github.event_name == 'workflow_dispatch' && github.event.inputs.run_all == 'false' uses: ./.github/workflows/reusable_package.yml with: @@ -35,29 +39,32 @@ jobs: manual_test_all: + name: Run Manual Package Test on All Python Versions if: github.event_name == 'workflow_dispatch' && github.event.inputs.run_all == 'true' uses: ./.github/workflows/reusable_package.yml strategy: fail-fast: false matrix: - python_version: ["3.10","3.11","3.12","3.13"] + python_version: ["3.10","3.11","3.12","3.13","3.14"] with: python_version: "${{ matrix.python_version }}" run_tests: "${{ github.event.inputs.run_tests }}" pull_request: + name: Run Package Test on Pull Request if: github.event_name == 'pull_request' uses: ./.github/workflows/reusable_package.yml strategy: matrix: - python_version: ["3.10","3.11","3.12","3.13"] + python_version: ["3.10","3.11","3.12","3.13","3.14"] with: python_version: "${{ matrix.python_version }}" run_tests: "true" release: + name: Run Package Test on Release Tag if: github.ref_type == 'tag' uses: ./.github/workflows/reusable_package.yml with: python_version: ${{ github.event.inputs.python_version }} - run_tests: "true" \ No newline at end of file + run_tests: "true" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7aa0c18..c3cb65a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,8 +4,11 @@ name: Release Package on: workflow_dispatch: +run-name: "Release pyomnidata Package" + jobs: get_version: + name: Get Package Version runs-on: ubuntu-latest outputs: version: ${{ steps.get_version.outputs.version }} @@ -22,6 +25,7 @@ jobs: echo "::set-output name=version::$version" tag: + name: Create Git Tag runs-on: ubuntu-latest needs: get_version steps: @@ -55,17 +59,19 @@ jobs: tests: # Use your reusable workflow for manual_test_all + name: Run Tests on All Python Versions needs: tag uses: ./.github/workflows/reusable_package.yml strategy: matrix: - python_version: ["3.10", "3.11", "3.12", "3.13"] + python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"] with: run_tests: "true" python_version: ${{ matrix.python_version }} build: - needs: [tests, get_version] + name: Build and Release Package + needs: [tag, tests, get_version] runs-on: ubuntu-latest steps: - name: Checkout current branch @@ -80,12 +86,12 @@ jobs: - name: Build Docker Image run: | # Use a default python version for the Docker target – adjust if needed. - pyver="3.13" + pyver="3.14" pyref="py${pyver//./}" docker_image="pyomnidata:${pyref}" echo "Docker image: ${docker_image}" echo "docker_image=${docker_image}" >> $GITHUB_ENV - docker build --target $pyref -t $docker_image . + docker build -e PYTHON_VERSION=3.14 -t $docker_image . - name: Run Docker Container run: | diff --git a/.github/workflows/reusable_package.yml b/.github/workflows/reusable_package.yml index b1091a0..634965c 100644 --- a/.github/workflows/reusable_package.yml +++ b/.github/workflows/reusable_package.yml @@ -11,8 +11,13 @@ on: type: string description: "Run tests" default: "true" + +env: + PYTHON_VERSION: ${{ inputs.python_version }} + jobs: package_and_test: + name: "Package and Test pyomnidata with Python ${{ inputs.python_version }}" runs-on: "ubuntu-latest" steps: - name: Checkout current branch @@ -26,12 +31,12 @@ jobs: - name: Build Docker Image run: | - pyver="${{ inputs.python_version }}" + pyver="$PYTHON_VERSION" pyref="py${pyver//./}" docker_image="pyomnidata:${pyref}" echo "Docker image: ${docker_image}" echo "docker_image=${docker_image}" >> $GITHUB_ENV - docker build --target $pyref -t $docker_image . + docker build -e PYTHON_VERSION=$PYTHON_VERSION -t $docker_image . - name: Run Docker Image run: | diff --git a/Dockerfile b/Dockerfile index f1febf5..2ef63b6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ ####################################### # Base image and common dependencies # ####################################### -FROM ubuntu:24.04 AS base +FROM ubuntu:24.04 +ARG PYTHON_VERSION=3.14 + # Install common packages and add deadsnakes PPA for multiple Python versions RUN apt-get update && \ apt-get install -y --no-install-recommends software-properties-common && \ @@ -20,76 +22,17 @@ RUN adduser omni COPY . /pyomnidata RUN chown omni:omni -R /pyomnidata -####################################### -# Stage for Python 3.10 # -####################################### -FROM base AS py310 RUN apt-get update && \ apt-get install -y --no-install-recommends \ - python3.10 \ - python3.10-venv \ - python3.10-dev && \ + python${PYTHON_VERSION} \ + python${PYTHON_VERSION}-venv \ + python${PYTHON_VERSION}-dev && \ rm -rf /var/lib/apt/lists/* WORKDIR /app RUN chown omni: -R /app USER omni # Create a virtual environment, upgrade pip and install your package (editable mode) -RUN cd /app && python3.10 -m venv venv && \ +RUN cd /app && python${PYTHON_VERSION} -m venv venv && \ ./venv/bin/pip install --upgrade pip && \ ./venv/bin/pip install setuptools wheel CMD ["tail", "-f", "/dev/null"] -####################################### -# Stage for Python 3.11 # -####################################### -FROM base AS py311 -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - python3.11 \ - python3.11-venv \ - python3.11-dev && \ - rm -rf /var/lib/apt/lists/* -WORKDIR /app -RUN chown omni: -R /app -USER omni -# Create a virtual environment, upgrade pip and install your package (editable mode) -RUN cd /app && python3.11 -m venv venv && \ - ./venv/bin/pip install --upgrade pip && \ - ./venv/bin/pip install setuptools wheel -CMD ["tail", "-f", "/dev/null"] -####################################### -# Stage for Python 3.12 # -####################################### -FROM base AS py312 -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - python3.12 \ - python3.12-venv \ - python3.12-dev && \ - rm -rf /var/lib/apt/lists/* -WORKDIR /app -RUN chown omni: -R /app -USER omni -# Create a virtual environment, upgrade pip and install your package (editable mode) -RUN cd /app && python3.12 -m venv venv && \ - ./venv/bin/pip install --upgrade pip && \ - ./venv/bin/pip install setuptools wheel -CMD ["tail", "-f", "/dev/null"] -####################################### -# Stage for Python 3.13 # -####################################### -FROM base AS py313 -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - python3.13 \ - python3.13-venv \ - python3.13-dev && \ - rm -rf /var/lib/apt/lists/* -WORKDIR /app -RUN chown omni: -R /app -USER omni -# Create a virtual environment, upgrade pip and install your package (editable mode) -RUN cd /app && python3.13 -m venv venv && \ - ./venv/bin/pip install --upgrade pip && \ - ./venv/bin/pip install setuptools wheel -CMD ["tail", "-f", "/dev/null"] - From dcf595e52419376c7d95cfe0a9411a8dcf3a8ba2 Mon Sep 17 00:00:00 2001 From: Matt James Date: Mon, 29 Dec 2025 22:33:15 +0000 Subject: [PATCH 2/2] build args --- .github/workflows/release.yml | 2 +- .github/workflows/reusable_package.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c3cb65a..907fd3b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -91,7 +91,7 @@ jobs: docker_image="pyomnidata:${pyref}" echo "Docker image: ${docker_image}" echo "docker_image=${docker_image}" >> $GITHUB_ENV - docker build -e PYTHON_VERSION=3.14 -t $docker_image . + docker build --build-arg PYTHON_VERSION=3.14 -t $docker_image . - name: Run Docker Container run: | diff --git a/.github/workflows/reusable_package.yml b/.github/workflows/reusable_package.yml index 634965c..de15864 100644 --- a/.github/workflows/reusable_package.yml +++ b/.github/workflows/reusable_package.yml @@ -36,7 +36,7 @@ jobs: docker_image="pyomnidata:${pyref}" echo "Docker image: ${docker_image}" echo "docker_image=${docker_image}" >> $GITHUB_ENV - docker build -e PYTHON_VERSION=$PYTHON_VERSION -t $docker_image . + docker build --build-arg PYTHON_VERSION=$PYTHON_VERSION -t $docker_image . - name: Run Docker Image run: |