refactor: add reusable workflows to build, test and release oceanbase-ce #51
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/*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-oblogproxy-ce: | |
uses: ./.github/workflows/reusable-build-oblogproxy-ce.yml | |
with: | |
cache_key: test-oblogproxy-ce | |
test-oblogproxy-ce: | |
runs-on: ubuntu-latest | |
needs: [ build-oblogproxy-ce ] | |
steps: | |
- name: Free disk space on Ubuntu runner | |
uses: kfir4444/free-disk-space@main | |
with: | |
tool-cache: false | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
swap-storage: true | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: test-oblogproxy-ce | |
path: /tmp | |
- name: Load Docker image | |
run: | | |
docker load -i /tmp/oblogproxy-ce-amd64.tar | |
rm -f /tmp/oblogproxy-ce-**.tar | |
- name: Start oceanbase-ce container | |
uses: oceanbase/setup-oceanbase-ce@v1 | |
with: | |
image_name: oceanbase/oceanbase-ce | |
image_tag: 4.2.1.8-108000022024072217 | |
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:amd64 | |
- 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 |