C++ unit testing & CI integration in GitHub (2/2)
Based on the previous post, we are able to integrate our Android JNI project with CI tools, Circle-CI and GitHub Actions. However, we still have a little unperfected because we were unable to enable an Android emulator running for Android JNI unit tests. Now, I think I got a solution, it is using Android Emulator Runner.
Add a job for Android Emulator
When I first saw the instruction from Android Emulator Runner, I was thinking it should be super easy and should not take me an hour, but I was wrong... Let's use the sample config from that Android Emulator Runner link.
jobs:
  test:
    runs-on: macos-latest
    steps:
    - name: checkout
      uses: actions/checkout@v2
    - name: run tests
      uses: reactivecircus/android-emulator-runner@v2
      with:
        api-level: 29
        script: ./gradlew connectedCheck
Private submodules support
First of all, let's deal with the private repo. In my project, there is one submodule I can't access by using my public SSH key.  Hence, I need to use my personal access token (PAT) to access it. To create a PAR, go to your settings/Developer settings/Personal access tokens, check the workflow. Then, save it.
Next, we are going to use this PAT to access submodules. We will add a job to do it.
- name: Checkout submodules using a PAT
  run: |
    git config --file .gitmodules --get-regexp url | while read url; do
      git config --file=.gitmodules $(echo "$url" | sed -E "s/git@github.com:|https:\/\/github.com\//https:\/\/${{ secrets.CI_PAT }}:${{ secrets.CI_PAT }}@github.com\//")
    done
    git submodule sync
    git submodule update --init --recursive
Specific NDK version support
Then, we start to adjust the NDK version based on our project Build.gradle request. My project is using ndkVersion "21.0.6113669". One of the reasons is CI-Circle is using 21.0.6113669, I wanna it could be compatible with both CI tools. So, I'm gonna adjust the NDK version of my machine. There are two ways you can do. The first one is adding an additional task to install NDK specific version.- name: Install NDK
  run: echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install "ndk;21.0.6113669"
uses: reactivecircus/android-emulator-runner@v2
with:
  api-level: 29
  ndk: 21.0.6113669
After that, the unit test config setting for Android emulator should be good now, and don't forget to add a badge of GitHub Action as well.
as well.
 as well.
as well.
 
 
 
Live scores on the Premier League in 2021
ReplyDeleteBet365 is one matchpoint of the few online sportsbooks that allows you to quickly and easily bet on 카지노사이트 football matches in the UK. The Premier League, gioco digitale the