Merge pull request #11206 from hejieehe/feat_11193 #14149
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
# This is a basic workflow to help you get started with Actions | |
name: Backend CI | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [master] | |
paths: | |
- 'src/backend/ci/**' | |
pull_request: | |
branches: [master, release-*] | |
paths: | |
- 'src/backend/ci/**' | |
workflow_dispatch: | |
workflow_call: | |
inputs: | |
upload: | |
required: true | |
type: string | |
jobs: | |
backend-jar: | |
name: Build backend -- JAR | |
runs-on: ubuntu-20.04 | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
ports: | |
- 3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: init mysql | |
run: | | |
export MYSQL_PWD=root | |
for i in *.sql;do echo $i;mysql -h 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uroot < $i;done | |
working-directory: support-files/sql | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "8" | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-jar-${{ hashFiles('src/backend/ci/**/*.gradle.kts', 'src/backend/ci/**/gradle-wrapper.properties','src/backend/ci/buildSrc/**/Versions.kt') }} | |
- name: Gradle Build Backend Service | |
working-directory: src/backend/ci | |
run: | | |
./gradlew clean test build :core:worker:worker-agent:shadowJar \ | |
-DmysqlURL=127.0.0.1:${{ job.services.mysql.ports['3306'] }} -DmysqlUser=root -DmysqlPasswd=root --no-daemon | |
- uses: actions/upload-artifact@v4 | |
if: ${{ inputs.upload == 'true' }} | |
with: | |
name: backend-jar | |
path: src/backend/ci/release | |
backend-docker: | |
name: Build backend -- Docker | |
runs-on: ubuntu-20.04 | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
ports: | |
- 3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: init mysql | |
run: | | |
export MYSQL_PWD=root | |
for i in *.sql;do echo $i;mysql -h 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uroot < $i;done | |
working-directory: support-files/sql | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "8" | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-docker-${{ hashFiles('src/backend/ci/**/*.gradle.kts', 'src/backend/ci/**/gradle-wrapper.properties','src/backend/ci/buildSrc/**/Versions.kt') }} | |
- name: Gradle Build Backend Service | |
working-directory: src/backend/ci | |
run: | | |
./gradlew clean test build :core:worker:worker-agent:shadowJar -Ddevops.assemblyMode=KUBERNETES \ | |
-DmysqlURL=127.0.0.1:${{ job.services.mysql.ports['3306'] }} -DmysqlUser=root -DmysqlPasswd=root --no-daemon | |
- uses: actions/upload-artifact@v4 | |
if: ${{ inputs.upload == 'true' }} | |
with: | |
name: backend-docker | |
path: src/backend/ci/release |