From 7954ac51b0bcaae3e6e6c6edc78954ff9892c658 Mon Sep 17 00:00:00 2001 From: ilammy Date: Sat, 1 Jan 2022 12:47:37 +0900 Subject: [PATCH 1/4] ci: Explicit run mode for tests Instead of hacking the mode detection by looking at the OS and target, just add an explicit variable to control what to do with tests. --- .github/workflows/ci.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e33e624f6..ef4293415 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,54 +82,70 @@ jobs: target: x86_64-unknown-linux-gnu rust: stable os: ubuntu-latest + test-type: run - thing: macos-x86_64 target: x86_64-apple-darwin rust: stable os: macos-latest + test-type: run + - thing: arm-android target: arm-linux-androideabi rust: stable os: ubuntu-latest + test-type: run - thing: arm64-android target: aarch64-linux-android rust: stable os: ubuntu-latest + test-type: run - thing: i686-android target: i686-linux-android rust: stable os: ubuntu-latest + test-type: run - thing: x86_64-android target: x86_64-linux-android rust: stable os: ubuntu-latest + test-type: run + - thing: i686-linux target: i686-unknown-linux-gnu rust: stable os: ubuntu-latest + test-type: run - thing: arm-linux target: arm-unknown-linux-gnueabi rust: stable os: ubuntu-latest + test-type: run - thing: aarch64-linux target: aarch64-unknown-linux-gnu rust: stable os: ubuntu-latest + test-type: run - thing: x86_64-musl target: x86_64-unknown-linux-musl rust: stable os: ubuntu-latest + test-type: run + - thing: x86_64-mingw target: x86_64-pc-windows-gnu rust: stable os: ubuntu-latest + test-type: run - thing: i686-msvc target: i686-pc-windows-msvc rust: stable-x86_64-msvc os: windows-latest + test-type: run-without-hyper - thing: x86_64-msvc target: x86_64-pc-windows-msvc rust: stable-x86_64-msvc os: windows-latest + test-type: run-without-hyper steps: - uses: actions/checkout@v2 @@ -152,10 +168,10 @@ jobs: - name: Set LIBCLANG_PATH if: startsWith(matrix.os, 'windows') run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV - - if: startsWith(matrix.os, 'windows') + - if: matrix.test-type == 'run-without-hyper' # CI's Windows doesn't have require root certs run: cargo test --workspace --exclude tokio-boring --exclude hyper-boring name: Run tests (Windows) - - if: "!startsWith(matrix.os, 'windows')" + - if: matrix.test-type == 'run' run: cargo test name: Run tests (not Windows) From 3f1f393c26d4cc1aa4e54fd514b211da461a8433 Mon Sep 17 00:00:00 2001 From: ilammy Date: Sat, 1 Jan 2022 13:00:24 +0900 Subject: [PATCH 2/4] ci: Explicit "--target" for tests When we're testing a target, Cargo needs to be instructed to compile for that target, not for the host environment it's running in. Otherwise, all these "arm-android" tests are just building for "ubuntu-latest" host, which does not really test what it should test. Once you do that, basically everything that is not compiling for the host environment fails to run. Leave some FIXMEs there, for now CI is going to be broken. --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef4293415..4096a35e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,6 +89,7 @@ jobs: os: macos-latest test-type: run + # FIXME: these targets fail to compile due to linker mismatch - thing: arm-android target: arm-linux-androideabi rust: stable @@ -110,6 +111,7 @@ jobs: os: ubuntu-latest test-type: run + # FIXME: these targets fail to compile due missing cross-compilers - thing: i686-linux target: i686-unknown-linux-gnu rust: stable @@ -131,6 +133,8 @@ jobs: os: ubuntu-latest test-type: run + # FIXME: mingw target fails to compile due missing cross-compilers + # (it fails building on Windows as well, for its own reasons) - thing: x86_64-mingw target: x86_64-pc-windows-gnu rust: stable @@ -170,8 +174,8 @@ jobs: run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV - if: matrix.test-type == 'run-without-hyper' # CI's Windows doesn't have require root certs - run: cargo test --workspace --exclude tokio-boring --exclude hyper-boring + run: cargo test --target ${{ matrix.target }} --workspace --exclude tokio-boring --exclude hyper-boring name: Run tests (Windows) - if: matrix.test-type == 'run' - run: cargo test + run: cargo test --target ${{ matrix.target }} name: Run tests (not Windows) From 1fa27595ad69382d99dd05bac6862906ee3dfdb6 Mon Sep 17 00:00:00 2001 From: ilammy Date: Sat, 1 Jan 2022 12:56:53 +0900 Subject: [PATCH 3/4] ci: Move comments about test modes I think they belong in the new place, explaining why a particular test-mode is chosed for a target. --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4096a35e7..b1cfd14c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -140,6 +140,8 @@ jobs: rust: stable os: ubuntu-latest test-type: run + # CI's Windows doesn't have required root certs, + # breaking tokio-boring and hyper-boring tests. - thing: i686-msvc target: i686-pc-windows-msvc rust: stable-x86_64-msvc @@ -173,7 +175,6 @@ jobs: if: startsWith(matrix.os, 'windows') run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV - if: matrix.test-type == 'run-without-hyper' - # CI's Windows doesn't have require root certs run: cargo test --target ${{ matrix.target }} --workspace --exclude tokio-boring --exclude hyper-boring name: Run tests (Windows) - if: matrix.test-type == 'run' From c7f8a921ab47f0da35202625ea6abef4907338a7 Mon Sep 17 00:00:00 2001 From: ilammy Date: Sat, 1 Jan 2022 12:59:27 +0900 Subject: [PATCH 4/4] ci: Rename test steps for clarity Since they no longer explicitly depend on the target OS, just state what we're doing in there. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1cfd14c1..b2164d89e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -176,7 +176,7 @@ jobs: run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV - if: matrix.test-type == 'run-without-hyper' run: cargo test --target ${{ matrix.target }} --workspace --exclude tokio-boring --exclude hyper-boring - name: Run tests (Windows) + name: Run tests (without hyper) - if: matrix.test-type == 'run' run: cargo test --target ${{ matrix.target }} - name: Run tests (not Windows) + name: Run tests