From 792c5acc7d222be5bf316fbdad432187936eb7cb Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Sun, 27 Aug 2023 00:02:53 +0800 Subject: [PATCH 1/7] Show build.rs STDERR for all targets --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a269bcdbf..856aafc60 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -35,7 +35,6 @@ jobs: # This is useful for debugging problems when the expected build artifacts # (like shell completions and man pages) aren't generated. - name: Show build.rs stderr - if: matrix.os == 'windows-latest' shell: bash run: | set +x From 21c89530e77d13da324096646f9f9565de656dea Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Sun, 27 Aug 2023 00:03:23 +0800 Subject: [PATCH 2/7] Improve build.rs STDERR logging - Remove `set +x` - Use GitHub Action's log grouping feature - See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions --- .github/workflows/ci.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 856aafc60..584973f1c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,14 +37,12 @@ jobs: - name: Show build.rs stderr shell: bash run: | - set +x mapfile -d '' -t STDERR_FILES < <(find "./target/debug" -name stderr -print0 | grep -z bandwhich) for FILE in "${STDERR_FILES[@]}"; do - echo "===== $FILE ===== " + echo "::group::$FILE" cat "$FILE" - echo "=====" + echo "::endgroup::" done - set -x - name: Run clippy run: cargo clippy --all-targets --all-features -- -D warnings From aabff42048292733ef7f481950f8c919586c482e Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Sun, 27 Aug 2023 00:26:57 +0800 Subject: [PATCH 3/7] Don't use `mapfile` to be compatible with Bash 3 on MacOS This does assume that the path `target/*/build/bandwhich-*/stderr` contains no spaces, but it should be fine. --- .github/workflows/ci.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 584973f1c..7a1e24392 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,8 +37,9 @@ jobs: - name: Show build.rs stderr shell: bash run: | - mapfile -d '' -t STDERR_FILES < <(find "./target/debug" -name stderr -print0 | grep -z bandwhich) - for FILE in "${STDERR_FILES[@]}"; do + # it's probably okay to assume no spaces? + STDERR_FILES=$(find "./target/debug" -name stderr | grep bandwhich) + for FILE in $STDERR_FILES; do echo "::group::$FILE" cat "$FILE" echo "::endgroup::" From 366ec34d1c40973d3f27072227d2cdb2e546037c Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Sun, 27 Aug 2023 00:45:01 +0800 Subject: [PATCH 4/7] Install pcap on Windows --- .github/workflows/ci.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7a1e24392..77ddfa6ce 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -48,6 +48,15 @@ jobs: - name: Run clippy run: cargo clippy --all-targets --all-features -- -D warnings + - name: Install npcap on Windows + if: matrix.os == 'windows-latest' + env: + NPCAP_OEM_URL: ${{ secrets.NPCAP_OEM_URL }} + shell: bash + run: | + curl -Lf "$NPCAP_OEM_URL" -o "$TEMP/npcap-oem.exe" + "$TEMP/npcap-oem.exe" /S + - name: Run tests run: cargo test --verbose From 96604838ddf0bd85174aa1a47e1f4ecedef3b129 Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Sun, 27 Aug 2023 22:08:18 +0800 Subject: [PATCH 5/7] Test MSRV --- .github/workflows/ci.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 77ddfa6ce..785799ed2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,7 +15,10 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - rust: [stable, nightly] + rust: + - 1.65.0 # MSRV + - stable + - nightly steps: - name: Checkout repository uses: actions/checkout@v3 From b1e31d407edce8da89124c4fe47b4239ce8303eb Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Sun, 27 Aug 2023 23:08:59 +0800 Subject: [PATCH 6/7] Set correct MSRV (1.70.0) --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 785799ed2..0b5cc4b52 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,7 +16,7 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] rust: - - 1.65.0 # MSRV + - 1.70.0 # MSRV - stable - nightly steps: From bfb2fbe51f16974adb862fa0c1702f1164e1fb98 Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Wed, 30 Aug 2023 10:54:45 +0800 Subject: [PATCH 7/7] Fix stuck CI on Windows --- .github/workflows/ci.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0b5cc4b52..a2d37480d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -55,10 +55,11 @@ jobs: if: matrix.os == 'windows-latest' env: NPCAP_OEM_URL: ${{ secrets.NPCAP_OEM_URL }} - shell: bash run: | - curl -Lf "$NPCAP_OEM_URL" -o "$TEMP/npcap-oem.exe" - "$TEMP/npcap-oem.exe" /S + Invoke-WebRequest -Uri "$env:NPCAP_OEM_URL" -OutFile "$env:TEMP/npcap-oem.exe" + # for this ridiculous `&` syntax alone, I'd rather use COBOL than Powershell + # see https://stackoverflow.com/a/1674950/5637701 + & "$env:TEMP/npcap-oem.exe" /S - name: Run tests run: cargo test --verbose