More attempts #386
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: NDK build | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "v*" | |
| branches: | |
| - 'master' | |
| - 'dev/*' | |
| - 'feat/*' | |
| - 'fix/*' | |
| paths-ignore: | |
| - '**.yml' | |
| - '!.github/workflows/build-ndk.yml' | |
| - '**.json' | |
| - '!qpm.json' | |
| - '!qpm.shared.json' | |
| - '!mod.template.json' | |
| - '**.txt' | |
| - '!CMakeLists.txt' | |
| - '**.ps1' | |
| - '!build.ps1' | |
| - '!createqmod.ps1' | |
| - '**.md' | |
| - '.gitignore' | |
| pull_request: | |
| branches: master | |
| env: | |
| module_id: songcore | |
| qmod_name: SongCore | |
| # LIBCLANG_PATH: /usr/lib/llvm-18/lib/ | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
| steps: | |
| - uses: FranzDiebold/github-env-vars-action@v2 | |
| - uses: actions/checkout@v4 | |
| name: Checkout | |
| with: | |
| submodules: true | |
| lfs: true | |
| # get version from pushed tag | |
| - name: Extract version | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| id: version | |
| run: | | |
| echo "TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_OUTPUT} | |
| echo "VERSION=${GITHUB_REF#refs/tags/v}" >> ${GITHUB_OUTPUT} | |
| # Setup Rust nightly | |
| - name: Setup Rust | |
| run: | | |
| rustup install nightly | |
| rustup target add aarch64-linux-android --toolchain stable | |
| rustup target add aarch64-linux-android --toolchain nightly | |
| cargo install --locked cbindgen | |
| - name: Get dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install -y build-essential libc6-dev libclang-dev clang cmake ninja-build linux-libc-dev llvm libclang1 libclang-rt-dev gcc-multilib | |
| clang --version | |
| # if we don't have a tag, don't do anything special | |
| - name: Setup qpm | |
| if: ${{ !startsWith(github.ref, 'refs/tags/v') }} | |
| uses: Fernthedev/qpm-action@v1 | |
| with: | |
| workflow_token: ${{ secrets.GITHUB_TOKEN }} | |
| restore: true | |
| cache: true | |
| publish: false | |
| resolve_ndk: true | |
| # if we have a tag, we are making a qpm release | |
| - name: Setup qpm for release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: Fernthedev/qpm-action@v1 | |
| with: | |
| workflow_token: ${{ secrets.GITHUB_TOKEN }} | |
| restore: true | |
| cache: true | |
| publish: 'late' | |
| publish_token: ${{ secrets.QPM_KEY }} | |
| version: ${{ steps.version.outputs.VERSION }} | |
| tag: ${{ steps.version.outputs.TAG }} | |
| qpm_release_bin: true | |
| qpm_debug_bin: true | |
| qpm_qmod: ${{ env.qmod_name }}.qmod | |
| resolve_ndk: true | |
| # Run Rust tests | |
| - name: Run Rust Tests | |
| run: | | |
| cd ${GITHUB_WORKSPACE}/song_load_rs | |
| cargo +nightly test | |
| - name: Build & Create Qmod | |
| run: | | |
| cd ${GITHUB_WORKSPACE} | |
| qpm s qmod | |
| - name: Get Library Name | |
| id: libname | |
| run: | | |
| cd ./build/ | |
| pattern="lib${module_id}*.so" | |
| files=( $pattern ) | |
| echo "NAME=${files[0]}" >> ${GITHUB_OUTPUT} | |
| - name: Rename debug artifact | |
| run: mv "./build/debug/${{ steps.libname.outputs.NAME }}" "./build/debug_${{ steps.libname.outputs.NAME }}" | |
| - name: Upload non-debug artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.libname.outputs.NAME }} | |
| path: ./build/${{ steps.libname.outputs.NAME }} | |
| if-no-files-found: error | |
| - name: Upload non-debug artifact to discord | |
| if: "${{ env.WEBHOOK != '' }}" | |
| uses: tsickert/discord-webhook@v3.2.0 | |
| with: | |
| webhook-url: ${{ env.WEBHOOK }} | |
| content: "${{ env.CI_SHA_SHORT }} - `${{ github.event.head_commit.message }}`" | |
| username: "${{ github.repository }}" | |
| avatar-url: "http://github.com/${{ env.CI_ACTOR }}.png" | |
| filename: ./build/${{ steps.libname.outputs.NAME }} | |
| - name: Upload debug artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: debug_${{ steps.libname.outputs.NAME }} | |
| path: ./build/debug_${{ steps.libname.outputs.NAME }} | |
| if-no-files-found: error | |
| - name: Upload debug artifact to discord | |
| if: "${{ env.WEBHOOK != '' }}" | |
| uses: tsickert/discord-webhook@v3.2.0 | |
| with: | |
| webhook-url: ${{ env.WEBHOOK }} | |
| content: "${{ env.CI_SHA_SHORT }} - `${{ github.event.head_commit.message }}`" | |
| username: "${{ github.repository }}" | |
| avatar-url: "http://github.com/${{ env.CI_ACTOR }}.png" | |
| filename: ./build/debug_${{ steps.libname.outputs.NAME }} | |
| - name: Upload qmod artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{env.qmod_name}}.qmod | |
| path: ./${{ env.qmod_name }}.qmod | |
| if-no-files-found: error | |
| - name: Upload qmod artifact to discord | |
| if: "${{ env.WEBHOOK != '' }}" | |
| uses: tsickert/discord-webhook@v3.2.0 | |
| with: | |
| webhook-url: ${{ env.WEBHOOK }} | |
| content: "${{ env.CI_SHA_SHORT }} - `${{ github.event.head_commit.message }}`" | |
| username: "${{ github.repository }}" | |
| avatar-url: "http://github.com/${{ env.CI_ACTOR }}.png" | |
| filename: ./build/${{ steps.libname.outputs.NAME }} | |
| # if we had a tag, we should make a release | |
| - name: Upload release artifacts | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| id: upload_file_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event.inputs.version }} | |
| files: | | |
| ./build/${{ steps.libname.outputs.NAME }} | |
| ./build/debug_${{ steps.libname.outputs.NAME }} | |
| ./${{ env.qmod_name }}.qmod | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Notify webhook | |
| if: ${{ env.WEBHOOK != '' && startsWith(github.ref, 'refs/tags/v') }} | |
| uses: tsickert/discord-webhook@v3.2.0 | |
| with: | |
| webhook-url: ${{ env.WEBHOOK }} | |
| content: "New Release published: `${{ steps.get_tag_version.outputs.TAG }}`" | |
| username: "${{ github.repository }}" | |
| avatar-url: "http://github.com/${{ env.CI_ACTOR }}.png" |