🙌 OpenHands: AI-Driven Development
Revert "Create a reusable workflow for building, testing and publishing runti…" (#3725)
mamoodi1b66f2e777dd
diff --git a/.github/workflows/ghcr-runtime.yml b/.github/workflows/ghcr-runtime.ymldeleted file mode 100644index 4837680fcb..0000000000--- a/.github/workflows/ghcr-runtime.yml+++ /dev/null@@ -1,46 +0,0 @@-# Workflow that builds, tests and then pushes all the runtime docker images to the ghcr.io repository-name: Build, Test and Publish Runtime Image--# Only run one workflow of the same group at a time.-# There can be at most one running and one pending job in a concurrency group at any time.-concurrency:- group: ${{ github.workflow }}-${{ github.ref }}- cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}--# Always run on "main"-# Always run on tags-# Always run on PRs-# Can also be triggered manually-on:- push:- branches:- - main- tags:- - '*'- pull_request:- workflow_dispatch:- inputs:- reason:- description: 'Reason for manual trigger'- required: true- default: ''--jobs:- nikolaik:- uses: ./.github/workflows/ghcr-runtime-reusable.yml- with:- base_image: 'nikolaik/python-nodejs:python3.11-nodejs22'- image_tag: nikolaik- secrets: inherit- python:- uses: ./.github/workflows/ghcr-runtime-reusable.yml- with:- base_image: 'python:3.11-bookworm'- image_tag: python- secrets: inherit- node:- uses: ./.github/workflows/ghcr-runtime-reusable.yml- with:- base_image: 'node:22-bookworm'- image_tag: node- secrets: inheritdiff --git a/.github/workflows/ghcr-runtime-reusable.yml b/.github/workflows/ghcr_runtime.ymlsimilarity index 71%rename from .github/workflows/ghcr-runtime-reusable.ymlrename to .github/workflows/ghcr_runtime.ymlindex aca946651f..0e146bde39 100644--- a/.github/workflows/ghcr-runtime-reusable.yml+++ b/.github/workflows/ghcr_runtime.yml@@ -1,30 +1,47 @@-# Reusable workflow that builds, tests and then pushes the runtime Docker image to the ghcr.io repository+# Workflow that builds, tests and then pushes the runtime docker images to the ghcr.io repositoryname: Build, Test and Publish Runtime Image-# Indicate that this is a reusable workflow+# Only run one workflow of the same group at a time.+# There can be at most one running and one pending job in a concurrency group at any time.+concurrency:+ group: ${{ github.workflow }}-${{ github.ref }}+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}++# Always run on "main"+# Always run on tags+# Always run on PRs+# Can also be triggered manuallyon:- workflow_call:+ push:+ branches:+ - main+ tags:+ - '*'+ pull_request:+ workflow_dispatch:inputs:- # The base_image name used to build the runtime Docker image- base_image:- required: true- type: string- # The tag to use for the built runtime Docker image- image_tag:- required: true- type: string- secrets:- CODECOV_TOKEN:+ reason:+ description: 'Reason for manual trigger'required: true+ default: ''jobs:# Builds the runtime Docker imagesghcr_build_runtime:- name: Build Image ${{ inputs.image_tag }}+ name: Build Imageruns-on: ubuntu-latestpermissions:contents: readpackages: write+ strategy:+ matrix:+ base_image:+ - image: 'nikolaik/python-nodejs:python3.11-nodejs22'+ tag: nikolaik+ - image: 'python:3.11-bookworm'+ tag: python+ - image: 'node:22-bookworm'+ tag: nodesteps:- name: Checkoutuses: actions/checkout@v4@@ -63,31 +80,34 @@ jobs:- name: Install Python dependencies using Poetryrun: make install-python-dependencies- name: Create source distribution and Dockerfile- run: poetry run python3 openhands/runtime/utils/runtime_build.py --base_image ${{ inputs.base_image }} --build_folder containers/runtime --force_rebuild- - name: Build and push runtime image ${{ inputs.base_image }}+ run: poetry run python3 openhands/runtime/utils/runtime_build.py --base_image ${{ matrix.base_image.image }} --build_folder containers/runtime --force_rebuild+ - name: Build and push runtime image ${{ matrix.base_image.image }}if: "!github.event.pull_request.head.repo.fork"run: |- ./containers/build.sh runtime ${{ github.repository_owner }} --push ${{ inputs.image_tag }}+ ./containers/build.sh runtime ${{ github.repository_owner }} --push ${{ matrix.base_image.tag }}# Forked repos can't push to GHCR, so we need to upload the image as an artifact- - name: Build runtime image ${{ inputs.base_image }} for fork+ - name: Build runtime image ${{ matrix.base_image.image }} for forkif: "github.event.pull_request.head.repo.fork"uses: docker/build-push-action@v6with:- tags: ghcr.io/all-hands-ai/runtime:${{ github.sha }}-${{ inputs.image_tag }}- outputs: type=docker,dest=/tmp/runtime-${{ inputs.image_tag }}.tar+ tags: ghcr.io/all-hands-ai/runtime:${{ github.sha }}-${{ matrix.base_image.tag }}+ outputs: type=docker,dest=/tmp/runtime-${{ matrix.base_image.tag }}.tarcontext: containers/runtime- name: Upload runtime image for forkif: "github.event.pull_request.head.repo.fork"uses: actions/upload-artifact@v4with:- name: runtime-${{ inputs.image_tag }}- path: /tmp/runtime-${{ inputs.image_tag }}.tar+ name: runtime-${{ matrix.base_image.tag }}+ path: /tmp/runtime-${{ matrix.base_image.tag }}.tar- # Run unit tests with the runtime Docker images+ # Run unit tests with the EventStream runtime Docker imagestest_runtime:- name: Runtime Unit Tests with ${{ inputs.image_tag }}+ name: Test Runtimeruns-on: ubuntu-latestneeds: [ghcr_build_runtime]+ strategy:+ matrix:+ base_image: ['nikolaik', 'python', 'node']steps:- uses: actions/checkout@v4- name: Free Disk Space (Ubuntu)@@ -104,12 +124,12 @@ jobs:if: "github.event.pull_request.head.repo.fork"uses: actions/download-artifact@v4with:- name: runtime-${{ inputs.image_tag }}+ name: runtime-${{ matrix.base_image }}path: /tmp- name: Load runtime image for forkif: "github.event.pull_request.head.repo.fork"run: |- docker load --input /tmp/runtime-${{ inputs.image_tag }}.tar+ docker load --input /tmp/runtime-${{ matrix.base_image }}.tar- name: Install poetry via pipxrun: pipx install poetry- name: Set up Python@@ -121,7 +141,7 @@ jobs:run: make install-python-dependencies- name: Run runtime testsrun: |- image_name=ghcr.io/${{ github.repository_owner }}/runtime:${{ github.sha }}-${{ inputs.image_tag }}+ image_name=ghcr.io/${{ github.repository_owner }}/runtime:${{ github.sha }}-${{ matrix.base_image }}image_name=$(echo $image_name | tr '[:upper:]' '[:lower:]')TEST_RUNTIME=eventstream \@@ -134,11 +154,15 @@ jobs:env:CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}- # Run integration tests with the runtime Docker image+ # Run integration tests with the eventstream runtime Docker imageruntime_integration_tests_on_linux:- name: Runtime Integration Tests with ${{ inputs.image_tag }}+ name: Runtime Integration Tests on Linuxruns-on: ubuntu-latestneeds: [ghcr_build_runtime]+ strategy:+ fail-fast: false+ matrix:+ base_image: ['nikolaik', 'python', 'node']steps:- uses: actions/checkout@v4# Forked repos can't push to GHCR, so we need to download the image as an artifact@@ -146,12 +170,12 @@ jobs:if: "github.event.pull_request.head.repo.fork"uses: actions/download-artifact@v4with:- name: runtime-${{ inputs.image_tag }}+ name: runtime-${{ matrix.base_image }}path: /tmp- name: Load runtime image for forkif: "github.event.pull_request.head.repo.fork"run: |- docker load --input /tmp/runtime-${{ inputs.image_tag }}.tar+ docker load --input /tmp/runtime-${{ matrix.base_image }}.tar- name: Install poetry via pipxrun: pipx install poetry- name: Set up Python@@ -163,7 +187,7 @@ jobs:run: make install-python-dependencies- name: Run integration testsrun: |- image_name=ghcr.io/${{ github.repository_owner }}/runtime:${{ github.sha }}-${{ inputs.image_tag }}+ image_name=ghcr.io/${{ github.repository_owner }}/runtime:${{ github.sha }}-${{ matrix.base_image }}image_name=$(echo $image_name | tr '[:upper:]' '[:lower:]')TEST_RUNTIME=eventstream \@@ -179,7 +203,7 @@ jobs:# Checks that all runtime tests have passedall_runtime_tests_passed:- name: Runtime Tests Passed with ${{ inputs.image_tag }}+ name: All Runtime Tests Passedruns-on: ubuntu-latestneeds: [test_runtime, runtime_integration_tests_on_linux]steps: