Skip to content

make sure the oceanbase-ce container can start on general GitHub Action #30

make sure the oceanbase-ce container can start on general GitHub Action

make sure the oceanbase-ce container can start on general GitHub Action #30

name: test oblogproxy-ce
on:
pull_request:
paths:
- '.github/workflows/**-oblogproxy-ce.yml'
- '.github/workflows/build-oceanbase-ce.yml'
- 'oblogproxy-ce/Dockerfile'
- 'oblogproxy-ce/**.sh'
- 'oceanbase-ce/Dockerfile'
- 'oceanbase-ce/**.sh'
- 'oceanbase-ce/**.yaml'
- 'test/**/LogProxyCETest.java'
concurrency:
group: test-oblogproxy-ce-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-oceanbase-ce:
uses: ./.github/workflows/build-oceanbase-ce.yml
with:
cache_key: test-oblogproxy-ce_oceanbase-ce
image_file: oceanbase-ce.tar
version: 4.2.1.8-108000022024072217
build-oblogproxy-ce:
runs-on: ubuntu-latest
steps:
- name: Clean tool cache
run: sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Print environment variables
run: printenv
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build oblogproxy-ce image
uses: docker/build-push-action@v6
with:
context: ./oblogproxy-ce
platforms: linux/amd64
file: ./oblogproxy-ce/Dockerfile
push: false
load: true
tags: oblogproxy-ce
- name: Export Docker image
run: docker save -o oblogproxy-ce.tar oblogproxy-ce
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: test-oblogproxy-ce_oblogproxy-ce
path: oblogproxy-ce.tar
test-oblogproxy-ce:
runs-on: ubuntu-latest
needs: [ build-oceanbase-ce, build-oblogproxy-ce ]
steps:
- name: Clean tool cache
run: sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Download artifact
uses: actions/download-artifact@v4
with:
pattern: test-oblogproxy-ce_**
path: /tmp
- name: Load Docker image
run: |
docker load -i /tmp/test-oblogproxy-ce_oceanbase-ce/oceanbase-ce.tar
docker load -i /tmp/test-oblogproxy-ce_oblogproxy-ce/oblogproxy-ce.tar
sudo rm -rf /tmp/*
- name: Start oceanbase-ce container
uses: oceanbase/setup-oceanbase-ce@v1
with:
image_name: oceanbase-ce
container_name: oceanbase-ce
sql_port: 12881
rpc_port: 12882
mode: mini
sys_root_password: 123456
tenant_root_password: 654321
- name: Start oblogproxy-ce container
run: docker run --name oblogproxy-ce -e OB_SYS_USERNAME=root -e OB_SYS_PASSWORD=123456 -p 12983:2983 -d oblogproxy-ce
- name: Set container IP
id: set_container_ip
run: |
observer_ip=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' oceanbase-ce)
oblogproxy_ip=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' oblogproxy-ce)
echo "Container 'oceanbase-ce' IP is $observer_ip."
echo "Container 'oblogproxy-ce' IP is $oblogproxy_ip."
echo "observer_ip=$observer_ip" >> $GITHUB_OUTPUT
echo "oblogproxy_ip=$oblogproxy_ip" >> $GITHUB_OUTPUT
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'zulu'
- name: Build test project
run: |
cd test
mvn install -DskipTests=true
- name: Run test methods
env:
observer_ip: ${{ steps.set_container_ip.outputs.observer_ip }}
oblogproxy_ip: ${{ steps.set_container_ip.outputs.oblogproxy_ip }}
oblogproxy_port: 12983
username: root@test
password: 654321
run: |
cd test
mvn verify -Dtest=LogProxyCETest -DfailIfNoTests=false