Skip to content

Commit 1b66f2e

Browse files
authored
Revert "Create a reusable workflow for building, testing and publishing runti…" (#3725)
This reverts commit d1a7417.
1 parent d1a7417 commit 1b66f2e

File tree

2 files changed

+57
-79
lines changed

2 files changed

+57
-79
lines changed

.github/workflows/ghcr-runtime.yml

-46
This file was deleted.

.github/workflows/ghcr-runtime-reusable.yml .github/workflows/ghcr_runtime.yml

+57-33
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,47 @@
1-
# Reusable workflow that builds, tests and then pushes the runtime Docker image to the ghcr.io repository
1+
# Workflow that builds, tests and then pushes the runtime docker images to the ghcr.io repository
22
name: Build, Test and Publish Runtime Image
33

4-
# Indicate that this is a reusable workflow
4+
# Only run one workflow of the same group at a time.
5+
# There can be at most one running and one pending job in a concurrency group at any time.
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
9+
10+
# Always run on "main"
11+
# Always run on tags
12+
# Always run on PRs
13+
# Can also be triggered manually
514
on:
6-
workflow_call:
15+
push:
16+
branches:
17+
- main
18+
tags:
19+
- '*'
20+
pull_request:
21+
workflow_dispatch:
722
inputs:
8-
# The base_image name used to build the runtime Docker image
9-
base_image:
10-
required: true
11-
type: string
12-
# The tag to use for the built runtime Docker image
13-
image_tag:
14-
required: true
15-
type: string
16-
secrets:
17-
CODECOV_TOKEN:
23+
reason:
24+
description: 'Reason for manual trigger'
1825
required: true
26+
default: ''
1927

2028
jobs:
2129
# Builds the runtime Docker images
2230
ghcr_build_runtime:
23-
name: Build Image ${{ inputs.image_tag }}
31+
name: Build Image
2432
runs-on: ubuntu-latest
2533
permissions:
2634
contents: read
2735
packages: write
36+
strategy:
37+
matrix:
38+
base_image:
39+
- image: 'nikolaik/python-nodejs:python3.11-nodejs22'
40+
tag: nikolaik
41+
- image: 'python:3.11-bookworm'
42+
tag: python
43+
- image: 'node:22-bookworm'
44+
tag: node
2845
steps:
2946
- name: Checkout
3047
uses: actions/checkout@v4
@@ -63,31 +80,34 @@ jobs:
6380
- name: Install Python dependencies using Poetry
6481
run: make install-python-dependencies
6582
- name: Create source distribution and Dockerfile
66-
run: poetry run python3 openhands/runtime/utils/runtime_build.py --base_image ${{ inputs.base_image }} --build_folder containers/runtime --force_rebuild
67-
- name: Build and push runtime image ${{ inputs.base_image }}
83+
run: poetry run python3 openhands/runtime/utils/runtime_build.py --base_image ${{ matrix.base_image.image }} --build_folder containers/runtime --force_rebuild
84+
- name: Build and push runtime image ${{ matrix.base_image.image }}
6885
if: "!github.event.pull_request.head.repo.fork"
6986
run: |
70-
./containers/build.sh runtime ${{ github.repository_owner }} --push ${{ inputs.image_tag }}
87+
./containers/build.sh runtime ${{ github.repository_owner }} --push ${{ matrix.base_image.tag }}
7188
# Forked repos can't push to GHCR, so we need to upload the image as an artifact
72-
- name: Build runtime image ${{ inputs.base_image }} for fork
89+
- name: Build runtime image ${{ matrix.base_image.image }} for fork
7390
if: "github.event.pull_request.head.repo.fork"
7491
uses: docker/build-push-action@v6
7592
with:
76-
tags: ghcr.io/all-hands-ai/runtime:${{ github.sha }}-${{ inputs.image_tag }}
77-
outputs: type=docker,dest=/tmp/runtime-${{ inputs.image_tag }}.tar
93+
tags: ghcr.io/all-hands-ai/runtime:${{ github.sha }}-${{ matrix.base_image.tag }}
94+
outputs: type=docker,dest=/tmp/runtime-${{ matrix.base_image.tag }}.tar
7895
context: containers/runtime
7996
- name: Upload runtime image for fork
8097
if: "github.event.pull_request.head.repo.fork"
8198
uses: actions/upload-artifact@v4
8299
with:
83-
name: runtime-${{ inputs.image_tag }}
84-
path: /tmp/runtime-${{ inputs.image_tag }}.tar
100+
name: runtime-${{ matrix.base_image.tag }}
101+
path: /tmp/runtime-${{ matrix.base_image.tag }}.tar
85102

86-
# Run unit tests with the runtime Docker images
103+
# Run unit tests with the EventStream runtime Docker images
87104
test_runtime:
88-
name: Runtime Unit Tests with ${{ inputs.image_tag }}
105+
name: Test Runtime
89106
runs-on: ubuntu-latest
90107
needs: [ghcr_build_runtime]
108+
strategy:
109+
matrix:
110+
base_image: ['nikolaik', 'python', 'node']
91111
steps:
92112
- uses: actions/checkout@v4
93113
- name: Free Disk Space (Ubuntu)
@@ -104,12 +124,12 @@ jobs:
104124
if: "github.event.pull_request.head.repo.fork"
105125
uses: actions/download-artifact@v4
106126
with:
107-
name: runtime-${{ inputs.image_tag }}
127+
name: runtime-${{ matrix.base_image }}
108128
path: /tmp
109129
- name: Load runtime image for fork
110130
if: "github.event.pull_request.head.repo.fork"
111131
run: |
112-
docker load --input /tmp/runtime-${{ inputs.image_tag }}.tar
132+
docker load --input /tmp/runtime-${{ matrix.base_image }}.tar
113133
- name: Install poetry via pipx
114134
run: pipx install poetry
115135
- name: Set up Python
@@ -121,7 +141,7 @@ jobs:
121141
run: make install-python-dependencies
122142
- name: Run runtime tests
123143
run: |
124-
image_name=ghcr.io/${{ github.repository_owner }}/runtime:${{ github.sha }}-${{ inputs.image_tag }}
144+
image_name=ghcr.io/${{ github.repository_owner }}/runtime:${{ github.sha }}-${{ matrix.base_image }}
125145
image_name=$(echo $image_name | tr '[:upper:]' '[:lower:]')
126146
127147
TEST_RUNTIME=eventstream \
@@ -134,24 +154,28 @@ jobs:
134154
env:
135155
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
136156

137-
# Run integration tests with the runtime Docker image
157+
# Run integration tests with the eventstream runtime Docker image
138158
runtime_integration_tests_on_linux:
139-
name: Runtime Integration Tests with ${{ inputs.image_tag }}
159+
name: Runtime Integration Tests on Linux
140160
runs-on: ubuntu-latest
141161
needs: [ghcr_build_runtime]
162+
strategy:
163+
fail-fast: false
164+
matrix:
165+
base_image: ['nikolaik', 'python', 'node']
142166
steps:
143167
- uses: actions/checkout@v4
144168
# Forked repos can't push to GHCR, so we need to download the image as an artifact
145169
- name: Download runtime image for fork
146170
if: "github.event.pull_request.head.repo.fork"
147171
uses: actions/download-artifact@v4
148172
with:
149-
name: runtime-${{ inputs.image_tag }}
173+
name: runtime-${{ matrix.base_image }}
150174
path: /tmp
151175
- name: Load runtime image for fork
152176
if: "github.event.pull_request.head.repo.fork"
153177
run: |
154-
docker load --input /tmp/runtime-${{ inputs.image_tag }}.tar
178+
docker load --input /tmp/runtime-${{ matrix.base_image }}.tar
155179
- name: Install poetry via pipx
156180
run: pipx install poetry
157181
- name: Set up Python
@@ -163,7 +187,7 @@ jobs:
163187
run: make install-python-dependencies
164188
- name: Run integration tests
165189
run: |
166-
image_name=ghcr.io/${{ github.repository_owner }}/runtime:${{ github.sha }}-${{ inputs.image_tag }}
190+
image_name=ghcr.io/${{ github.repository_owner }}/runtime:${{ github.sha }}-${{ matrix.base_image }}
167191
image_name=$(echo $image_name | tr '[:upper:]' '[:lower:]')
168192
169193
TEST_RUNTIME=eventstream \
@@ -179,7 +203,7 @@ jobs:
179203

180204
# Checks that all runtime tests have passed
181205
all_runtime_tests_passed:
182-
name: Runtime Tests Passed with ${{ inputs.image_tag }}
206+
name: All Runtime Tests Passed
183207
runs-on: ubuntu-latest
184208
needs: [test_runtime, runtime_integration_tests_on_linux]
185209
steps:

0 commit comments

Comments
 (0)