Build unienc #48
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: Build unienc | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| build-config: | |
| required: true | |
| default: 'release' | |
| type: choice | |
| options: | |
| - debug | |
| - release | |
| env: | |
| _RUST_BUILD_CONFIG: ${{ inputs.build-config == 'debug' && 'debug' || 'release' }} | |
| jobs: | |
| build-windows: | |
| name: Build unienc (Windows) | |
| runs-on: windows-2022 | |
| strategy: | |
| matrix: | |
| arch: [x86_64] | |
| timeout-minutes: 30 | |
| defaults: | |
| run: | |
| working-directory: InstantReplay.Externals/unienc/crates/unienc_c | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'true' | |
| - run: rustup default stable | |
| - run: rustup target add ${{ matrix.arch }}-pc-windows-msvc | |
| - run: cargo build --target ${{ matrix.arch }}-pc-windows-msvc --profile ${{ env._RUST_BUILD_CONFIG == 'debug' && 'dev' || env._RUST_BUILD_CONFIG }} | |
| - run: Move-Item -Path unienc_c.dll -Destination libunienc_c.dll -Force | |
| working-directory: InstantReplay.Externals/unienc/target/${{ matrix.arch }}-pc-windows-msvc/${{ env._RUST_BUILD_CONFIG }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.arch }}-pc-windows | |
| path: InstantReplay.Externals/unienc/target/${{ matrix.arch }}-pc-windows-msvc/${{ env._RUST_BUILD_CONFIG }}/libunienc_c.dll | |
| retention-days: 1 | |
| build-android: | |
| name: Build unienc (Android) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| triple: [aarch64-linux-android, x86_64-linux-android] | |
| timeout-minutes: 30 | |
| defaults: | |
| run: | |
| working-directory: InstantReplay.Externals/unienc/crates/unienc_c | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'true' | |
| - run: rustup default stable | |
| - run: rustup target add ${{ matrix.triple }} | |
| - run: sudo apt update && sudo apt install gcc-multilib | |
| - run: echo "ANDROID_NDK_HOME=$(echo $ANDROID_NDK_LATEST_HOME)" >> $GITHUB_ENV | |
| - run: cargo install cargo-ndk | |
| - run: cargo ndk -t ${{ matrix.triple }} --platform 26 build --profile ${{ env._RUST_BUILD_CONFIG == 'debug' && 'dev' || env._RUST_BUILD_CONFIG }} -F unity | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.triple }} | |
| path: InstantReplay.Externals/unienc/target/${{ matrix.triple }}/${{ env._RUST_BUILD_CONFIG }}/libunienc_c.so | |
| retention-days: 1 | |
| build-macos: | |
| name: Build unienc (macOS) | |
| runs-on: macos-15 | |
| strategy: | |
| matrix: | |
| arch: [aarch64, x86_64] | |
| timeout-minutes: 30 | |
| defaults: | |
| run: | |
| working-directory: InstantReplay.Externals/unienc/crates/unienc_c | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'true' | |
| - run: rustup default stable | |
| - run: rustup target add ${{ matrix.arch }}-apple-darwin | |
| - run: cargo build --target ${{ matrix.arch }}-apple-darwin --profile ${{ env._RUST_BUILD_CONFIG == 'debug' && 'dev' || env._RUST_BUILD_CONFIG }} -F unity | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.arch }}-apple-darwin | |
| path: InstantReplay.Externals/unienc/target/${{ matrix.arch }}-apple-darwin/${{ env._RUST_BUILD_CONFIG }}/libunienc_c.dylib | |
| retention-days: 1 | |
| build-ios: | |
| name: Build unienc (iOS) | |
| runs-on: macos-15 | |
| strategy: | |
| matrix: | |
| arch: [aarch64] | |
| timeout-minutes: 30 | |
| defaults: | |
| run: | |
| working-directory: InstantReplay.Externals/unienc/crates/unienc_c | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'true' | |
| - run: rustup default stable | |
| - run: rustup target add ${{ matrix.arch }}-apple-ios | |
| - run: cargo build --target ${{ matrix.arch }}-apple-ios --profile ${{ env._RUST_BUILD_CONFIG == 'debug' && 'dev' || env._RUST_BUILD_CONFIG }} -F unity | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.arch }}-apple-ios | |
| path: InstantReplay.Externals/unienc/target/${{ matrix.arch }}-apple-ios/${{ env._RUST_BUILD_CONFIG }}/libunienc_c.a | |
| retention-days: 1 | |
| build-linux: | |
| name: Build unienc (Linux) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| arch: [x86_64] | |
| timeout-minutes: 30 | |
| defaults: | |
| run: | |
| working-directory: InstantReplay.Externals/unienc/crates/unienc_c | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'true' | |
| - run: rustup default stable | |
| - run: rustup target add ${{ matrix.arch }}-unknown-linux-gnu | |
| - run: sudo apt update && sudo apt install gcc-multilib | |
| - run: cargo build --target ${{ matrix.arch }}-unknown-linux-gnu --profile ${{ env._RUST_BUILD_CONFIG == 'debug' && 'dev' || env._RUST_BUILD_CONFIG }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.arch }}-unknown-linux | |
| path: InstantReplay.Externals/unienc/target/${{ matrix.arch }}-unknown-linux-gnu/${{ env._RUST_BUILD_CONFIG }}/libunienc_c.so | |
| retention-days: 1 | |
| update-unity-native: | |
| name: Push unienc native libraries | |
| needs: [build-windows, build-android, build-ios, build-macos, build-linux] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'true' | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: ./Packages/jp.co.cyberagent.instant-replay/UniEnc/Plugins/ | |
| - run: | | |
| cargo install cargo-about | |
| cargo about generate about.hbs > ../../THIRD-PARTY-NOTICES.md | |
| working-directory: InstantReplay.Externals/unienc | |
| - run: | | |
| git add ./Packages/jp.co.cyberagent.instant-replay/UniEnc/Plugins | |
| git add ./THIRD-PARTY-NOTICES.md | |
| git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git commit -m "Update unienc native binaries" | |
| git push origin ${{ github.ref_name }} | |
| permissions: | |
| contents: write |