|
| 1 | +name: android build scripts |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + branches: |
| 6 | + - development |
| 7 | + - main |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - development |
| 11 | + - main |
| 12 | + paths: |
| 13 | + - '.github/workflows/android-build-scripts.yml' |
| 14 | + - 'android/**' |
| 15 | + - '!android/README.md' |
| 16 | + - 'scripts/**' |
| 17 | + - 'tools/**' |
| 18 | + - 'android.sh' |
| 19 | + |
| 20 | +jobs: |
| 21 | + build-main-on-linux: |
| 22 | + name: android main on linux |
| 23 | + runs-on: ubuntu-22.04 |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + ndk-version: [ 'r22b-linux-x86_64', 'r23b-linux', 'r24-linux', 'r25b-linux' ] |
| 27 | + defaults: |
| 28 | + run: |
| 29 | + shell: bash |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + - name: set up adopt jdk 17 |
| 33 | + uses: actions/setup-java@v3 |
| 34 | + with: |
| 35 | + distribution: 'adopt' |
| 36 | + java-version: '17' |
| 37 | + - name: prerequisites |
| 38 | + run: ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --uninstall "cmake;3.10.2.4988404" "cmake;3.18.1" |
| 39 | + - name: set up android ndk |
| 40 | + run: | |
| 41 | + curl -s "https://dl.google.com/android/repository/android-ndk-${{ matrix.ndk-version }}.zip" -o ndk.zip |
| 42 | + unzip -q -o ndk.zip -d .ndk |
| 43 | + echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV |
| 44 | + - name: run the build script |
| 45 | + run: ./android.sh -d --enable-android-media-codec --enable-android-zlib --disable-arm-v7a |
| 46 | + - name: Upload Build Artifact |
| 47 | + uses: actions/upload-artifact@v4 |
| 48 | + with: |
| 49 | + name: build-main-linux-${{ matrix.ndk-version }} |
| 50 | + path: | |
| 51 | + prebuilt/ |
| 52 | + build.log |
| 53 | + - name: print ffbuild logs |
| 54 | + if: ${{ failure() }} |
| 55 | + run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' |
| 56 | + |
| 57 | + build-lts-on-linux: |
| 58 | + name: android lts on linux |
| 59 | + runs-on: ubuntu-22.04 |
| 60 | + strategy: |
| 61 | + matrix: |
| 62 | + ndk-version: [ 'r22b-linux-x86_64', 'r23b-linux' ] |
| 63 | + defaults: |
| 64 | + run: |
| 65 | + shell: bash |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v4 |
| 68 | + - name: set up adopt jdk 17 |
| 69 | + uses: actions/setup-java@v3 |
| 70 | + with: |
| 71 | + distribution: 'adopt' |
| 72 | + java-version: '17' |
| 73 | + - name: prerequisites |
| 74 | + run: ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --uninstall "cmake;3.10.2.4988404" "cmake;3.18.1" |
| 75 | + - name: set up android ndk |
| 76 | + run: | |
| 77 | + curl -s "https://dl.google.com/android/repository/android-ndk-${{ matrix.ndk-version }}.zip" -o ndk.zip |
| 78 | + unzip -q -o ndk.zip -d .ndk |
| 79 | + echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV |
| 80 | + - name: run the build script |
| 81 | + run: ./android.sh -d --lts --enable-android-media-codec --enable-android-zlib |
| 82 | + - name: Upload Build Artifact |
| 83 | + uses: actions/upload-artifact@v4 |
| 84 | + with: |
| 85 | + name: build-lts-linux-${{ matrix.ndk-version }} |
| 86 | + path: | |
| 87 | + prebuilt/ |
| 88 | + build.log |
| 89 | + - name: print ffbuild logs |
| 90 | + if: ${{ failure() }} |
| 91 | + run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' |
| 92 | + |
| 93 | + build-main-without-ffmpeg-kit-protocols-on-linux: |
| 94 | + name: build without ffmpeg-kit protocols |
| 95 | + runs-on: ubuntu-22.04 |
| 96 | + strategy: |
| 97 | + matrix: |
| 98 | + ndk-version: [ 'r22b-linux-x86_64' ] |
| 99 | + defaults: |
| 100 | + run: |
| 101 | + shell: bash |
| 102 | + steps: |
| 103 | + - uses: actions/checkout@v4 |
| 104 | + - name: set up adopt jdk 17 |
| 105 | + uses: actions/setup-java@v3 |
| 106 | + with: |
| 107 | + distribution: 'adopt' |
| 108 | + java-version: '17' |
| 109 | + - name: prerequisites |
| 110 | + run: ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --uninstall "cmake;3.10.2.4988404" "cmake;3.18.1" |
| 111 | + - name: set up android ndk |
| 112 | + run: | |
| 113 | + curl -s "https://dl.google.com/android/repository/android-ndk-${{ matrix.ndk-version }}.zip" -o ndk.zip |
| 114 | + unzip -q -o ndk.zip -d .ndk |
| 115 | + echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV |
| 116 | + - name: run the build script |
| 117 | + run: ./android.sh --no-ffmpeg-kit-protocols --disable-x86 --disable-x86-64 --disable-arm-v7a --disable-arm-v7a-neon |
| 118 | + - name: Upload Build Artifact |
| 119 | + uses: actions/upload-artifact@v4 |
| 120 | + with: |
| 121 | + name: build-no-protocols-linux-${{ matrix.ndk-version }} |
| 122 | + path: | |
| 123 | + prebuilt/ |
| 124 | + build.log |
| 125 | + - name: print ffbuild logs |
| 126 | + if: ${{ failure() }} |
| 127 | + run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' |
| 128 | + |
| 129 | + # macOS jobs remain unchanged |
| 130 | + build-main-on-macos: |
| 131 | + name: android main on macos |
| 132 | + runs-on: macos-12 |
| 133 | + strategy: |
| 134 | + matrix: |
| 135 | + ndk-version: [ 'r22b-darwin-x86_64', 'r23b-darwin', 'r24-darwin', 'r25b-darwin' ] |
| 136 | + defaults: |
| 137 | + run: |
| 138 | + shell: bash |
| 139 | + steps: |
| 140 | + - uses: actions/checkout@v4 |
| 141 | + - name: set up adopt jdk 17 |
| 142 | + uses: actions/setup-java@v3 |
| 143 | + with: |
| 144 | + distribution: 'adopt' |
| 145 | + java-version: '17' |
| 146 | + - name: set up android ndk |
| 147 | + run: | |
| 148 | + curl -s "https://dl.google.com/android/repository/android-ndk-${{ matrix.ndk-version }}.zip" -o ndk.zip |
| 149 | + unzip -q -o ndk.zip -d .ndk |
| 150 | + echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV |
| 151 | + - name: run the build script |
| 152 | + run: ./android.sh -d --enable-android-media-codec --enable-android-zlib --disable-arm-v7a |
| 153 | + - name: print build logs |
| 154 | + if: ${{ always() }} |
| 155 | + run: cat build.log |
| 156 | + - name: print ffbuild logs |
| 157 | + if: ${{ failure() }} |
| 158 | + run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' |
| 159 | + |
| 160 | + build-lts-on-macos: |
| 161 | + name: android lts on macos |
| 162 | + runs-on: macos-12 |
| 163 | + strategy: |
| 164 | + matrix: |
| 165 | + ndk-version: [ 'r22b-darwin-x86_64', 'r23b-darwin' ] |
| 166 | + defaults: |
| 167 | + run: |
| 168 | + shell: bash |
| 169 | + steps: |
| 170 | + - uses: actions/checkout@v4 |
| 171 | + - name: set up adopt jdk 17 |
| 172 | + uses: actions/setup-java@v3 |
| 173 | + with: |
| 174 | + distribution: 'adopt' |
| 175 | + java-version: '17' |
| 176 | + - name: set up android ndk |
| 177 | + run: | |
| 178 | + curl -s "https://dl.google.com/android/repository/android-ndk-${{ matrix.ndk-version }}.zip" -o ndk.zip |
| 179 | + unzip -q -o ndk.zip -d .ndk |
| 180 | + echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV |
| 181 | + - name: run the build script |
| 182 | + run: ./android.sh -d --lts --enable-android-media-codec --enable-android-zlib |
| 183 | + - name: print build logs |
| 184 | + if: ${{ always() }} |
| 185 | + run: cat build.log |
| 186 | + - name: print ffbuild logs |
| 187 | + if: ${{ failure() }} |
| 188 | + run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log' |
| 189 | + |
| 190 | + # NEW JOB TO CREATE THE RELEASE |
| 191 | + create-release: |
| 192 | + name: Create GitHub Release |
| 193 | + runs-on: ubuntu-latest |
| 194 | + # This job depends on all Linux build jobs finishing successfully |
| 195 | + needs: |
| 196 | + - build-main-on-linux |
| 197 | + - build-lts-on-linux |
| 198 | + - build-main-without-ffmpeg-kit-protocols-on-linux |
| 199 | + # Only run for manual triggers on the main branch |
| 200 | + if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' |
| 201 | + permissions: |
| 202 | + contents: write # This permission is required to create a release |
| 203 | + steps: |
| 204 | + - name: Download all build artifacts |
| 205 | + uses: actions/download-artifact@v4 |
| 206 | + with: |
| 207 | + path: artifacts/ |
| 208 | + |
| 209 | + - name: Package artifacts into a single archive |
| 210 | + run: tar -czvf linux-builds-${{ github.run_number }}.tar.gz -C artifacts . |
| 211 | + |
| 212 | + - name: Create Release and Upload Artifact |
| 213 | + uses: softprops/action-gh-release@v2 |
| 214 | + with: |
| 215 | + name: "Android Linux Builds ${{ github.run_number }}" |
| 216 | + tag_name: "v${{ github.run_number }}" |
| 217 | + body: "Automated release containing all Linux build artifacts." |
| 218 | + files: "linux-builds-${{ github.run_number }}.tar.gz" |
0 commit comments