-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(ci): add reusable workflow for basic ci (#31)
* build(ci): add reusable workflow for basic ci * modify group * modify job name
- Loading branch information
Showing
2 changed files
with
74 additions
and
59 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Basic CI | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
module: | ||
type: string | ||
required: true | ||
description: 'The name of sample project.' | ||
language: | ||
type: string | ||
required: true | ||
description: 'The programming language used by the sample project.' | ||
with_oceanbase_container: | ||
type: boolean | ||
required: false | ||
description: 'Whether to use a pre-deployed OceanBase container in CI workflow.' | ||
default: true | ||
|
||
concurrency: | ||
group: basic-ci-${{ github.event.pull_request.number || github.ref }}-${{ inputs.module }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- name: Set Go env | ||
if: ${{ inputs.language == 'golang' }} | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
- name: Setup Java env | ||
if: ${{ inputs.language == 'java' }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '8' | ||
distribution: 'zulu' | ||
cache: 'maven' | ||
- name: Setup Python env | ||
if: ${{ inputs.language == 'python' }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
- name: Start OceanBase container | ||
if: ${{ inputs.with_oceanbase_container }} | ||
uses: oceanbase/[email protected] | ||
with: | ||
network: 'host' | ||
- name: Run sample for ${{ inputs.module }} | ||
run: | | ||
cd ${{ inputs.language }}/${{ inputs.module }} | ||
sh run.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,66 +10,26 @@ on: | |
- 'docs/**' | ||
- '**.md' | ||
- '.*' | ||
concurrency: | ||
group: ${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
golang: | ||
runs-on: ubuntu-latest | ||
basic: | ||
strategy: | ||
matrix: | ||
module: [ "go-sql-driver" ] | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- name: Set Go env | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
- name: Start docker container | ||
uses: oceanbase/[email protected] | ||
- name: Run example for ${{ matrix.module }} | ||
run: | | ||
cd golang/${{ matrix.module }} | ||
sh run.sh | ||
java: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
module: [ "mysql-connector-java", "oceanbase-client" ] | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- name: Set JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '8' | ||
distribution: 'zulu' | ||
cache: 'maven' | ||
- name: Start docker container | ||
uses: oceanbase/[email protected] | ||
- name: Run example for ${{ matrix.module }} | ||
run: | | ||
cd java/${{ matrix.module }} | ||
sh run.sh | ||
python: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
module: [ "pymysql" ] | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
- name: Start docker container | ||
uses: oceanbase/[email protected] | ||
- name: Run example for ${{ matrix.module }} | ||
run: | | ||
cd python/${{ matrix.module }} | ||
sh run.sh | ||
module: | ||
- name: 'go-sql-driver' | ||
language: 'golang' | ||
with_oceanbase_container: true | ||
- name: 'mysql-connector-java' | ||
language: 'java' | ||
with_oceanbase_container: true | ||
- name: 'oceanbase-client' | ||
language: 'java' | ||
with_oceanbase_container: true | ||
- name: 'pymysql' | ||
language: 'python' | ||
with_oceanbase_container: true | ||
uses: ./.github/workflows/basic-ci.yml | ||
with: | ||
module: ${{ matrix.module.name }} | ||
language: ${{ matrix.module.language }} | ||
with_oceanbase_container: ${{ matrix.module.with_oceanbase_container }} |