This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
chore(deps): update styfle/cancel-workflow-action action to v0.12.1 (… #322
This file contains 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: Build and test | |
on: | |
push: | |
branches: [ "dev", "main" ] | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: [ "dev" ] | |
paths-ignore: | |
- '**.md' | |
workflow_dispatch: { } | |
env: | |
# Misc | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Publishing credentials | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MVN_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MVN_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MVN_SIGNING_KEY }} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.MVN_SIGNING_KEY_ID }} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MVN_SIGNING_KEY_PASSWORD }} | |
# Build configuration | |
BUILD_JAVA_VERSION: '17' | |
BUILD_JAVA_DIST: 'temurin' | |
BUILD_IS_RELEASE: ${{ github.ref == 'refs/heads/main' }} | |
PublishToMaven: ${{ github.ref == 'refs/heads/main' }} | |
DEBUG_INFO_PATH: '**/build/generated/**/*.debug_info' | |
# APT | |
ATS_SUDO: sudo | |
ATS_APT_UPDATE: apt-get update | |
ATS_APT_UPGRADE: apt-get upgrade -y | |
ATS_APT_INSTALL: apt-get install | |
ATS_APT_DEPS: build-essential cargo nodejs cmake ninja-build | |
jobs: | |
build_release_apk: | |
name: Build Release APK | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.BUILD_JAVA_VERSION }} | |
distribution: ${{ env.BUILD_JAVA_DIST }} | |
- name: Setup NDK | |
uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r25 | |
- name: Change Gradle wrapper permissions | |
run: chmod +x ./gradlew | |
- name: Install dependencies | |
run: $ATS_SUDO $ATS_APT_UPDATE && $ATS_SUDO $ATS_APT_UPGRADE && $ATS_SUDO $ATS_APT_INSTALL $ATS_APT_DEPS | |
- name: Restore cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Assemble Release | |
run: ./gradlew assembleRelease generateDebugSymbolsRelease --parallel --stacktrace | |
env: | |
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
- name: Upload APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-release | |
path: app/build/outputs/apk/release/app-release.apk | |
- name: Upload debug symbols | |
uses: actions/upload-artifact@v4 | |
with: | |
name: debug-symbols | |
path: ${{ env.DEBUG_INFO_PATH }} | |
unit_test_debug: | |
name: Run local tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.BUILD_JAVA_VERSION }} | |
distribution: ${{ env.BUILD_JAVA_DIST }} | |
- name: Setup NDK | |
uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r25 | |
- name: Change Gradle wrapper permissions | |
run: chmod +x ./gradlew | |
- name: Install dependencies | |
run: $ATS_SUDO $ATS_APT_UPDATE && $ATS_SUDO $ATS_APT_UPGRADE && $ATS_SUDO $ATS_APT_INSTALL $ATS_APT_DEPS | |
- name: Restore cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Run debug tests | |
run: ./gradlew testDebug --continue --parallel --stacktrace | |
env: | |
ANDROIDIDE_TEST: true | |
- name: Upload Test Reports | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results-unit-tests | |
path: '**/build/reports/tests/' | |
publish: | |
name: Publish release | |
runs-on: ubuntu-latest | |
needs: [ build_release_apk, unit_test_debug ] | |
if: ${{ always() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && needs.build_release_apk.result == 'success' && needs.unit_test_debug.result == 'success' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.BUILD_JAVA_VERSION }} | |
distribution: ${{ env.BUILD_JAVA_DIST }} | |
- name: Setup NDK | |
uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r25 | |
- name: Change Gradle wrapper permissions | |
run: chmod +x ./gradlew | |
- name: Install dependencies | |
run: $ATS_SUDO $ATS_APT_UPDATE && $ATS_SUDO $ATS_APT_UPGRADE && $ATS_SUDO $ATS_APT_INSTALL $ATS_APT_DEPS | |
- name: Restore cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts/ | |
- name: List downloaded artifacts | |
run: ls -laR | |
working-directory: artifacts/ | |
- name: Archive debug symbols | |
run: | | |
zip -r debug-symbols.zip . -i $DEBUG_INFO_PATH | |
working-directory: artifacts/ | |
- name: Publish release | |
id: publish_release | |
run: ./gradlew nyxMake nyxMark nyxPublish publish release --stacktrace | |
- name: Archive Nyx state file | |
uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: .nyx-state-${{ github.job }}.json | |
path: build/nyx-state.json | |
publish_snapshots: | |
name: Publish package snapshots | |
runs-on: ubuntu-latest | |
needs: [ build_release_apk ] | |
if: ${{ always() && github.ref != 'refs/heads/main' && github.event_name != 'pull_request' && needs.build_release_apk.result == 'success' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.BUILD_JAVA_VERSION }} | |
distribution: ${{ env.BUILD_JAVA_DIST }} | |
- name: Setup NDK | |
uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r25 | |
- name: Change Gradle wrapper permissions | |
run: chmod +x ./gradlew | |
- name: Install dependencies | |
run: $ATS_SUDO $ATS_APT_UPDATE && $ATS_SUDO $ATS_APT_UPGRADE && $ATS_SUDO $ATS_APT_INSTALL $ATS_APT_DEPS | |
- name: Restore cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Publish snapshots | |
run: ./gradlew publishAllPublicationsToMavenCentralRepository --stacktrace |