From 1c227f03636628c7972b151d8474f296ad26b606 Mon Sep 17 00:00:00 2001 From: fish9167 <78347405+fish9167@users.noreply.github.com> Date: Fri, 26 Mar 2021 18:30:12 +0800 Subject: [PATCH] add githup action job for unit test (#3355) --- native/.github/workflows/cmake.yml | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 native/.github/workflows/cmake.yml diff --git a/native/.github/workflows/cmake.yml b/native/.github/workflows/cmake.yml new file mode 100644 index 0000000000..a8bf72f21f --- /dev/null +++ b/native/.github/workflows/cmake.yml @@ -0,0 +1,45 @@ +name: Cmake Unit Test + +on: [push, pull_request] + +jobs: + camke-unit: + # The CMake configure and build commands are platform agnostic and should work equally + # well on Windows or Mac. You can convert this to a matrix build if you need + # cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + #runs-on: windows-latest + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2 + + - name: Create build directory + run: mkdir -p ${{github.workspace}}/unit-test/build + + - name: Downlad external libraties + shell: bash + working-directory: ${{github.workspace}}/external + run: | + cd ${{github.workspace}}/external + external_version=`grep version config.json |awk -F'"' '{print $4}'` + external_repo_name=`grep name config.json |awk -F'"' '{print $4}'` + external_repo_parent=`grep owner config.json |awk -F'"' '{print $4}'` + rm ${{github.workspace}}/external/* + git clone --branch ${external_version} --depth 1 https://github.com/${external_repo_parent}/${external_repo_name} . + git log --oneline -1 + + - name: Configure CMake + shell: bash + working-directory: ${{github.workspace}}/unit-test/build + run: pwd && cd ${{github.workspace}}/unit-test/build && cmake .. -G"Unix Makefiles" + + - name: Build + working-directory: ${{github.workspace}}/unit-test/build + shell: bash + run: pwd && cd ${{github.workspace}}/unit-test/build && make V=1 + + - name: Run Test + working-directory: ${{github.workspace}}/unit-test/build + shell: bash + run: pwd && cd ${{github.workspace}}/unit-test/build && ./src/CocosTest