Skip to content

Commit

Permalink
Build custom image with current buddy and push it to repository
Browse files Browse the repository at this point in the history
  • Loading branch information
donhardman committed Dec 6, 2024
1 parent 81a964f commit d592050
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 5 deletions.
63 changes: 61 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
pull_request:
branches: [ main ]

env:
GHCR_REPO: ghcr.io/manticoresoftware/manticoresearch
jobs:
test:
name: Run unit tests
Expand All @@ -28,10 +30,67 @@ jobs:
git clone https://github.com/manticoresoftware/phar_builder.git
bin/test
test_kit:
name: Build test kit Docker image
runs-on: ubuntu-22.04
outputs:
docker_repo: ${{ steps.vars.outputs.docker_repo }}
docker_tag: ${{ steps.vars.outputs.docker_tag }}
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set variables
id: vars
run: |
set -e
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
DOCKER_TAG=$(echo "$BRANCH" | tr '/' '-' | tr '_' '-' | tr '.' '-' | tr '@' '-' | tr ':' '-' | tr ' ' '-' | tr '[A-Z]' '[a-z]')
DOCKER_TAG="test-kit-${DOCKER_TAG,,}"
COMMIT=${GITHUB_SHA::8}
IMAGE="${GHCR_REPO}:${DOCKER_TAG}"
IMAGE_COMMIT="${GHCR_REPO}:test-kit-${COMMIT,,}"
echo "docker_repo=${GHCR_REPO}" >> $GITHUB_OUTPUT
echo "docker_tag=${DOCKER_TAG}" >> $GITHUB_OUTPUT
echo "image=${IMAGE}" >> $GITHUB_OUTPUT
echo "image_commit=${IMAGE_COMMIT}" >> $GITHUB_OUTPUT
echo "Docker Image: ${IMAGE}" >> $GITHUB_STEP_SUMMARY
echo "Docker Image commit: ${IMAGE_COMMIT}" >> $GITHUB_STEP_SUMMARY
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ vars.GHCR_USER }}
password: ${{ secrets.GHCR_PASSWORD }}

- name: Pull base image
run: docker pull ghcr.io/manticoresoftware/manticoresearch:test-kit-latest

- name: Create and push test kit image
run: |
docker create --name temp ghcr.io/manticoresoftware/manticoresearch:test-kit-latest tail -f /dev/null
docker start temp
docker exec temp sh -c 'cp /usr/share/manticore/modules/manticore-buddy/bin/manticore-buddy /tmp/manticore-buddy'
docker exec temp sh -c 'rm -rf /usr/share/manticore/modules/manticore-buddy && mkdir -p /usr/share/manticore/modules/manticore-buddy'
docker cp . temp:/usr/share/manticore/modules/manticore-buddy/
docker exec temp sh -c 'cd /usr/share/manticore/modules/manticore-buddy/ && composer install --prefer-dist'
docker exec temp sh -c 'mkdir -p /usr/share/manticore/modules/manticore-buddy/bin && mv /tmp/manticore-buddy /usr/share/manticore/modules/manticore-buddy/bin/manticore-buddy'
docker commit temp ${{ steps.vars.outputs.image }}
docker commit temp ${{ steps.vars.outputs.image_commit }}
docker push ${{ steps.vars.outputs.image }}
docker push ${{ steps.vars.outputs.image_commit }}
docker rm -f temp
clt:
uses: manticoresoftware/manticoresearch/.github/workflows/clt_tests.yml@feature/buddy-ci
name: Run CLT tests
needs: test_kit
uses: manticoresoftware/manticoresearch/.github/workflows/clt_tests.yml@master
with:
docker_image: ghcr.io/manticoresoftware/manticoresearch:test-kit-latest
docker_image: ${{ needs.test_kit.outputs.docker_repo }}:${{ needs.test_kit.outputs.docker_tag }}
repository: manticoresoftware/manticoresearch
ref: master

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
- 'v*.*.*'
branches:
- main
pull_request:
branches:
- main

env:
APP_NAME: 'manticore-buddy'
Expand Down

0 comments on commit d592050

Please sign in to comment.