refactor: add reusable workflows to build, test and release oceanbase-ce #34
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test oblogproxy-ce | |
on: | |
pull_request: | |
paths: | |
- '.github/workflows/reusable-build-oceanbase-ce-image.yml' | |
- '.github/workflows/**oblogproxy-ce**.yml' | |
- 'oblogproxy-ce/**' | |
- 'test/**/LogProxyCETest.java' | |
concurrency: | |
group: test-oblogproxy-ce-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-oceanbase-ce-image: | |
uses: ./.github/workflows/reusable-build-oceanbase-ce-image.yml | |
with: | |
cache_key: test-oblogproxy-ce_oceanbase-ce | |
image_file: oceanbase-ce.tar | |
version: 4.2.1.8-108000022024072217 | |
build-oblogproxy-ce-image: | |
uses: ./.github/workflows/reusable-build-oblogproxy-ce-image.yml | |
with: | |
cache_key: test-oblogproxy-ce_oblogproxy-ce | |
image_file: oblogproxy-ce.tar | |
test-oblogproxy-ce-container: | |
runs-on: ubuntu-latest | |
needs: [ build-oceanbase-ce-image, build-oblogproxy-ce-image ] | |
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 |