Skip to content

push triggered by guowl3 🚀 #553

push triggered by guowl3 🚀

push triggered by guowl3 🚀 #553

Workflow file for this run

###
# This workflow is used for daily development
# Triggers:
# 1. Push
# 2. Pull-Request
# Jobs:
# 1. Check Code Format
# 2. PMD Scan
# 3. Unit Test (TODO)
# 4. Calculate Version Number
# 5. Build RPM (exclude front resources and only x86_64 platform for now)
# (Job 4 and 5 are executed only when Pull-Request)
###
name: Build Dev
run-name: ${{ github.event_name }} triggered by ${{ github.actor }} 🚀
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
jobs:
check-format:
name: Check Code Format
runs-on: ubuntu-latest
steps:
- name: Checkout workspace
uses: actions/checkout@v3
- name: Setup JDK 8
uses: actions/setup-java@v3
with:
java-version: "8"
distribution: "temurin"
cache: maven
- name: Check code format
run: mvn impsort:check formatter:validate
- name: Check license
run: mvn license:check
pmd-scan:
name: PMD Scan
runs-on: ubuntu-latest
steps:
- name: Checkout workspace
uses: actions/checkout@v3
- name: Setup JDK 8
uses: actions/setup-java@v3
with:
java-version: "8"
distribution: "temurin"
cache: maven
- name: Install db-browser
run: |
echo "Start install db-browser"
pushd libs/db-browser
echo "Current dir is "`pwd`
mvn clean install -Dmaven.test.skip=true
echo "Install db-browser success"
popd
- name: Install ob-sql-parser
run: |
echo "Start install ob-sql-parser"
pushd libs/ob-sql-parser
echo "Current dir is "`pwd`
mvn clean install -Dmaven.test.skip=true
echo "Install ob-sql-parser success"
popd
- name: Build project
run: mvn clean install -Dmaven.test.skip=true
- name: Run PMD scan
run: mvn pmd:check
unit-test:
name: Unit Test (Skip for now)
needs: [ check-format, pmd-scan ]
runs-on: ubuntu-latest
steps:
- name: Checkout workspace
uses: actions/checkout@v3
- name: Setup JDK 8
uses: actions/setup-java@v3
with:
java-version: "8"
distribution: "temurin"
cache: maven
- name: Install db-browser
run: |
echo "Start install db-browser"
pushd libs/db-browser
echo "Current dir is "`pwd`
mvn clean install -Dmaven.test.skip=true
echo "Install db-browser success"
popd
- name: Install ob-sql-parser
run: |
echo "Start install ob-sql-parser"
pushd libs/ob-sql-parser
echo "Current dir is "`pwd`
mvn clean install -Dmaven.test.skip=true
echo "Install ob-sql-parser success"
popd
- name: Run unit test
run: echo "Skip for now 🤪"
calculate-version:
name: Calculate Version Number
needs: [ unit-test ]
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
outputs:
odc_rpm_release_number: ${{ steps.calculate_version.outputs.odc_rpm_release_number }}
steps:
- name: Checkout workspace
uses: actions/checkout@v3
- name: Calculate version number
id: calculate_version
run: |
odc_rpm_release_number=$(date +%Y%m%d%H%M%S)
echo "odc_rpm_release_number=${odc_rpm_release_number}" >> $GITHUB_OUTPUT
echo "odc_rpm_release_number=${odc_rpm_release_number}"
build-rpm-x86_64:
name: Build RPM (x86_64)
needs: [ calculate-version ]
runs-on: ubuntu-latest
env:
odc_rpm_release_number: ${{ needs.calculate-version.outputs.odc_rpm_release_number }}
steps:
- name: Checkout workspace
uses: actions/checkout@v3
with:
submodules: "recursive"
- name: Setup JDK 8
uses: actions/setup-java@v3
with:
java-version: "8"
distribution: "temurin"
cache: maven
- name: Setup node 16
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Set release version
id: set_release_version
run: |
main_version="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d - -f 1)"
new_version="${main_version}-${odc_rpm_release_number}"
echo "new_version=${new_version}" >> $GITHUB_OUTPUT
echo "RPM's version is "${new_version}
mvn versions:set -DnewVersion="${new_version}"
mvn versions:commit
- name: Install db-browser
run: |
echo "Start install db-browser"
pushd libs/db-browser
echo "Current dir is "`pwd`
mvn clean install -Dmaven.test.skip=true
echo "Install db-browser success"
popd
- name: Install ob-sql-parser
run: |
echo "Start install ob-sql-parser"
pushd libs/ob-sql-parser
echo "Current dir is "`pwd`
mvn clean install -Dmaven.test.skip=true
echo "Install ob-sql-parser success"
popd
- name: Build jar & rpm (x86_64)
run: |
echo "Start prepare oceanbase-client"
pushd import
echo "Current dir is "`pwd`
rm -rf obclient_aarch.tar.gz
rm -rf obclient_win.tar.gz
mv obclient_x86.tar.gz obclient.tar.gz
popd
echo "Prepare oceanbase-client success"
echo "Start build rpm package"
mvn help:system
mvn clean install -Dmaven.test.skip=true
mvn --file server/odc-server/pom.xml rpm:rpm -Drpm.prefix=/opt
echo "Build rpm package success"
rm --force --recursive --verbose distribution/docker/resources/odc-*.rpm
mkdir -p distribution/docker/resources/
mv --verbose server/odc-server/target/rpm/odc-server/RPMS/*/odc-*.rpm distribution/docker/resources/
- name: Upload rpm (x86_64)
uses: actions/upload-artifact@v3
with:
name: odc-server-${{ steps.set_release_version.outputs.new_version }}.x86_64.rpm
path: distribution/docker/resources/odc-*.rpm