From a4c9361791a9204e395ab99cb737cf821b7e2d16 Mon Sep 17 00:00:00 2001
From: Rob Ede <robjtede@icloud.com>
Date: Tue, 18 Jul 2023 02:18:19 +0100
Subject: [PATCH] ci: fix windows openssl

---
 .github/workflows/ci-post-merge.yml | 59 ++++++++---------------------
 .github/workflows/ci.yml            |  8 ++--
 actix-multipart/Cargo.toml          |  7 ++--
 3 files changed, 22 insertions(+), 52 deletions(-)

diff --git a/.github/workflows/ci-post-merge.yml b/.github/workflows/ci-post-merge.yml
index 8dd941e0..d293fea9 100644
--- a/.github/workflows/ci-post-merge.yml
+++ b/.github/workflows/ci-post-merge.yml
@@ -26,39 +26,26 @@ jobs:
     name: ${{ matrix.target.name }} / ${{ matrix.version }}
     runs-on: ${{ matrix.target.os }}
 
-    env:
-      CI: 1
-      CARGO_INCREMENTAL: 0
-      VCPKGRS_DYNAMIC: 1
-      CARGO_UNSTABLE_SPARSE_REGISTRY: true
-
     steps:
       - uses: actions/checkout@v3
 
-      # install OpenSSL on Windows
-      # TODO: GitHub actions docs state that OpenSSL is
-      # already installed on these Windows machines somewhere
-      - name: Set vcpkg root
-        if: matrix.target.triple == 'x86_64-pc-windows-msvc'
-        run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
       - name: Install OpenSSL
-        if: matrix.target.triple == 'x86_64-pc-windows-msvc'
-        run: vcpkg install openssl:x64-windows
-
-      - name: Install ${{ matrix.version }}
+        if: matrix.target.os == 'windows-latest'
+        run: choco install openssl -y --forcex64 --no-progress
+      - name: Set OpenSSL dir in env
+        if: matrix.target.os == 'windows-latest'
         run: |
-          rustup set profile minimal
-          rustup install ${{ matrix.version }}
-          rustup override set ${{ matrix.version }}
+          echo 'OPENSSL_DIR=C:\Program Files\OpenSSL-Win64' | Out-File -FilePath $env:GITHUB_ENV -Append
+          echo 'OPENSSL_DIR=C:\Program Files\OpenSSL' | Out-File -FilePath $env:GITHUB_ENV -Append
+
+      - name: Install Rust (${{ matrix.version }})
+        uses: actions-rust-lang/setup-rust-toolchain@v1
+        with:
+          toolchain: ${{ matrix.version }}
 
       - name: Install cargo-hack
         uses: taiki-e/install-action@cargo-hack
 
-      - name: Generate Cargo.lock
-        run: cargo generate-lockfile
-      - name: Cache Dependencies
-        uses: Swatinem/rust-cache@v2.2.1
-
       - name: check minimal
         run: cargo ci-check-min
 
@@ -88,23 +75,15 @@ jobs:
     name: Verify Feature Combinations
     runs-on: ubuntu-latest
 
-    env:
-      CI: 1
-      CARGO_INCREMENTAL: 0
-
     steps:
       - uses: actions/checkout@v3
 
-      - uses: dtolnay/rust-toolchain@stable
+      - name: Install Rust
+        uses: actions-rust-lang/setup-rust-toolchain@v1
 
       - name: Install cargo-hack
         uses: taiki-e/install-action@cargo-hack
 
-      - name: Generate Cargo.lock
-        run: cargo generate-lockfile
-      - name: Cache Dependencies
-        uses: Swatinem/rust-cache@v2.2.1
-
       - name: check feature combinations
         run: cargo ci-check-all-feature-powerset
 
@@ -115,22 +94,14 @@ jobs:
     name: nextest
     runs-on: ubuntu-latest
 
-    env:
-      CI: 1
-      CARGO_INCREMENTAL: 0
-
     steps:
       - uses: actions/checkout@v3
 
-      - uses: dtolnay/rust-toolchain@stable
+      - name: Install Rust
+        uses: actions-rust-lang/setup-rust-toolchain@v1
 
       - name: Install nextest
         uses: taiki-e/install-action@nextest
 
-      - name: Generate Cargo.lock
-        run: cargo generate-lockfile
-      - name: Cache Dependencies
-        uses: Swatinem/rust-cache@v2.2.1
-
       - name: Test with cargo-nextest
         run: cargo nextest run
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 10e80b75..f8554850 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -29,17 +29,17 @@ jobs:
     name: ${{ matrix.target.name }} / ${{ matrix.version }}
     runs-on: ${{ matrix.target.os }}
 
-    env: {}
-
     steps:
       - uses: actions/checkout@v3
 
       - name: Install OpenSSL
         if: matrix.target.os == 'windows-latest'
-        run: choco install openssl
+        run: choco install openssl -y --forcex64 --no-progress
       - name: Set OpenSSL dir in env
         if: matrix.target.os == 'windows-latest'
-        run: echo 'OPENSSL_DIR=C:\Program Files\OpenSSL-Win64' | Out-File -FilePath $env:GITHUB_ENV -Append
+        run: |
+          echo 'OPENSSL_DIR=C:\Program Files\OpenSSL-Win64' | Out-File -FilePath $env:GITHUB_ENV -Append
+          echo 'OPENSSL_DIR=C:\Program Files\OpenSSL' | Out-File -FilePath $env:GITHUB_ENV -Append
 
       - name: Install Rust (${{ matrix.version }})
         uses: actions-rust-lang/setup-rust-toolchain@v1
diff --git a/actix-multipart/Cargo.toml b/actix-multipart/Cargo.toml
index f186bf8d..63cd9970 100644
--- a/actix-multipart/Cargo.toml
+++ b/actix-multipart/Cargo.toml
@@ -19,7 +19,7 @@ all-features = true
 [features]
 default = ["tempfile", "derive"]
 derive = ["actix-multipart-derive"]
-tempfile = ["tempfile-dep", "tokio/fs"]
+tempfile = ["dep:tempfile", "tokio/fs"]
 
 [dependencies]
 actix-multipart-derive = { version = "=0.6.0", optional = true }
@@ -38,9 +38,8 @@ mime = "0.3"
 serde = "1"
 serde_json = "1"
 serde_plain = "1"
-# TODO(MSRV 1.60): replace with dep: prefix
-tempfile-dep = { package = "tempfile", version = "3.4", optional = true }
-tokio = { version = "1.24.2", features = ["io-util", "sync"] }
+tempfile-dep = { version = "3.4", optional = true }
+tokio = { version = "1.24.2", features = ["sync", "io-util"] }
 
 [dev-dependencies]
 actix-http = "3"