|
| 1 | +name: download_asset |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: write |
| 5 | + |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + branches: [ main ] |
| 9 | + paths: |
| 10 | + - .github/workflows/download_asset.yaml |
| 11 | + - pkgs/native_assets_cli/example/build/download_asset/ |
| 12 | + push: |
| 13 | + tags: |
| 14 | + - 'download_asset-prebuild-assets-*' |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + os: [ubuntu, macos, windows] |
| 23 | + |
| 24 | + runs-on: ${{ matrix.os }}-latest |
| 25 | + |
| 26 | + defaults: |
| 27 | + run: |
| 28 | + working-directory: pkgs/native_assets_cli/example/build/download_asset/ |
| 29 | + |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 32 | + |
| 33 | + - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 |
| 34 | + with: |
| 35 | + sdk: stable |
| 36 | + |
| 37 | + - uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410 |
| 38 | + with: |
| 39 | + ndk-version: r27 |
| 40 | + if: ${{ matrix.os == 'ubuntu' }} # Only build on one host. |
| 41 | + |
| 42 | + - name: Install native toolchains |
| 43 | + run: sudo apt-get update && sudo apt-get install clang-15 gcc-i686-linux-gnu gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf gcc-riscv64-linux-gnu |
| 44 | + if: ${{ matrix.os == 'ubuntu' }} |
| 45 | + |
| 46 | + - run: dart pub get |
| 47 | + |
| 48 | + - name: Build Linux host |
| 49 | + if: matrix.os == 'ubuntu' |
| 50 | + run: | |
| 51 | + dart tool/build.dart -oandroid -aarm |
| 52 | + dart tool/build.dart -oandroid -aarm64 |
| 53 | + dart tool/build.dart -oandroid -aia32 |
| 54 | + dart tool/build.dart -oandroid -ariscv64 |
| 55 | + dart tool/build.dart -oandroid -ax64 |
| 56 | + dart tool/build.dart -olinux -aarm |
| 57 | + dart tool/build.dart -olinux -aarm64 |
| 58 | + dart tool/build.dart -olinux -aia32 |
| 59 | + dart tool/build.dart -olinux -ariscv64 |
| 60 | + dart tool/build.dart -olinux -ax64 |
| 61 | + |
| 62 | + - name: Build MacOS host |
| 63 | + if: matrix.os == 'macos' |
| 64 | + run: | |
| 65 | + dart tool/build.dart -omacos -aarm64 |
| 66 | + dart tool/build.dart -omacos -ax64 |
| 67 | + dart tool/build.dart -oios -iiphoneos -aarm64 |
| 68 | + dart tool/build.dart -oios -iiphonesimulator -aarm64 |
| 69 | + dart tool/build.dart -oios -iiphonesimulator -ax64 |
| 70 | + |
| 71 | + - name: Build Windows host |
| 72 | + if: matrix.os == 'windows' |
| 73 | + run: | |
| 74 | + dart tool/build.dart -owindows -aarm |
| 75 | + dart tool/build.dart -owindows -aarm64 |
| 76 | + dart tool/build.dart -owindows -aia32 |
| 77 | + dart tool/build.dart -owindows -ax64 |
| 78 | + |
| 79 | + - name: Upload artifacts |
| 80 | + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 |
| 81 | + with: |
| 82 | + name: ${{ matrix.os }}-host |
| 83 | + path: | |
| 84 | + pkgs/native_assets_cli/example/build/download_asset/.dart_tool/download_asset/**/*.dll |
| 85 | + pkgs/native_assets_cli/example/build/download_asset/.dart_tool/download_asset/**/*.dylib |
| 86 | + pkgs/native_assets_cli/example/build/download_asset/.dart_tool/download_asset/**/*.so |
| 87 | + if-no-files-found: error |
| 88 | + |
| 89 | + check: |
| 90 | + needs: build |
| 91 | + runs-on: ubuntu-latest |
| 92 | + |
| 93 | + defaults: |
| 94 | + run: |
| 95 | + working-directory: pkgs/native_assets_cli/example/build/download_asset/ |
| 96 | + |
| 97 | + steps: |
| 98 | + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 |
| 99 | + with: |
| 100 | + submodules: true |
| 101 | + |
| 102 | + - name: Download assets |
| 103 | + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 |
| 104 | + with: |
| 105 | + merge-multiple: true |
| 106 | + path: pkgs/native_assets_cli/example/build/download_asset/.dart_tool/download_asset/ |
| 107 | + |
| 108 | + - name: Display structure of downloaded assets |
| 109 | + run: ls -R .dart_tool/download_asset/ |
| 110 | + |
| 111 | + - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 |
| 112 | + with: |
| 113 | + sdk: stable |
| 114 | + |
| 115 | + - run: dart pub get |
| 116 | + |
| 117 | + - name: Check hashes of released artifacts |
| 118 | + run: | |
| 119 | + dart tool/generate_asset_hashes.dart |
| 120 | + git diff --exit-code |
| 121 | +
|
| 122 | + - name: Release |
| 123 | + uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 |
| 124 | + if: startsWith(github.ref, 'refs/tags/download_asset-prebuild-assets') |
| 125 | + with: |
| 126 | + files: '.dart_tool/download_asset/**' |
| 127 | + fail_on_unmatched_files: true |
0 commit comments