From 60fd51f0a6bdeb69cbed328a4aa39fc74a00949b Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Fri, 24 May 2024 09:01:20 -0700 Subject: [PATCH 01/11] Add a PR build workflow --- .github/workflows/pr-build.yaml | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/pr-build.yaml diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml new file mode 100644 index 0000000..10b937c --- /dev/null +++ b/.github/workflows/pr-build.yaml @@ -0,0 +1,49 @@ +name: PR Build & Test + +on: + pull_request: + push: + paths-ignore: + - '.github/ISSUE_TEMPLATE/**' + branches: + - main + +env: + RUSTFLAGS: -Dwarnings + +jobs: + check: + runs-on: windows-2019 + + strategy: + matrix: + # Apparently ARM targets aren't usable in GH actionsd + # target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc, aarch64-pc-windows-msvc] + target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc] + branding: [Inbox, Stable, Dev] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Update toolchain + run: rustup update --no-self-update stable && rustup default stable-${{ matrix.target }} + + - name: Add toolchain target + run: rustup target add ${{ matrix.target }} + + - name: Install fmt + run: rustup component add rustfmt + + - name: Clean + run: cargo clean + + - name: Run fmt + run: cargo fmt --all -- --check + + # Test will build the code, then also test it. + - name: Test + run: cargo test --no-default-features --features ${{matrix.branding}} --target ${{ matrix.target }} + + - name: Run clippy + run: cargo clippy --no-default-features --features ${{matrix.branding}} --target ${{matrix.target}} --frozen --release 2>&1 \ No newline at end of file From 103cb5f55ee4839f543062b55d33530eb8f0b7ad Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Fri, 24 May 2024 09:27:31 -0700 Subject: [PATCH 02/11] Oh I see, this is load bearing --- .github/actions/fix-environment/action.yml | 41 ++++++++++++++++++++++ .github/workflows/pr-build.yaml | 5 ++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .github/actions/fix-environment/action.yml diff --git a/.github/actions/fix-environment/action.yml b/.github/actions/fix-environment/action.yml new file mode 100644 index 0000000..8875f12 --- /dev/null +++ b/.github/actions/fix-environment/action.yml @@ -0,0 +1,41 @@ +name: Fix environment +description: GitHub VMs aren't configured correctly +# Shamelessly borrowed from https://github.com/microsoft/windows-rs/blob/master/.github/actions/fix-environment/action.yml +runs: + using: "composite" + steps: + - name: Configure environment + shell: pwsh + run: | + switch -Wildcard ("${{ matrix.target }}") + { + "*-pc-windows-gnu" + { + "C:\msys64\mingw64\bin;C:\msys64\mingw32\bin" >> $env:GITHUB_PATH + } + "i686*" + { + "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86" >> $env:GITHUB_PATH + ((Resolve-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx86\x86") + | Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH + } + "x86_64*" + { + "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH + ((Resolve-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64") + | Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH + } + "aarch64*" + { + "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH + ((Resolve-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64") + | Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH + } + "*" + { + (Join-Path $env:GITHUB_WORKSPACE "target\debug\deps").ToString() >> $env:GITHUB_PATH + (Join-Path $env:GITHUB_WORKSPACE "target\test\debug\deps").ToString() >> $env:GITHUB_PATH + "INCLUDE=C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" ` + >> $env:GITHUB_ENV + } + } \ No newline at end of file diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index 10b937c..21687e7 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -13,7 +13,7 @@ env: jobs: check: - runs-on: windows-2019 + runs-on: windows-2022 strategy: matrix: @@ -35,6 +35,9 @@ jobs: - name: Install fmt run: rustup component add rustfmt + - name: Fix environment + uses: ./.github/actions/fix-environment + - name: Clean run: cargo clean From 3d5be910360939c88bea1fb7aafb757039b97958 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Fri, 24 May 2024 09:36:46 -0700 Subject: [PATCH 03/11] okay okay okay okay fine fine fine --- .github/workflows/pr-build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index 21687e7..a6f1170 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -13,7 +13,7 @@ env: jobs: check: - runs-on: windows-2022 + runs-on: windows-2019 strategy: matrix: From 6ef5118c5d9d756a3e6f05c6d816300fbf08ff1c Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Wed, 29 May 2024 05:46:32 -0500 Subject: [PATCH 04/11] I think this is all the windows-2022 updates we need... --- .github/actions/fix-environment/action.yml | 19 +++++++++++-------- .github/workflows/pr-build.yaml | 10 +++++----- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/actions/fix-environment/action.yml b/.github/actions/fix-environment/action.yml index 8875f12..5c8ad63 100644 --- a/.github/actions/fix-environment/action.yml +++ b/.github/actions/fix-environment/action.yml @@ -7,6 +7,9 @@ runs: - name: Configure environment shell: pwsh run: | + $vs_root = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" ` + -latest -property installationPath -format value + switch -Wildcard ("${{ matrix.target }}") { "*-pc-windows-gnu" @@ -15,27 +18,27 @@ runs: } "i686*" { - "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86" >> $env:GITHUB_PATH - ((Resolve-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx86\x86") + "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x86" >> $env:GITHUB_PATH + ((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx86\x86") | Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH } "x86_64*" { - "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH - ((Resolve-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64") + "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH + ((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx64\x64") | Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH } "aarch64*" { - "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH - ((Resolve-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64") + "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH + ((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx64\x64") | Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH } "*" { (Join-Path $env:GITHUB_WORKSPACE "target\debug\deps").ToString() >> $env:GITHUB_PATH (Join-Path $env:GITHUB_WORKSPACE "target\test\debug\deps").ToString() >> $env:GITHUB_PATH - "INCLUDE=C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" ` + "INCLUDE=${env:ProgramFiles(x86)}\Windows Kits\10\include\10.0.22000.0\winrt;${env:ProgramFiles(x86)}\Windows Kits\10\include\10.0.22000.0\cppwinrt" ` >> $env:GITHUB_ENV } - } \ No newline at end of file + } diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index a6f1170..d240f1a 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -13,7 +13,7 @@ env: jobs: check: - runs-on: windows-2019 + runs-on: windows-2022 strategy: matrix: @@ -37,16 +37,16 @@ jobs: - name: Fix environment uses: ./.github/actions/fix-environment - + - name: Clean run: cargo clean - name: Run fmt - run: cargo fmt --all -- --check + run: cargo fmt --all -- --check # Test will build the code, then also test it. - name: Test - run: cargo test --no-default-features --features ${{matrix.branding}} --target ${{ matrix.target }} + run: cargo test --no-default-features --features ${{matrix.branding}} --target ${{ matrix.target }} - name: Run clippy - run: cargo clippy --no-default-features --features ${{matrix.branding}} --target ${{matrix.target}} --frozen --release 2>&1 \ No newline at end of file + run: cargo clippy --no-default-features --features ${{matrix.branding}} --target ${{matrix.target}} 2>&1 From 0b2a9b7213aadee33e08ac80542814734ca9b5fc Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Wed, 29 May 2024 06:13:03 -0500 Subject: [PATCH 05/11] it can't be this dumb, right? --- .github/workflows/pr-build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index d240f1a..f1cf39b 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -46,7 +46,7 @@ jobs: # Test will build the code, then also test it. - name: Test - run: cargo test --no-default-features --features ${{matrix.branding}} --target ${{ matrix.target }} + run: cargo test --config .cargo/config.toml --no-default-features --features ${{matrix.branding}} --target ${{ matrix.target }} - name: Run clippy - run: cargo clippy --no-default-features --features ${{matrix.branding}} --target ${{matrix.target}} 2>&1 + run: cargo clippy --config .cargo/config.toml --no-default-features --features ${{matrix.branding}} --target ${{matrix.target}} 2>&1 From d112447f099d7a5494b256f8c6de0f1d106d4d8b Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Wed, 29 May 2024 06:19:22 -0500 Subject: [PATCH 06/11] Okay, no it wasn't that dumb. Sanity check? --- .github/workflows/pr-build.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index f1cf39b..9eb21d1 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -19,7 +19,8 @@ jobs: matrix: # Apparently ARM targets aren't usable in GH actionsd # target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc, aarch64-pc-windows-msvc] - target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc] + # target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc] + target: [x86_64-pc-windows-msvc] branding: [Inbox, Stable, Dev] steps: @@ -46,7 +47,7 @@ jobs: # Test will build the code, then also test it. - name: Test - run: cargo test --config .cargo/config.toml --no-default-features --features ${{matrix.branding}} --target ${{ matrix.target }} + run: cargo test --no-default-features --features ${{matrix.branding}} --target ${{ matrix.target }} - name: Run clippy - run: cargo clippy --config .cargo/config.toml --no-default-features --features ${{matrix.branding}} --target ${{matrix.target}} 2>&1 + run: cargo clippy --no-default-features --features ${{matrix.branding}} --target ${{matrix.target}} 2>&1 From a3129ccf69fbb6c9115408fb9c6b6d7c29c0bc7e Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Wed, 29 May 2024 09:18:07 -0500 Subject: [PATCH 07/11] this can't hurt, right? --- .cargo/config.toml | 10 +++++----- .github/workflows/pr-build.yaml | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index f222047..7b0bfc9 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -3,13 +3,13 @@ rustflags = [ "-Ccontrol-flow-guard", "-Ctarget-feature=+crt-static", - "-Clink-args=/DEFAULTLIB:ucrt.lib /NODEFAULTLIB:vcruntime.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libucrt.lib" + "-Clink-args=/DEFAULTLIB:ucrt.lib /NODEFAULTLIB:vcruntime.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:rpcrt4.lib" ] -# This fixes the following linker error on x86: -# error LNK2019: unresolved external symbol _NdrClientCall4 referenced in function ... -[target.'cfg(all(target_os = "windows", target_arch = "x86"))'] -rustflags = ["-Clink-args=/DEFAULTLIB:rpcrt4.lib"] +# # This fixes the following linker error on x86: +# # error LNK2019: unresolved external symbol _NdrClientCall4 referenced in function ... +# [target.'cfg(all(target_os = "windows", target_arch = "x86"))'] +# rustflags = ["-Clink-args=/DEFAULTLIB:rpcrt4.lib"] # -Clink-args=/DYNAMICBASE /CETCOMPAT: Enable "shadow stack" (https://learn.microsoft.com/en-us/cpp/build/reference/cetcompat) [target.'cfg(all(target_os = "windows", any(target_arch = "x86", target_arch = "x86_64")))'] diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index 9eb21d1..c58e389 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -19,8 +19,8 @@ jobs: matrix: # Apparently ARM targets aren't usable in GH actionsd # target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc, aarch64-pc-windows-msvc] - # target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc] - target: [x86_64-pc-windows-msvc] + target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc] + # target: [x86_64-pc-windows-msvc] branding: [Inbox, Stable, Dev] steps: From a0ad35e3ce964b43cebe9ce970a8350deaea0201 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Fri, 31 May 2024 06:26:12 -0500 Subject: [PATCH 08/11] um --- .github/actions/fix-environment/action.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/actions/fix-environment/action.yml b/.github/actions/fix-environment/action.yml index 5c8ad63..bf7ad3c 100644 --- a/.github/actions/fix-environment/action.yml +++ b/.github/actions/fix-environment/action.yml @@ -19,12 +19,18 @@ runs: "i686*" { "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x86" >> $env:GITHUB_PATH + + "${env:ProgramFiles(x86)}\Windows Kits\10\Lib\10.0.22000.0\um\x86" >> $env:GITHUB_PATH + ((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx86\x86") | Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH } "x86_64*" { "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH + + "${env:ProgramFiles(x86)}\Windows Kits\10\Lib\10.0.22000.0\um\x64" >> $env:GITHUB_PATH + ((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx64\x64") | Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH } From 7654722106af24b6be031b51df52bf9b5fb71fad Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sat, 1 Jun 2024 14:23:29 -0500 Subject: [PATCH 09/11] okay that's what i get for blind copypasta --- .cargo/config.toml | 11 ++++++----- .github/actions/fix-environment/action.yml | 6 ------ .github/workflows/pr-build.yaml | 3 --- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 7b0bfc9..b4178fb 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,15 +1,16 @@ # -Ccontrol-flow-guard: Enable Control Flow Guard, needed for OneBranch's post-build analysis (https://learn.microsoft.com/en-us/cpp/build/reference/guard-enable-control-flow-guard). [target.'cfg(target_os = "windows")'] rustflags = [ + "-Dwarnings", "-Ccontrol-flow-guard", "-Ctarget-feature=+crt-static", - "-Clink-args=/DEFAULTLIB:ucrt.lib /NODEFAULTLIB:vcruntime.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:rpcrt4.lib" + "-Clink-args=/DEFAULTLIB:ucrt.lib /NODEFAULTLIB:vcruntime.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libucrt.lib" ] -# # This fixes the following linker error on x86: -# # error LNK2019: unresolved external symbol _NdrClientCall4 referenced in function ... -# [target.'cfg(all(target_os = "windows", target_arch = "x86"))'] -# rustflags = ["-Clink-args=/DEFAULTLIB:rpcrt4.lib"] +# This fixes the following linker error on x86: +# error LNK2019: unresolved external symbol _NdrClientCall4 referenced in function ... +[target.'cfg(all(target_os = "windows", target_arch = "x86"))'] +rustflags = ["-Clink-args=/DEFAULTLIB:rpcrt4.lib"] # -Clink-args=/DYNAMICBASE /CETCOMPAT: Enable "shadow stack" (https://learn.microsoft.com/en-us/cpp/build/reference/cetcompat) [target.'cfg(all(target_os = "windows", any(target_arch = "x86", target_arch = "x86_64")))'] diff --git a/.github/actions/fix-environment/action.yml b/.github/actions/fix-environment/action.yml index bf7ad3c..5c8ad63 100644 --- a/.github/actions/fix-environment/action.yml +++ b/.github/actions/fix-environment/action.yml @@ -19,18 +19,12 @@ runs: "i686*" { "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x86" >> $env:GITHUB_PATH - - "${env:ProgramFiles(x86)}\Windows Kits\10\Lib\10.0.22000.0\um\x86" >> $env:GITHUB_PATH - ((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx86\x86") | Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH } "x86_64*" { "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH - - "${env:ProgramFiles(x86)}\Windows Kits\10\Lib\10.0.22000.0\um\x64" >> $env:GITHUB_PATH - ((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx64\x64") | Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH } diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index c58e389..f089613 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -8,9 +8,6 @@ on: branches: - main -env: - RUSTFLAGS: -Dwarnings - jobs: check: runs-on: windows-2022 From bcd50081ec050e5638d5c772f8f7b9bfa4de3e8f Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sat, 1 Jun 2024 14:27:24 -0500 Subject: [PATCH 10/11] I didn't realize the friendly paperclip wasn't installed by default --- .github/workflows/pr-build.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index f089613..894c1d5 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -33,6 +33,9 @@ jobs: - name: Install fmt run: rustup component add rustfmt + - name: Install clippy + run: rustup component add clippy + - name: Fix environment uses: ./.github/actions/fix-environment From 90fa0a4c244af5a66e44f1d1d4a17b3427bd1c31 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Sat, 1 Jun 2024 14:33:38 -0500 Subject: [PATCH 11/11] another piece of dead code --- .github/workflows/pr-build.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index 894c1d5..bb4ae33 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -14,10 +14,9 @@ jobs: strategy: matrix: - # Apparently ARM targets aren't usable in GH actionsd + # Apparently ARM targets aren't usable in GH actions # target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc, aarch64-pc-windows-msvc] target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc] - # target: [x86_64-pc-windows-msvc] branding: [Inbox, Stable, Dev] steps: