diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..6d7e46bca --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,148 @@ +name: CI +on: + push: + branches: [ "master", "v0.6.x", "v0.7.x" ] + pull_request: + branches: [ "master", "v0.6.x", "v0.7.x" ] +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: full + CI: true +jobs: + Test: + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: Install Cargo-hack + run: cargo install --debug cargo-hack + - name: Check all features + run: cargo hack check --feature-powerset + - name: Tests + run: cargo test --all-features + - name: Tests release build + run: cargo test --release --all-features + MinimalVersions: + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - name: Install minimal verions + run: cargo update -Zminimal-versions + - name: Tests + run: cargo test --all-features + MSRV: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: 1.46.0 + override: true + - name: Check + # We only run check allowing us to use newer features in tests. + run: cargo check --all-features + Nightly: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - name: Tests + run: cargo test --all-features + Clippy: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: clippy + - name: Clippy + run: cargo clippy --all-targets --all-features -- -D warnings -A clippy::cognitive-complexity + Docs: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - name: Check docs + run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features + Rustfmt: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt + - name: Check formatting + # FIXME: for some reason this doesn't actually check all files. + # So instead we run `rustfmt` directly on each file. + #cargo fmt --all -- --check + run: find src tests examples -type f -iname "*.rs" | xargs rustfmt --check + CheckTargets: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: clippy + - name: Install all targets + run: make install_targets + - name: Install Cargo-hack + run: cargo install --debug cargo-hack + - name: Check all targets + run: make check_all_targets + # Single job required to merge the pr. + Passed: + runs-on: ubuntu-latest + needs: + - Test + - MinimalVersions + - MSRV + - Nightly + - Clippy + - Docs + - Rustfmt + - CheckTargets + steps: + - run: exit 0 diff --git a/Makefile b/Makefile index eb2dab5ed..514798c93 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # Targets available via Rustup that are supported. -TARGETS ?= aarch64-apple-ios aarch64-linux-android x86_64-apple-darwin x86_64-pc-windows-msvc x86_64-unknown-freebsd x86_64-unknown-illumos x86_64-unknown-linux-gnu x86_64-unknown-netbsd +TARGETS ?= aarch64-apple-ios aarch64-linux-android arm-linux-androideabi i686-unknown-linux-gnu x86_64-apple-darwin x86_64-apple-ios x86_64-pc-windows-msvc x86_64-unknown-freebsd x86_64-unknown-illumos x86_64-unknown-linux-gnu x86_64-unknown-netbsd x86_64-unknown-redox test: cargo test --all-features diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 6e74acf3e..000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,65 +0,0 @@ -trigger: ["master", "v0.6.x", "v0.7.x"] -pr: ["master", "v0.6.x", "v0.7.x"] - -jobs: - # Check formatting - - template: ci/azure-rustfmt.yml - parameters: - name: rustfmt - - # Stable - - template: ci/azure-test-stable.yml - parameters: - name: stable - displayName: Test - cross: true - - # Stable --release - - template: ci/azure-test-stable.yml - parameters: - name: stable_release - displayName: Test --release - cmd: test --release - - # Nightly - - template: ci/azure-test-stable.yml - parameters: - name: nightly - displayName: Nightly - # Pin nightly to avoid being impacted by breakage - rust_version: nightly-2021-11-05 - benches: true - - # This represents the minimum Rust version supported by - # Mio. Updating this should be done in a dedicated PR. - # - # Tests are not run as tests may require newer versions of - # rust. - - template: ci/azure-test-stable.yml - parameters: - name: minrust - displayName: Min Rust - rust_version: 1.46.0 - cmd: check - cross: true - - - template: ci/azure-minimal-versions.yml - parameters: - name: minimal_versions - - - template: ci/azure-clippy.yml - parameters: - name: clippy - - - template: ci/azure-cross-compile.yml - parameters: - name: cross - - - template: ci/azure-deploy-docs.yml - parameters: - dependsOn: - # - rustfmt - - stable - - nightly - - minrust - - cross diff --git a/ci/azure-clippy.yml b/ci/azure-clippy.yml deleted file mode 100644 index 3efc95152..000000000 --- a/ci/azure-clippy.yml +++ /dev/null @@ -1,17 +0,0 @@ -jobs: -- job: ${{ parameters.name }} - displayName: Clippy - - pool: - vmImage: ubuntu-18.04 - - steps: - - template: azure-install-rust.yml - parameters: - rust_version: stable - - - script: rustup component add clippy - displayName: "Add component" - - - script: cargo clippy --all-targets --all-features -- -D warnings -A clippy::cognitive-complexity - displayName: "Run Clippy" diff --git a/ci/azure-cross-compile.yml b/ci/azure-cross-compile.yml deleted file mode 100644 index 7c8f9d812..000000000 --- a/ci/azure-cross-compile.yml +++ /dev/null @@ -1,59 +0,0 @@ -parameters: - vmImage: ubuntu-18.04 - -jobs: - - job: ${{ parameters.name }} - displayName: Cross - strategy: - matrix: - iOS_64: - vmImage: macOS-10.15 - target: x86_64-apple-ios - - iOS_ARM64: - vmImage: macOS-10.15 - target: aarch64-apple-ios - - Android_ARM: - vmImage: ubuntu-18.04 - target: arm-linux-androideabi - - Android_ARM64: - vmImage: ubuntu-18.04 - target: aarch64-linux-android - - Android_32: - vmImage: ubuntu-18.04 - target: i686-unknown-linux-gnu - - NetBSD: - vmImage: ubuntu-18.04 - target: x86_64-unknown-netbsd - - illumos: - vmImage: ubuntu-18.04 - target: x86_64-unknown-illumos - - redox: - vmImage: ubuntu-18.04 - target: x86_64-unknown-redox - - pool: - vmImage: $(vmImage) - - steps: - - template: azure-install-rust.yml - parameters: - rust_version: stable - - - script: rustup target add $(target) - displayName: "Add target" - - - script: cargo check --target $(target) - displayName: Check source - - - script: cargo check --tests --target $(target) --all-features - displayName: Check tests - - - script: cargo check --examples --target $(target) --all-features - displayName: Check examples diff --git a/ci/azure-deploy-docs.yml b/ci/azure-deploy-docs.yml deleted file mode 100644 index 6e00fb5e0..000000000 --- a/ci/azure-deploy-docs.yml +++ /dev/null @@ -1,38 +0,0 @@ -parameters: - dependsOn: [] - -jobs: - - job: documentation - displayName: "Deploy API Documentation" - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) - pool: - vmImage: "Ubuntu 16.04" - dependsOn: - - ${{ parameters.dependsOn }} - steps: - - template: azure-install-rust.yml - parameters: - rust_version: stable - - script: | - cargo doc --no-deps --all-features - cp -R target/doc '$(Build.BinariesDirectory)' - displayName: "Generate Documentation" - - script: | - set -e - - git --version - ls -la - git init - git config user.name 'Deployment Bot (from Azure Pipelines)' - git config user.email 'deploy@tokio-rs.com' - git config --global credential.helper 'store --file ~/.my-credentials' - printf "protocol=https\nhost=github.com\nusername=carllerche\npassword=%s\n\n" "$GITHUB_TOKEN" | git credential-store --file ~/.my-credentials store - git remote add origin https://github.com/tokio-rs/mio - git checkout -b gh-pages - git add . - git commit -m 'Deploy Mio API documentation' - git push -f origin gh-pages - env: - GITHUB_TOKEN: $(githubPersonalToken) - workingDirectory: "$(Build.BinariesDirectory)" - displayName: "Deploy Documentation" diff --git a/ci/azure-install-rust.yml b/ci/azure-install-rust.yml deleted file mode 100644 index 1b44f3def..000000000 --- a/ci/azure-install-rust.yml +++ /dev/null @@ -1,33 +0,0 @@ -steps: - # Linux and macOS. - - script: | - set -e - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none --profile minimal - export PATH=$PATH:$HOME/.cargo/bin - rustup toolchain install $RUSTUP_TOOLCHAIN - rustup default $RUSTUP_TOOLCHAIN - echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" - env: - RUSTUP_TOOLCHAIN: ${{parameters.rust_version}} - displayName: "Install rust (*nix)" - condition: not(eq(variables['Agent.OS'], 'Windows_NT')) - - # Windows. - - script: | - curl -sSf -o rustup-init.exe https://win.rustup.rs - rustup-init.exe -y --default-toolchain none - set PATH=%PATH%;%USERPROFILE%\.cargo\bin - rustup toolchain install %RUSTUP_TOOLCHAIN% - rustup default %RUSTUP_TOOLCHAIN% - echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin" - env: - RUSTUP_TOOLCHAIN: ${{parameters.rust_version}} - displayName: "Install rust (windows)" - condition: eq(variables['Agent.OS'], 'Windows_NT') - - # All platforms. - - script: | - rustup toolchain list - rustc -Vv - cargo -V - displayName: Query rust and cargo versions diff --git a/ci/azure-minimal-versions.yml b/ci/azure-minimal-versions.yml deleted file mode 100644 index 8c90720fa..000000000 --- a/ci/azure-minimal-versions.yml +++ /dev/null @@ -1,32 +0,0 @@ -parameters: - rust_version: nightly - -jobs: - - job: ${{ parameters.name }} - displayName: Minimal versions - strategy: - matrix: - Linux: - vmImage: ubuntu-18.04 - Windows: - vmImage: windows-latest - pool: - vmImage: $(vmImage) - - variables: - RUST_BACKTRACE: full - - steps: - - template: azure-install-rust.yml - parameters: - rust_version: ${{ parameters.rust_version }} - - - script: cargo update -Zminimal-versions - displayName: cargo update -Zminimal-versions - env: - CI: "True" - - - script: cargo test --all-features - displayName: cargo test --all-features - env: - CI: "True" diff --git a/ci/azure-rustfmt.yml b/ci/azure-rustfmt.yml deleted file mode 100644 index 1a5f1abea..000000000 --- a/ci/azure-rustfmt.yml +++ /dev/null @@ -1,19 +0,0 @@ -jobs: - # Check formatting - - job: ${{ parameters.name }} - displayName: Check rustfmt - pool: - vmImage: ubuntu-18.04 - steps: - - template: azure-install-rust.yml - parameters: - rust_version: stable - - script: | - rustup component add rustfmt - displayName: Install rustfmt - - script: | - # FIXME: for some reason this doesn't actually check all files. - # So instead we run `rustfmt` directly on each file. - #cargo fmt --all -- --check - find src tests examples -type f -iname "*.rs" | xargs rustfmt --check - displayName: Check formatting diff --git a/ci/azure-test-stable.yml b/ci/azure-test-stable.yml deleted file mode 100644 index 18ede7067..000000000 --- a/ci/azure-test-stable.yml +++ /dev/null @@ -1,48 +0,0 @@ -parameters: - cmd: test - rust_version: stable - -jobs: - - job: ${{ parameters.name }} - displayName: ${{ parameters.displayName }} - strategy: - matrix: - Linux: - vmImage: ubuntu-18.04 - - ${{ if parameters.cross }}: - MacOS: - vmImage: macOS-10.15 - Windows: - vmImage: windows-latest - pool: - vmImage: $(vmImage) - - variables: - RUST_BACKTRACE: full - - steps: - - template: azure-install-rust.yml - parameters: - rust_version: ${{ parameters.rust_version }} - - - ${{ if eq(parameters.cmd, 'test') }}: - - script: | - # Cargo-hack's dependency bitflags has a higher MSVR then us. - rustup install nightly - rustup run nightly cargo install cargo-hack - cargo hack check --feature-powerset - displayName: Check feature powerset - - - script: cargo ${{ parameters.cmd }} --all-features - displayName: cargo ${{ parameters.cmd }} --all-features - env: - CI: "True" - - - ${{ if eq(parameters.cmd, 'test') }}: - - script: cargo doc --no-deps - displayName: cargo doc --no-deps - - - ${{ if parameters.benches }}: - - script: cargo check --benches - displayName: Check benchmarks