Fix slow, choppy mouse at 60Hz refresh rate (#611) #62
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths-ignore: | |
| - '**.md' | |
| - '.gitignore' | |
| pull_request: | |
| branches: [ main ] | |
| paths-ignore: | |
| - '**.md' | |
| - '.gitignore' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| flavor: | |
| - name: Standard | |
| artifactName: apk-standard | |
| gradleTask: assembleStandardDebug | |
| apkPath: app/build/outputs/apk/standard/debug/standard.apk | |
| - name: Ludashi | |
| artifactName: apk-ludashi | |
| gradleTask: assembleLudashiDebug | |
| apkPath: app/build/outputs/apk/ludashi/debug/ludashi.apk | |
| - name: Pubg | |
| artifactName: apk-pubg | |
| gradleTask: assemblePubgDebug | |
| apkPath: app/build/outputs/apk/pubg/debug/pubg.apk | |
| steps: | |
| - name: Clone repository | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 1 | |
| persist-credentials: false | |
| - name: Cache LFS | |
| uses: actions/cache@v5 | |
| with: | |
| path: .git/lfs | |
| key: lfs-${{ hashFiles('**/*.txz', '**/*.tzst') }} | |
| restore-keys: lfs- | |
| - name: Pull LFS files | |
| run: git lfs pull | |
| - name: Cache NDK build outputs | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| app/.cxx | |
| app/build/intermediates/cxx | |
| key: ndk-${{ matrix.flavor.name }}-${{ hashFiles('app/src/main/cpp/**', 'app/build.gradle', 'app/src/main/cpp/CMakeLists.txt') }} | |
| restore-keys: | | |
| ndk-${{ matrix.flavor.name }}- | |
| ndk- | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Install Rust Android target | |
| run: rustup target add aarch64-linux-android | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v6 | |
| with: | |
| validate-wrappers: true | |
| cache-cleanup: 'on-success' | |
| - name: Decode keystore and build | |
| timeout-minutes: 15 | |
| env: | |
| KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| GRADLE_OPTS: -Xmx4g -XX:+UseG1GC | |
| run: | | |
| export KEYSTORE_FILE="${{ github.workspace }}/release.jks" | |
| if [ -n "$KEYSTORE_BASE64" ]; then | |
| echo "$KEYSTORE_BASE64" | base64 -d > "$KEYSTORE_FILE" | |
| else | |
| export KEYSTORE_PASSWORD="dummypass" | |
| export KEY_ALIAS="winnative" | |
| export KEY_PASSWORD="dummypass" | |
| keytool -genkey -v \ | |
| -keystore "$KEYSTORE_FILE" \ | |
| -alias winnative \ | |
| -keyalg RSA -keysize 2048 -validity 1 \ | |
| -storepass dummypass -keypass dummypass \ | |
| -dname "CN=CI, OU=CI, O=CI, L=CI, ST=CI, C=US" | |
| fi | |
| ./gradlew :app:${{ matrix.flavor.gradleTask }} --build-cache --parallel -x lint | |
| - name: Compute artifact label | |
| id: label | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| short_sha=$(printf '%s' "${{ github.event.pull_request.head.sha }}" | cut -c1-5) | |
| echo "name=PR#${{ github.event.pull_request.number }}-${short_sha}" >> "$GITHUB_OUTPUT" | |
| else | |
| short_sha=$(printf '%s' "$GITHUB_SHA" | cut -c1-5) | |
| # For merged PR commits on main, preserve the source PR number and PR head SHA. | |
| num=$(git log -1 --pretty=%s | grep -oE '\(#[0-9]+\)|#[0-9]+' | tail -1 | tr -cd '0-9') | |
| if [ -n "$num" ]; then | |
| pr_head_sha=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$num" --jq '.head.sha' 2>/dev/null || true) | |
| if [ -n "$pr_head_sha" ] && [ "$pr_head_sha" != "null" ]; then | |
| short_sha=$(printf '%s' "$pr_head_sha" | cut -c1-5) | |
| fi | |
| echo "name=PR#${num}-${short_sha}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "name=main-${short_sha}" >> "$GITHUB_OUTPUT" | |
| fi | |
| fi | |
| - name: Prepare APK for upload | |
| run: | | |
| upload_dir="artifacts/${{ matrix.flavor.artifactName }}" | |
| mkdir -p "$upload_dir" | |
| cp ${{ matrix.flavor.apkPath }} "$upload_dir/WinNative-Debug-${{ matrix.flavor.name }}-${{ steps.label.outputs.name }}.apk" | |
| - name: Upload APK | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ matrix.flavor.artifactName }} | |
| path: artifacts/${{ matrix.flavor.artifactName }}/*.apk | |
| retention-days: 7 | |
| if-no-files-found: error | |
| cleanup-caches: | |
| needs: build | |
| if: ${{ always() && github.event_name == 'push' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: write | |
| contents: read | |
| steps: | |
| - name: Cleanup duplicate caches | |
| continue-on-error: true | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh cache list --repo "$GITHUB_REPOSITORY" --json id,key,createdAt --limit 100 | | |
| jq -r ' | |
| group_by(.key | sub("-[a-f0-9]{20,}$"; "")) | |
| | .[] | |
| | sort_by(.createdAt) | reverse | |
| | .[1:][] | |
| | .id | |
| ' | | |
| xargs -I {} gh cache delete {} --repo "$GITHUB_REPOSITORY" || true |