diff --git a/.github/workflows/build-desktop.yml b/.github/workflows/build-desktop.yml index cad85cfb7cd..428c7bc76ce 100644 --- a/.github/workflows/build-desktop.yml +++ b/.github/workflows/build-desktop.yml @@ -46,7 +46,7 @@ jobs: needs: [setup] strategy: matrix: - os: [ubuntu-20.04, macos-11, windows-2019] + os: [ubuntu-20.04, macos-11, windows-latest] fail-fast: false env: VERSION: ${{ needs.setup.outputs.version }} @@ -60,27 +60,51 @@ jobs: with: node-version: 14.x - - name: Set up Python 2.x + - name: Set up Python 2.x (macOS) uses: actions/setup-python@v2 + if: matrix.os == 'macos-11' with: python-version: '2.x' - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: stable - profile: minimal + toolchain: "1.67.0" + profile: minimal + override: true - name: Install LLVM and Clang (Windows) # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797 uses: KyleMayes/install-llvm-action@32c4866ebb71e0949e8833eb49beeebed48532bd - if: matrix.os == 'windows-2019' + if: matrix.os == 'windows-latest' with: version: '11.0' directory: ${{ runner.temp }}/llvm - name: Set LIBCLANG_PATH (Windows) run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV - if: matrix.os == 'windows-2019' + if: matrix.os == 'windows-latest' + + - name: Update node-gyp to 9.3.1 and apply patch (Windows) + # The node-gyp bundled with Node 14.x does not support VS 2022 + # https://github.com/nodejs/node-gyp/blob/main/docs/Updating-npm-bundled-node-gyp.md#windows + # We also need to patch this issue https://github.com/nodejs/node-gyp/issues/2673#issuecomment-1239619438 + run: | + cd (Get-Item $((gcm node).Path)).DirectoryName + cd node_modules\npm\node_modules\npm-lifecycle + npm install node-gyp@9.3.1 + cd node_modules\node-gyp + git apply --ignore-space-change --ignore-whitespace ${{ github.workspace }}\manual-patches\openssl_fips.patch + if: matrix.os == 'windows-latest' + + - name: Apply neon-sys patch (Windows) + run: | + cargo install cargo-patch + cp ${{ github.workspace }}\manual-patches\neon_temp_buf.patch . + git apply --ignore-space-change --ignore-whitespace ${{ github.workspace }}\manual-patches\windows_cargo_toml.patch + cat Cargo.toml + cargo patch + working-directory: packages/backend/bindings/node/native + if: matrix.os == 'windows-latest' - name: Set deployment target (macOS) run: echo "MACOSX_DEPLOYMENT_TARGET=10.12" >> $GITHUB_ENV @@ -96,11 +120,11 @@ jobs: - name: Enable verbose output for electron-builder (macOS/Linux) run: echo "DEBUG=electron-builder" >> $GITHUB_ENV - if: matrix.os != 'windows-2019' && github.event.inputs.debugElectronBuilder && github.event.inputs.debugElectronBuilder == 'true' + if: matrix.os != 'windows-latest' && github.event.inputs.debugElectronBuilder && github.event.inputs.debugElectronBuilder == 'true' - name: Enable verbose output for electron-builder (Windows) run: echo "DEBUG=electron-builder" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - if: matrix.os == 'windows-2019' && github.event.inputs.debugElectronBuilder && github.event.inputs.debugElectronBuilder == 'true' + if: matrix.os == 'windows-latest' && github.event.inputs.debugElectronBuilder && github.event.inputs.debugElectronBuilder == 'true' - name: Install dependencies # Increase network timeout threshold to reduce build failures on Windows @@ -141,7 +165,7 @@ jobs: working-directory: packages/backend/bindings/node/native/target/x86_64-pc-windows-msvc/release env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - if: ${{ startsWith(github.ref, 'refs/tags/desktop') && matrix.os == 'windows-2019' }} + if: ${{ startsWith(github.ref, 'refs/tags/desktop') && matrix.os == 'windows-latest' }} - name: Set productName run: node scripts/fix-productName.js @@ -173,7 +197,7 @@ jobs: CSC_LINK: ${{ secrets.WIN_CERT_BASE64 }} CSC_KEY_PASSWORD: ${{ secrets.WIN_CERT_PASSWORD }} working-directory: packages/desktop - if: matrix.os == 'windows-2019' + if: matrix.os == 'windows-latest' - name: Build Electron app (Linux) run: yarn compile:${STAGE}:linux @@ -209,7 +233,7 @@ jobs: - name: Compute checksums (Windows) run: Get-ChildItem "." -Filter firefly-desktop* | Foreach-Object { $(Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash | Set-Content ($_.FullName + '.sha256') } working-directory: packages/desktop/out - if: matrix.os == 'windows-2019' + if: matrix.os == 'windows-latest' - name: Upload artifacts uses: actions/upload-artifact@v2 @@ -237,7 +261,7 @@ jobs: - name: Downloading artifacts uses: actions/download-artifact@v2 with: - name: firefly-desktop-windows-2019 + name: firefly-desktop-windows-latest path: assets - name: Downloading artifacts diff --git a/manual-patches/neon_temp_buf.patch b/manual-patches/neon_temp_buf.patch new file mode 100644 index 00000000000..a956602686b --- /dev/null +++ b/manual-patches/neon_temp_buf.patch @@ -0,0 +1,13 @@ +diff --git a/native/src/neon.cc b/native/src/neon.cc +index 7b2981b..164d3cc 100644 +--- a/native/src/neon.cc ++++ b/native/src/neon.cc +@@ -227,7 +227,7 @@ extern "C" size_t Neon_ArrayBuffer_Data(v8::Isolate *isolate, void **base_out, v + // the contents. + // + // https://github.com/electron/electron/issues/29893 +- #if _MSC_VER && NODE_MODULE_VERSION >= 89 ++ #if _MSC_VER && NODE_MODULE_VERSION >= 87 + v8::Local local; + node::Buffer::New(isolate, buffer, 0, buffer->ByteLength()).ToLocal(&local); + return Neon_Buffer_Data(isolate, base_out, local); diff --git a/manual-patches/openssl_fips.patch b/manual-patches/openssl_fips.patch new file mode 100644 index 00000000000..e99e3cc588b --- /dev/null +++ b/manual-patches/openssl_fips.patch @@ -0,0 +1,13 @@ +diff --git a/gyp/pylib/gyp/input.py b/gyp/pylib/gyp/input.py +index d9699a0..e51ee7b 100644 +--- a/gyp/pylib/gyp/input.py ++++ b/gyp/pylib/gyp/input.py +@@ -1183,7 +1183,7 @@ def EvalSingleCondition(cond_expr, true_dict, false_dict, phase, variables, buil + else: + ast_code = compile(cond_expr_expanded, "", "eval") + cached_conditions_asts[cond_expr_expanded] = ast_code +- env = {"__builtins__": {}, "v": StrictVersion} ++ env = {"__builtins__": {"openssl_fips": ""}, "v": StrictVersion} + if eval(ast_code, env, variables): + return true_dict + return false_dict diff --git a/manual-patches/windows_cargo_toml.patch b/manual-patches/windows_cargo_toml.patch new file mode 100644 index 00000000000..ede56733e37 --- /dev/null +++ b/manual-patches/windows_cargo_toml.patch @@ -0,0 +1,20 @@ +diff --git a/packages/backend/bindings/node/native/Cargo.toml b/packages/backend/bindings/node/native/Cargo.toml +index 0292e483b..dfb22776e 100644 +--- a/packages/backend/bindings/node/native/Cargo.toml ++++ b/packages/backend/bindings/node/native/Cargo.toml +@@ -22,6 +22,15 @@ tokio = { version = "1.28.0", default-features = false } + once_cell = { version = "1.8.0", default-features = false } + firefly-actor-system = { path = "../../.." } + ++[package.metadata.patch.neon-sys] ++version = "0.10.1" ++patches = [ ++ { path = "neon_temp_buf.patch", source = "GithubPrDiff" }, ++] ++ ++[patch.crates-io] ++neon-sys = { path = './target/patch/neon-sys-0.10.1' } ++ + [profile.release] + # Build with debug symbols included + debug = true