|
| 1 | +name: Build and Package HDWallet |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - 'v[0-9]+.[0-9]+.[0-9]+' |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + os: [ubuntu-latest, windows-latest] |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout repository |
| 18 | + uses: actions/checkout@v3 |
| 19 | + |
| 20 | + - name: Setup Python |
| 21 | + uses: actions/setup-python@v4 |
| 22 | + with: |
| 23 | + python-version: '3.10' |
| 24 | + |
| 25 | + - name: Ensure Dist Directory Exists |
| 26 | + run: | |
| 27 | + mkdir -p dist |
| 28 | + echo "Dist directory ensured." |
| 29 | +
|
| 30 | + # - name: Install OpenSSL (macOS) |
| 31 | + # if: matrix.os == 'macos-15' || matrix.os == 'macos-latest' |
| 32 | + # run: | |
| 33 | + # brew install openssl |
| 34 | + # $(brew --prefix openssl)/bin/openssl version |
| 35 | + # sudo mkdir -p /usr/local/include /usr/local/lib |
| 36 | + # sudo ln -sf $(brew --prefix openssl)/include/openssl /usr/local/include/openssl |
| 37 | + # sudo ln -sf $(brew --prefix openssl)/lib/libcrypto.dylib /usr/local/lib/libcrypto.dylib |
| 38 | + # sudo ln -sf $(brew --prefix openssl)/lib/libssl.dylib /usr/local/lib/libssl.dylib |
| 39 | + # echo "LDFLAGS=-L$(brew --prefix openssl)/lib" >> $GITHUB_ENV |
| 40 | + # echo "CPPFLAGS=-I$(brew --prefix openssl)/include" >> $GITHUB_ENV |
| 41 | + # echo "PKG_CONFIG_PATH=$(brew --prefix openssl)/lib/pkgconfig" >> $GITHUB_ENV |
| 42 | + # echo "PATH=$(brew --prefix openssl)/bin:$PATH" >> $GITHUB_ENV |
| 43 | + |
| 44 | + - name: Install dependencies |
| 45 | + run: | |
| 46 | + python -m pip install --upgrade pip |
| 47 | + pip install -r requirements.txt cx_Freeze |
| 48 | +
|
| 49 | + # - name: Build macOS App for Intel |
| 50 | + # if: matrix.os == 'macos-15' |
| 51 | + # run: | |
| 52 | + # echo "Starting Intel build using x86_64 architecture..." |
| 53 | + # arch -x86_64 python setup.py bdist_dmg || exit 1 |
| 54 | + |
| 55 | + # echo "Checking for .dmg and .app files after Intel build:" |
| 56 | + # find . -name "*.dmg" || echo "No .dmg file found after Intel build" |
| 57 | + # find . -name "*.app" || echo "No .app file found after Intel build" |
| 58 | + |
| 59 | + # # Move .dmg files |
| 60 | + # if find build -name "*.dmg" 1> /dev/null 2>&1; then |
| 61 | + # mkdir -p dist |
| 62 | + # mv build/*.dmg dist/ |
| 63 | + # elif find dist -name "*.dmg" 1> /dev/null 2>&1; then |
| 64 | + # mv dist/*.dmg dist/ |
| 65 | + # else |
| 66 | + # echo "No .dmg file found for Intel build" |
| 67 | + # exit 1 |
| 68 | + # fi |
| 69 | + |
| 70 | + # # Move .app files if they exist |
| 71 | + # if find build -name "*.app" 1> /dev/null 2>&1; then |
| 72 | + # mkdir -p dist |
| 73 | + # mv build/*.app dist/ |
| 74 | + # elif find dist -name "*.app" 1> /dev/null 2>&1; then |
| 75 | + # mv dist/*.app dist/ |
| 76 | + # else |
| 77 | + # echo "No .app file found for Intel build, skipping." |
| 78 | + # fi |
| 79 | + |
| 80 | + # echo "Intel build completed successfully. Contents of dist directory:" |
| 81 | + # ls -R dist || echo "dist directory does not exist" |
| 82 | + |
| 83 | + |
| 84 | + # - name: Build macOS App for ARM64 |
| 85 | + # if: matrix.os == 'macos-latest' |
| 86 | + # run: | |
| 87 | + # echo "Starting ARM64 build using arm64 architecture..." |
| 88 | + # arch -arm64 python setup.py bdist_dmg || exit 1 |
| 89 | + |
| 90 | + # echo "Checking for .dmg and .app files after ARM64 build:" |
| 91 | + # find . -name "*.dmg" || echo "No .dmg file found after ARM64 build" |
| 92 | + # find . -name "*.app" || echo "No .app file found after ARM64 build" |
| 93 | + |
| 94 | + # # Move .dmg files |
| 95 | + # if find build -name "*.dmg" 1> /dev/null 2>&1; then |
| 96 | + # mkdir -p dist |
| 97 | + # mv build/*.dmg dist/ |
| 98 | + # else |
| 99 | + # echo "No .dmg file found for ARM64 build" |
| 100 | + # exit 1 |
| 101 | + # fi |
| 102 | + |
| 103 | + # # Move .app files if they exist |
| 104 | + # if find build -name "*.app" 1> /dev/null 2>&1; then |
| 105 | + # mkdir -p dist |
| 106 | + # mv build/*.app dist/ |
| 107 | + # else |
| 108 | + # echo "No .app file found for ARM64 build, skipping." |
| 109 | + # fi |
| 110 | + |
| 111 | + # echo "ARM64 build completed successfully. Contents of dist directory:" |
| 112 | + # ls -R dist || echo "dist directory does not exist" |
| 113 | + |
| 114 | + |
| 115 | + - name: Build .deb Package for Ubuntu |
| 116 | + if: startsWith(matrix.os, 'ubuntu-latest') |
| 117 | + run: | |
| 118 | + python build_deb.py |
| 119 | + if ls dist/*.deb 1> /dev/null 2>&1; then |
| 120 | + echo "Deb package created successfully" |
| 121 | + else |
| 122 | + echo "No .deb file found in dist directory" |
| 123 | + fi |
| 124 | +
|
| 125 | + - name: Build Windows Executable |
| 126 | + if: matrix.os == 'windows-latest' |
| 127 | + run: | |
| 128 | + python setup.py build |
| 129 | + python setup.py bdist_msi |
| 130 | + if (Test-Path dist/*.msi) { |
| 131 | + Write-Output "MSI package created successfully" |
| 132 | + } else { |
| 133 | + Write-Output "No MSI package found in dist directory" |
| 134 | + } |
| 135 | +
|
| 136 | + - name: Upload Ubuntu .deb Package |
| 137 | + if: startsWith(matrix.os, 'ubuntu-latest') |
| 138 | + uses: actions/upload-artifact@v4 |
| 139 | + with: |
| 140 | + name: ubuntu-deb-package |
| 141 | + path: dist/* |
| 142 | + |
| 143 | + - name: Upload Windows Executables |
| 144 | + if: matrix.os == 'windows-latest' |
| 145 | + uses: actions/upload-artifact@v4 |
| 146 | + with: |
| 147 | + name: windows-executables |
| 148 | + path: dist/* |
| 149 | + |
| 150 | + # - name: Upload Intel Build Artifacts |
| 151 | + # if: matrix.os == 'macos-15' |
| 152 | + # uses: actions/upload-artifact@v4 |
| 153 | + # with: |
| 154 | + # name: macos-intel-artifacts |
| 155 | + # path: dist/* |
| 156 | + |
| 157 | + # - name: Upload ARM64 Build Artifacts |
| 158 | + # if: matrix.os == 'macos-latest' |
| 159 | + # uses: actions/upload-artifact@v4 |
| 160 | + # with: |
| 161 | + # name: macos-arm64-artifacts |
| 162 | + # path: dist/* |
0 commit comments