name: Run Unit Tests on: pull_request: paths: - 'templates/**' - 'native/**' # github.head_ref is only defined on pull_request events concurrency: group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: unit-test-with-cmake: name: "Run on windows" if: (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) runs-on: windows-latest defaults: run: working-directory: ${{github.workspace}}/native steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: python-version: "3.x" - name: Downlad external libraties run: | npm install npm install gulp -g node ./utils/download-deps.js - uses: nttld/setup-ndk@v1 id: setup-ndk with: ndk-version: r21e add-to-path: false - name: Generate bindings shell: bash env: ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} run: | python -m pip install PyYAML==5.4.1 Cheetah3 python ./tools/tojs/genbindings.py - name: Run Unit Tests shell: bash run: | cmake -B tests/unit-test/build -S tests/unit-test cmake --build tests/unit-test/build --config Release ./tests/unit-test/build/src/Release/CocosTest.exe #### TODO(PatriceJiang): model split # - name: Run Module Tests # shell: bash # run: | # cd tests/module-tests # bash run-test-windows.sh sebind-with-windows: name: "sebind tests" if: (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) runs-on: windows-latest defaults: run: working-directory: ${{github.workspace}}/native steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: python-version: "3.x" - name: Downlad external libraties run: | npm install npm install gulp -g node ./utils/download-deps.js - uses: nttld/setup-ndk@v1 id: setup-ndk with: ndk-version: r21e add-to-path: false - name: Generate bindings shell: bash env: ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} run: | python -m pip install PyYAML==5.4.1 Cheetah3 python ./tools/tojs/genbindings.py - name: Run Sebind Tests shell: bash run: | cd ${GITHUB_WORKSPACE}/native cp -r ../templates/windows tests/sebind-tests/win64 cd tests/sebind-tests mkdir -p proj cp cfg.cmake proj/ GW="${GITHUB_WORKSPACE//\\/\/}" cmake -B proj -S win64 -DRES_DIR="${GW}/native/tests/sebind-tests" -DCOCOS_X_PATH="${GW}/native" -DAPP_NAME=sebind cmake --build proj # cd proj/Debug ## can not boot on this machine # ./sebind.exe || true # if [[ -f "result.txt" ]]; # then # echo "success!" # else # echo "Run sebind-tests fail!" # exit 1 # fi # sebind-run-on-linux: # name: "Test sebind on Ubuntu" # runs-on: ubuntu-latest # steps: # - uses: actions/checkout@v2 # - name: Download external libraries # shell: bash # run: | # EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` # git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos-creator/engine-native-external native/external # - name: Generate bindings # run: | # python3 -m pip install PyYAML==5.4.1 Cheetah3 # python3 ./native/tools/tojs/genbindings.py # rm ./native/tools/tojs/userconf.ini # - name: Install dependencies # run: | # sudo apt install libx11-dev -y # sudo apt install libsndio-dev -y # sudo apt install ninja-build -y # - name: Run Sebind Tests # shell: bash # run: | # cd ${GITHUB_WORKSPACE}/native # cp -r ../templates/linux tests/sebind-tests/linux # cd tests/sebind-tests # mkdir -p proj # cp cfg.cmake proj # cmake -G Ninja -B proj -S linux -DRES_DIR=${GITHUB_WORKSPACE}/native/tests/sebind-tests/ -DCOCOS_X_PATH=${GITHUB_WORKSPACE}/native -DAPP_NAME=sebind # cmake --build proj # cd proj # ./sebind || true # if [[ -f "result.txt" ]]; # then # echo "success!" # else # echo "Run sebind-tests fail!" > /dev/stderr # fi