Merge pull request #11 from ityuhui/yhghactions

[CI/CD] Add Github Actions for building test and code check
This commit is contained in:
Kubernetes Prow Robot
2020-04-17 15:09:36 -07:00
committed by GitHub
3 changed files with 69 additions and 0 deletions

27
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
types: [assigned, opened, synchronize, reopened]
jobs:
build-library-and-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Prepare
run: sudo apt-get install -y libcurl4-openssl-dev uncrustify libyaml-dev
- name: Build client library
run: |
cd kubernetes
mkdir build
cd build
cmake ..
make
- name: Build examples
run: |
cd examples/
make

33
.github/workflows/code-check.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: Code Check
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
types: [assigned, opened, synchronize, reopened]
jobs:
code-static-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Prepare
run: sudo apt-get install -y cppcheck
- name: Code static check for config
run: sh ./code-check/code-static-check.sh ./kubernetes/config/
- name: Code static check for examples
run: sh ./code-check/code-static-check.sh ./examples/
code-style-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Prepare
run: sudo apt-get install -y indent
- name: Code style check for config
run: |
find ./kubernetes/config/ -type f -regextype posix-extended -regex ".*\.(c|h)" -exec sh ./code-check/code-style-check.sh {} \;
find ./kubernetes/config/ -type f -regextype posix-extended -regex ".*\.(c|h)" -exec diff {} {}~ \;
- name: Code style check for examples
run: |
find ./examples/ -type f -regextype posix-extended -regex ".*\.(c|h)" -exec sh ./code-check/code-style-check.sh {} \;
find ./examples/ -type f -regextype posix-extended -regex ".*\.(c|h)" -exec diff {} {}~ \;

9
examples/Makefile Normal file
View File

@@ -0,0 +1,9 @@
all:
cd create_pod; make
cd list_pod; make
cd list_pod_incluster; make
clean:
cd create_pod; make clean
cd list_pod; make clean
cd list_pod_incluster; make clean