# Copyright 2015-2020 The Khronos Group Inc. # SPDX-License-Identifier: Apache-2.0 name: KTX-Software Android CI # Seems no way to avoid duplicating this on logic in each .yml file. # See https://github.com/actions/starter-workflows/issues/245. on: # Trigger the workflow on a pull request, pull_request: push: # And on pushes to main, which will occur when a PR is merged. branches: - main # Also trigger on push of release tags to any branch. Useful # for testing release builds before merging to main. tags: - 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+-*' paths-ignore: - .appveyor.yml - .github/workflows/check-mkvk.yml - .github/workflows/docs.yml - .github/workflows/formatting.yml - .github/workflows/mingw.yml - .github/workflows/publish-pyktx.yml - .github/workflows/windows.yml - .travis.yml - README.md - CODE_OF_CONDUCT.md - CONTRIBUTING.md - LICENSE.md - LICENSES - RELEASE_NOTES.md - REUSE.toml - install-gitconfig* - vcpkg.json - vcpkg-configuration.json # Allow manual trigger workflow_dispatch: workflow_call: jobs: linux: runs-on: ubuntu-latest permissions: contents: write env: GIT_LFS_SKIP_SMUDGE: 1 WERROR: ON steps: - uses: actions/checkout@v4 with: # Fetch all history to make sure tags are # included (used for version creation) fetch-depth: 0 - uses: nttld/setup-ndk@v1 id: setup-ndk with: ndk-version: r25c add-to-path: false - name: Force fetch provoking tag's annotation. # Work around https://github.com/actions/checkout/issues/290. if: github.ref_type == 'tag' run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} - name: Install Ninja run: sudo apt-get install -y ninja-build - name: android_Debug_arm64-v8a run: ./scripts/build_android.sh env: ANDROID_ABI: arm64-v8a ANDROID_NDK: ${{ steps.setup-ndk.outputs.ndk-path }} ASTCENC_ISA: "ASTCENC_ISA_NEON=ON" CONFIGURATION: Debug - name: android_arm64-v8a run: ./scripts/build_android.sh env: ANDROID_ABI: arm64-v8a ANDROID_NDK: ${{ steps.setup-ndk.outputs.ndk-path }} ASTCENC_ISA: "ASTCENC_ISA_NEON=ON" CONFIGURATION: Release # Android ABI x86 is obsolete # and not supported by ARM ASTC encoder # - name: android_x86 # run: ./scripts/build_android.sh # env: # ANDROID_ABI: x86 # ANDROID_NDK: ${{ steps.setup-ndk.outputs.ndk-path }} - name: android_x86_64 run: ./scripts/build_android.sh env: ANDROID_ABI: x86_64 ANDROID_NDK: ${{ steps.setup-ndk.outputs.ndk-path }} - name: get-version id: ktx-version run: | KTX_VERSION=$(cat build-android-arm64-v8a/ktx.version) echo "KTX_VERSION=$KTX_VERSION" >> $GITHUB_ENV # Android artifact # Zips the include and lib dirs installed for each architecture # by the preceding steps and uploads the zip. - name: upload artifact id: upload-artifact uses: actions/upload-artifact@v4 with: name: KTX-Software-${{env.KTX_VERSION}}-Android path: install-android # Make an archive to be deployed. # Although the preceding step made an archive, Actions helpfully :-( # unarchives the files on download. - name: Create zip for deployment. if: github.event_name == 'push' && github.ref_type == 'tag' run: | zip_basename=KTX-Software-${KTX_VERSION}-Android ln -s install-android $zip_basename zip -r $zip_basename.zip $zip_basename sha1sum $zip_basename.zip > $zip_basename.zip.sha1 - name: Upload To Release uses: softprops/action-gh-release@v2 if: github.event_name == 'push' && github.ref_type == 'tag' with: draft: true prerelease: true files: KTX-Software-${{env.KTX_VERSION}}-Android.zip* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}