|
| 1 | +# Copyright (c) 2023 The Bitcoin Core developers |
| 2 | +# Distributed under the MIT software license, see the accompanying |
| 3 | +# file COPYING or http://www.opensource.org/licenses/mit-license.php. |
| 4 | + |
| 5 | +name: Artifacts |
| 6 | +on: |
| 7 | + # See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request. |
| 8 | + pull_request: |
| 9 | + # See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push. |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - '**' |
| 13 | + tags-ignore: |
| 14 | + - '**' |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ${{ github.workflow }}${{ github.event_name != 'pull_request' && github.run_id || github.ref }} |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +jobs: |
| 21 | + cross-build: |
| 22 | + name: ${{ matrix.host.name }} |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + strategy: |
| 26 | + fail-fast: false |
| 27 | + matrix: |
| 28 | + host: |
| 29 | + - name: 'macOS arm64' |
| 30 | + packages: '' |
| 31 | + triplet: 'arm64-apple-darwin' |
| 32 | + compiler: 'clang' |
| 33 | + configure_options: '' |
| 34 | + gui_exe: 'bitcoin-qt' |
| 35 | + artifact: 'unsecure_macos_apple_silicon_gui' |
| 36 | + - name: 'macOS x86_64' |
| 37 | + packages: '' |
| 38 | + triplet: 'x86_64-apple-darwin' |
| 39 | + compiler: 'clang' |
| 40 | + configure_options: '' |
| 41 | + gui_exe: 'bitcoin-qt' |
| 42 | + artifact: 'unsecure_macos_intel_gui' |
| 43 | + - name: 'Windows' |
| 44 | + packages: 'g++-mingw-w64-x86-64-posix' |
| 45 | + triplet: 'x86_64-w64-mingw32' |
| 46 | + compiler: 'x86_64-w64-mingw32-g++-posix' |
| 47 | + configure_options: 'CXXFLAGS=-Wno-return-type' |
| 48 | + gui_exe: 'bitcoin-qt.exe' |
| 49 | + artifact: 'unsecure_windows_gui' |
| 50 | + |
| 51 | + env: |
| 52 | + XCODE_VERSION: '12.2' |
| 53 | + XCODE_BUILD_ID: '12B45b' |
| 54 | + CCACHE_MAXSIZE: '30M' |
| 55 | + |
| 56 | + steps: |
| 57 | + - name: Checkout |
| 58 | + uses: actions/checkout@v4 |
| 59 | + |
| 60 | + - name: Install dependency packages |
| 61 | + run: | |
| 62 | + sudo apt-get update |
| 63 | + sudo apt-get install ccache ${{ matrix.host.packages }} |
| 64 | + echo "CCACHE_DIR=${{ runner.temp }}/ccache" >> "$GITHUB_ENV" |
| 65 | +
|
| 66 | + - name: Depends fingerprint |
| 67 | + id: depends_fingerprint |
| 68 | + run: | |
| 69 | + if ${{ !endsWith(matrix.host.triplet, '-apple-darwin') }}; then ${{ matrix.host.compiler }} -v 2>&1 | tee depends/compiler-version; fi |
| 70 | + if ${{ endsWith(matrix.host.triplet, '-apple-darwin') }}; then echo ${{ env.XCODE_VERSION }} ${{ env.XCODE_BUILD_ID }} > depends/sdk-version; fi |
| 71 | + echo "hash=${{ hashFiles('./depends/**') }}" >> "$GITHUB_OUTPUT" |
| 72 | +
|
| 73 | + - name: Depends cache |
| 74 | + id: depends_cache |
| 75 | + uses: actions/cache@v3 |
| 76 | + with: |
| 77 | + path: | |
| 78 | + depends/built |
| 79 | + depends/SDKs |
| 80 | + key: ${{ matrix.host.triplet }}-depends-${{ steps.depends_fingerprint.outputs.hash }} |
| 81 | + |
| 82 | + - name: Fetch SDK |
| 83 | + if: endsWith(matrix.host.triplet, '-apple-darwin') && steps.depends_cache.outputs.cache-hit != 'true' |
| 84 | + run: | |
| 85 | + curl --location --fail https://bitcoincore.org/depends-sources/sdks/Xcode-${{ env.XCODE_VERSION }}-${{ env.XCODE_BUILD_ID }}-extracted-SDK-with-libcxx-headers.tar.gz -o sdk.tar.gz |
| 86 | + mkdir depends/SDKs |
| 87 | + tar -C depends/SDKs -xf sdk.tar.gz |
| 88 | +
|
| 89 | + - name: Build depends |
| 90 | + run: | |
| 91 | + patch -p1 -i ci/hosts_darwin_mk.patch |
| 92 | + cd depends |
| 93 | + make -j$(nproc) HOST=${{ matrix.host.triplet }} LOG=1 |
| 94 | +
|
| 95 | + - name: Restore Ccache cache |
| 96 | + uses: actions/cache/restore@v3 |
| 97 | + id: ccache-cache |
| 98 | + with: |
| 99 | + path: ${{ env.CCACHE_DIR }} |
| 100 | + key: ${{ matrix.host.triplet }}-ccache-${{ github.run_id }} |
| 101 | + restore-keys: ${{ matrix.host.triplet }}-ccache- |
| 102 | + |
| 103 | + - name: Configure |
| 104 | + run: | |
| 105 | + ./autogen.sh |
| 106 | + ./configure CONFIG_SITE=${{ github.workspace }}/depends/${{ matrix.host.triplet }}/share/config.site --disable-dependency-tracking --enable-werror ${{ matrix.host.configure_options }} || (cat config.log; false) |
| 107 | +
|
| 108 | + - name: Build GUI |
| 109 | + run: | |
| 110 | + ccache --zero-stats |
| 111 | + make -j$(nproc) src/qt/${{ matrix.host.gui_exe }} |
| 112 | + ccache --version | head -n 1 && ccache --show-stats |
| 113 | +
|
| 114 | + - name: Save Ccache cache |
| 115 | + uses: actions/cache/save@v3 |
| 116 | + if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true' |
| 117 | + with: |
| 118 | + path: ${{ env.CCACHE_DIR }} |
| 119 | + key: ${{ matrix.host.triplet }}-ccache-${{ github.run_id }} |
| 120 | + |
| 121 | + - uses: actions/upload-artifact@v3 |
| 122 | + with: |
| 123 | + name: ${{ matrix.host.artifact }} |
| 124 | + path: src/qt/${{ matrix.host.gui_exe }} |
| 125 | + |
| 126 | + android: |
| 127 | + name: ${{ matrix.host.name }} |
| 128 | + runs-on: ubuntu-latest |
| 129 | + container: ubuntu:22.04 |
| 130 | + |
| 131 | + strategy: |
| 132 | + fail-fast: false |
| 133 | + matrix: |
| 134 | + host: |
| 135 | + - name: 'Android ARM 64-bit APK' |
| 136 | + triplet: 'aarch64-linux-android' |
| 137 | + artifact: 'unsecure_android_arm64' |
| 138 | + - name: 'Android ARM 32-bit APK' |
| 139 | + triplet: 'armv7a-linux-android' |
| 140 | + artifact: 'unsecure_android_arm32' |
| 141 | + - name: 'Android x86_64 APK' |
| 142 | + triplet: 'x86_64-linux-android' |
| 143 | + artifact: 'unsecure_android_x86_64' |
| 144 | + |
| 145 | + env: |
| 146 | + ANDROID_HOME: '/tmp/Android' |
| 147 | + ANDROID_API_LEVEL: '28' |
| 148 | + ANDROID_BUILD_TOOLS_VERSION: '28.0.3' |
| 149 | + ANDROID_NDK_VERSION: '23.2.8568313' |
| 150 | + ANDROID_TOOLS_URL: 'https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip' |
| 151 | + |
| 152 | + steps: |
| 153 | + - name: Checkout |
| 154 | + uses: actions/checkout@v4 |
| 155 | + |
| 156 | + - name: Install dependency packages |
| 157 | + run: | |
| 158 | + apt-get update |
| 159 | + apt-get install --no-install-recommends -y autoconf automake ca-certificates curl g++ gradle lbzip2 libtool make openjdk-8-jdk patch pkg-config python3 unzip xz-utils |
| 160 | +
|
| 161 | + - name: Install Android tools |
| 162 | + run: | |
| 163 | + curl --location --fail ${{ env.ANDROID_TOOLS_URL }} -o android-tools.zip |
| 164 | + mkdir -p ${{ env.ANDROID_HOME }} |
| 165 | + unzip -o android-tools.zip -d ${{ env.ANDROID_HOME }} |
| 166 | + yes | ${{ env.ANDROID_HOME }}/cmdline-tools/bin/sdkmanager --sdk_root=${{ env.ANDROID_HOME }} --install "build-tools;${{ env.ANDROID_BUILD_TOOLS_VERSION }}" "platform-tools" "platforms;android-31" "platforms;android-${{ env.ANDROID_API_LEVEL }}" "ndk;${{ env.ANDROID_NDK_VERSION }}" |
| 167 | +
|
| 168 | + - name: Build depends |
| 169 | + run: | |
| 170 | + cd depends |
| 171 | + make -j$(nproc) HOST=${{ matrix.host.triplet }} ANDROID_SDK=${{ env.ANDROID_HOME }} ANDROID_NDK=${{ env.ANDROID_HOME }}/ndk/${{ env.ANDROID_NDK_VERSION }} ANDROID_API_LEVEL=${{ env.ANDROID_API_LEVEL }} ANDROID_TOOLCHAIN_BIN=${{ env.ANDROID_HOME }}/ndk/${{ env.ANDROID_NDK_VERSION }}/toolchains/llvm/prebuilt/linux-x86_64/bin |
| 172 | +
|
| 173 | + - name: Configure |
| 174 | + run: | |
| 175 | + ./autogen.sh |
| 176 | + ./configure CONFIG_SITE=$PWD/depends/${{ matrix.host.triplet }}/share/config.site --disable-dependency-tracking --disable-tests --disable-bench --disable-fuzz-binary || (cat config.log; false) |
| 177 | +
|
| 178 | + - name: Build GUI |
| 179 | + run: | |
| 180 | + make -j$(nproc) -C src/qt bitcoin-qt |
| 181 | +
|
| 182 | + - name: Build APK |
| 183 | + run: | |
| 184 | + make -j$(nproc) -C src/qt apk |
| 185 | +
|
| 186 | + - uses: actions/upload-artifact@v3 |
| 187 | + with: |
| 188 | + name: ${{ matrix.host.artifact }} |
| 189 | + path: src/qt/android/build/outputs/apk/debug/android-debug.apk |
0 commit comments