Files
cocos4/native/.github/workflows/cmake.yml
T
2021-06-12 22:04:58 +08:00

74 lines
2.7 KiB
YAML

name: Unit Test
on: [push, pull_request]
jobs:
unit-test-with-cmake:
# 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
- uses: actions/setup-python@v2
with:
python-version: '2.7.18' # this is intentional, binding generator should support both 2.7 and 3.x now
- 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: pip install
run: |
python -m pip install PyYAML Cheetah
- name: install android ndk
shell: bash
working-directory: ${{github.workspace}}
run: |
curl -O http://dl.google.com/android/repository/android-ndk-r16b-darwin-x86_64.zip
unzip -q android-ndk-r16b-darwin-x86_64.zip
mkdir -p ${HOME}/bin
mv android-ndk-r16b ${HOME}/bin/android-ndk
ls ${HOME}
- name: generate bindings glue codes
shell: bash
run: |
python -V
export NDK_ROOT=${HOME}/bin/android-ndk
cd ${{github.workspace}}/tools/travis-scripts
echo "Create auto-generated jsbinding glue codes."
pushd ${{github.workspace}}/tools/tojs
python ./genbindings.py
rm userconf.ini
popd
- 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