From 0012d06b5faa31e3e701ccca7a6ece4e1abaa558 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Mon, 19 Feb 2024 18:07:37 +0800 Subject: [PATCH] ci: Migrate test workflows Signed-off-by: Xuanwo --- .github/workflows/ci_test.yml | 79 ++++++++++++++++++++++++++++++ azure-pipelines.yml | 92 ----------------------------------- 2 files changed, 79 insertions(+), 92 deletions(-) create mode 100644 .github/workflows/ci_test.yml delete mode 100644 azure-pipelines.yml diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml new file mode 100644 index 00000000..bb52ee1a --- /dev/null +++ b/.github/workflows/ci_test.yml @@ -0,0 +1,79 @@ +name: Test + +on: + push: + branches: + - master + pull_request: + branches: + - master + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +env: + RUST_BACKTRACE: 1 + +jobs: + check: + runs-on: ${{ matrix.os }} + strategy: + matrix: + toolchain: ["nightly", "beta"] + include: + - os: "ubuntu-20.04" + - os: "ubuntu-22.04" + features: "io-uring-sqe128,io-uring-cqe32" + - os: "ubuntu-20.04" + features: "polling" + no_default_features: true + - os: "ubuntu-22.04" + features: "polling" + no_default_features: true + - os: "ubuntu-20.04" + features: "polling,native-tls" + no_default_features: true + - os: "ubuntu-22.04" + features: "polling,native-tls" + no_default_features: true + + - os: "windows-latest" + target: "x86_64-pc-windows-msvc" + - os: "windows-latest" + target: "x86_64-pc-windows-gnu" + - os: "windows-latest" + target: "i686-pc-windows-msvc" + - os: "macos-12" + - os: "macos-13" + - os: "macos-14" + steps: + - uses: actions/checkout@v4 + - name: Setup Rust Toolchain + run: rustup toolchain install ${{ matrix.toolchain }} + - name: Setup target + if: ${{ matrix.target }} + run: rustup +${{ matrix.toolchain }} target install ${{ matrix.target }} + - name: Test on ${{ matrix.os }} ${{ matrix.toolchain }} ${{ matrix.target }} + shell: bash + run: | + ARGS=("--features" "all") + + # Add feature "nightly" if toolchain is nightly + if [[ ${{ matrix.toolchain }} == "nightly" ]]; then + ARGS+=("--features" "nightly") + fi + # Add features if features is not empty + if [[ ${{ matrix.features }} ]]; then + ARGS+=("--features" "${{ matrix.features }}") + fi + # Add no-default-features if no_default_features is true + if [[ ${{ matrix.no_default_features }} ]]; then + ARGS+=("--no-default-features") + fi + # Add doctest-xcompile if on windows and nightly + if [[ ${{ matrix.os }} == "windows-latest" && ${{ matrix.toolchain }} == "nightly" ]]; then + ARGS+=("-Z" "doctest-xcompile") + fi + + cargo +${{ matrix.toolchain }} test --workspace "${ARGS[@]}" diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 565b46c9..00000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,92 +0,0 @@ -trigger: - branches: - include: - - master - -jobs: - - job: Test_Windows - strategy: - matrix: - x86: - target: i686-pc-windows-msvc - x64: - target: x86_64-pc-windows-msvc - x64-gnu: - target: x86_64-pc-windows-gnu - pool: - vmImage: windows-latest - - steps: - - script: | - rustup toolchain install nightly - rustup +nightly target install $(target) - cargo +nightly test --workspace --features=all,nightly --target $(target) -Z doctest-xcompile - displayName: TestNightly - - script: | - rustup toolchain install beta - rustup +beta target install $(target) - cargo +beta test --workspace --features all --target $(target) - displayName: TestBeta - # - script: | - # cargo test --workspace --features all --target $(target) - # displayName: TestStable - - - job: Test_Ubuntu - strategy: - matrix: - focal: - image: ubuntu-20.04 - features: - jammy: - image: ubuntu-22.04 - features: io-uring-sqe128,io-uring-cqe32 - pool: - vmImage: $(image) - - steps: - - script: | - rustup toolchain install nightly - cargo +nightly test --workspace --features all,nightly,$(features) - displayName: TestNightly - - script: | - rustup toolchain install beta - cargo +beta test --workspace --features all,$(features) - displayName: TestBeta - # - script: | - # cargo test --workspace --features all,$(features) - # displayName: TestStable - - - script: | - rustup toolchain install nightly - cargo +nightly test --workspace --features all,polling,native-tls,nightly --no-default-features - displayName: TestNightly-polling - - script: | - rustup toolchain install beta - cargo +beta test --workspace --features all,polling --no-default-features - displayName: TestBeta-polling - # - script: | - # cargo test --workspace --features all,polling --no-default-features - # displayName: TestStable-polling - - - job: Test_Mac - strategy: - matrix: - ventura: - image: macOS-13 - monterey: - image: macOS-12 - pool: - vmImage: $(image) - - steps: - - script: | - rustup toolchain install nightly - cargo +nightly test --workspace --features all,nightly - displayName: TestNightly - - script: | - rustup toolchain install beta - cargo +beta test --workspace --features all - displayName: TestBeta - # - script: | - # cargo test --workspace --features all - # displayName: TestStable