From 219b0c0a50026c8693508865234f6ff5d69c41ba Mon Sep 17 00:00:00 2001 From: Hui Yu Date: Fri, 17 Apr 2020 19:39:19 +0800 Subject: [PATCH] [CI/CD] Add Github Actions for building test and code check --- .github/workflows/build.yml | 27 ++++++++++++++++++++++++++ .github/workflows/code-check.yml | 33 ++++++++++++++++++++++++++++++++ examples/Makefile | 9 +++++++++ 3 files changed, 69 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/code-check.yml create mode 100644 examples/Makefile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..3433503 --- /dev/null +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/code-check.yml b/.github/workflows/code-check.yml new file mode 100644 index 0000000..bf5cc86 --- /dev/null +++ b/.github/workflows/code-check.yml @@ -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 {} {}~ \; diff --git a/examples/Makefile b/examples/Makefile new file mode 100644 index 0000000..e2ca28f --- /dev/null +++ b/examples/Makefile @@ -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