mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
* try to fix pip unavailable * update test case for pip * force rebuild in CI * remove extra symlink * fix newline * added semi-colon to line 31 * Dockerfile.j2: activate env at the end * Revert "Dockerfile.j2: activate env at the end" This reverts commit cf2f5651021fe80d4ab69a35a85f0a35b29dc3d7. * cleanup Dockerfile * switch default python image * remove image agnostic (no longer used) * fix tests * simplify integration tests default image * add nodejs specific runtime tests * update tests and workflows * switch to nikolaik/python-nodejs:python3.11-nodejs22 * update build sh to output image name correctly * increase custom images to test * fix test * fix test * fix double quote * try fixing ci * update ghcr workflow * fix artifact name * try to fix ghcr again * fix workflow * save built image to correct dir * remove extra -docker-image * make last tag to be human readable image tag * fix hyphen to underscore * run test runtime on all tags * revert app build * separate ghcr workflow * update dockerfile for eval * fix tag for test run * try fix tag * try fix tag via matrix output * try workflow again * update comments * try fixing test matrix * fix artifact name * try fix tag again * Revert "try fix tag again" This reverts commit b369badd8cccf4a526e36d27eafb77ea2d32f6be. * tweak filename * try different path * fix filepath * try fix tag artifact path again * save json instead of line * update matrix * print all tags in workflow * fix DOCKER_IMAGE to avoid ghcr.io/opendevin/ghcr.io/opendevin/od_runtime * fix test matrix to only load unique test image tags * try fix matrix again!!!!! * add all runtime tests passed --------- Co-authored-by: tobitege <tobitege@gmx.de> Co-authored-by: Graham Neubig <neubig@gmail.com> Co-authored-by: tobitege <10787084+tobitege@users.noreply.github.com>
149 lines
5.2 KiB
YAML
149 lines
5.2 KiB
YAML
# Workflow that builds, tests and then pushes the app docker images to the ghcr.io repository
|
|
name: Build and Publish App Image
|
|
|
|
|
|
# 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:
|
|
# Builds the OpenDevin Docker images
|
|
ghcr_build:
|
|
name: Build App Image
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
tags: ${{ steps.capture-tags.outputs.tags }}
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
strategy:
|
|
matrix:
|
|
image: ['opendevin']
|
|
platform: ['amd64', 'arm64']
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Free Disk Space (Ubuntu)
|
|
uses: jlumbroso/free-disk-space@main
|
|
with:
|
|
# this might remove tools that are actually needed,
|
|
# if set to "true" but frees about 6 GB
|
|
tool-cache: true
|
|
# all of these default to true, but feel free to set to
|
|
# "false" if necessary for your workflow
|
|
android: true
|
|
dotnet: true
|
|
haskell: true
|
|
large-packages: true
|
|
docker-images: false
|
|
swap-storage: true
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Build and export image
|
|
id: build
|
|
run: ./containers/build.sh ${{ matrix.image }} ${{ github.repository_owner }} ${{ matrix.platform }}
|
|
- name: Capture tags
|
|
id: capture-tags
|
|
run: |
|
|
tags=$(cat tags.txt)
|
|
echo "tags=$tags"
|
|
echo "tags=$tags" >> $GITHUB_OUTPUT
|
|
- name: Upload Docker image as artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.image }}_image_${{ matrix.platform }}
|
|
path: /tmp/${{ matrix.image }}_image_${{ matrix.platform }}.tar
|
|
retention-days: 14
|
|
|
|
# Push the OpenDevin and sandbox Docker images to the ghcr.io repository
|
|
ghcr_push:
|
|
runs-on: ubuntu-latest
|
|
needs: [ghcr_build]
|
|
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main')
|
|
env:
|
|
tags: ${{ needs.ghcr_build.outputs.tags }}
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
strategy:
|
|
matrix:
|
|
image: ['opendevin']
|
|
platform: ['amd64', 'arm64']
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
- name: Login to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Download Docker images
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: ${{ matrix.image }}_image_${{ matrix.platform }}
|
|
path: /tmp/${{ matrix.platform }}
|
|
- name: Load images and push to registry
|
|
run: |
|
|
mv /tmp/${{ matrix.platform }}/${{ matrix.image }}_image_${{ matrix.platform }}.tar .
|
|
loaded_image=$(docker load -i ${{ matrix.image }}_image_${{ matrix.platform }}.tar | grep "Loaded image:" | head -n 1 | awk '{print $3}')
|
|
echo "loaded image = $loaded_image"
|
|
tags=$(echo ${tags} | tr ' ' '\n')
|
|
image_name=$(echo "ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}" | tr '[:upper:]' '[:lower:]')
|
|
echo "image name = $image_name"
|
|
for tag in $tags; do
|
|
echo "tag = $tag"
|
|
docker tag $loaded_image $image_name:${tag}_${{ matrix.platform }}
|
|
docker push $image_name:${tag}_${{ matrix.platform }}
|
|
done
|
|
# Creates and pushes the OpenDevin and sandbox Docker image manifests
|
|
create_manifest:
|
|
runs-on: ubuntu-latest
|
|
needs: [ghcr_build, ghcr_push]
|
|
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main')
|
|
env:
|
|
tags: ${{ needs.ghcr_build.outputs.tags }}
|
|
strategy:
|
|
matrix:
|
|
image: ['opendevin']
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
- name: Login to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Create and push multi-platform manifest
|
|
run: |
|
|
image_name=$(echo "ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}" | tr '[:upper:]' '[:lower:]')
|
|
echo "image name = $image_name"
|
|
tags=$(echo ${tags} | tr ' ' '\n')
|
|
for tag in $tags; do
|
|
echo 'tag = $tag'
|
|
docker buildx imagetools create --tag $image_name:$tag \
|
|
$image_name:${tag}_amd64 \
|
|
$image_name:${tag}_arm64
|
|
done
|