diff --git a/.cirrus.yml b/.cirrus.yml index a0c8143..b967fac 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,10 +1,8 @@ -only_if: $CIRRUS_TAG == '' && ($CIRRUS_PR != '' || $CIRRUS_BRANCH == 'master') +only_if: $CIRRUS_TAG == '' && ($CIRRUS_PR != '' || $CIRRUS_BRANCH == 'taiki-e/ci') auto_cancellation: $CIRRUS_BRANCH != 'master' env: CARGO_INCREMENTAL: '0' - CARGO_NET_GIT_FETCH_WITH_CLI: 'true' CARGO_NET_RETRY: '10' - CARGO_REGISTRIES_CRATES_IO_PROTOCOL: 'sparse' CARGO_TERM_COLOR: always RUST_BACKTRACE: '1' RUSTDOCFLAGS: -D warnings @@ -23,7 +21,6 @@ freebsd_task: setup_script: # https://github.com/cirruslabs/cirrus-ci-docs/issues/483 - sudo sysctl net.inet.tcp.blackhole=0 - - pkg install -y git - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable --target $TARGET test_script: - . $HOME/.cargo/env @@ -39,7 +36,6 @@ netbsd_task: env: TARGET: x86_64-unknown-netbsd setup_script: - - pkgin -y install git - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable test_script: - . $HOME/.cargo/env @@ -56,6 +52,7 @@ openbsd_task: TARGET: x86_64-unknown-openbsd setup_script: # OpenBSD is tier 3 target, so install rust from package manager instead of rustup - - pkg_add git rust + - pkg_add rust + - rustc -Vv test_script: - cargo test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 069f965..c600c4f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: pull_request: push: branches: - - master + - taiki-e/ci schedule: - cron: '0 2 * * 0' @@ -31,78 +31,55 @@ jobs: strategy: fail-fast: false matrix: + target: [''] os: [ubuntu-latest, windows-latest, macos-latest] rust: [nightly, beta, stable] + include: + - os: windows-latest + rust: nightly-x86_64-pc-windows-gnu + - os: windows-latest + rust: nightly-i686-pc-windows-msvc + - os: windows-latest + rust: nightly-i686-pc-windows-gnu + - os: ubuntu-latest + rust: nightly + target: arm-linux-androideabi@21 # epoll_create1 requires API level 21+ + - os: ubuntu-latest + rust: nightly + target: x86_64-pc-windows-gnu # Wine steps: - uses: actions/checkout@v3 - name: Install Rust # --no-self-update is necessary because the windows environment cannot self-update rustup.exe. run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} + - name: Install cargo-hack + uses: taiki-e/install-action@cargo-hack + - uses: taiki-e/setup-cross-toolchain-action@more + with: + target: ${{ matrix.target }} + if: matrix.target != '' - run: cargo build --all --all-features --all-targets - - name: Run cargo check (without dev-dependencies to catch missing feature flags) - if: startsWith(matrix.rust, 'nightly') - run: cargo check -Z features=dev_dep - run: cargo test + - run: cargo hack build --feature-powerset --no-dev-deps - # Copied from: https://github.com/rust-lang/stacker/pull/19/files - windows_gnu: - runs-on: windows-latest - strategy: - matrix: - rust: [nightly] - target: - - x86_64-pc-windows-gnu - steps: - - uses: actions/checkout@v3 - - name: Install Rust - # --no-self-update is necessary because the windows environment cannot self-update rustup.exe. - run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} - - run: rustup target add ${{ matrix.target }} - # https://github.com/rust-lang/rust/issues/49078 - - name: Fix windows-gnu rust-mingw - run : | - for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a ; do - cp -f "/C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/x86_64-w64-mingw32/lib/$i" "`rustc --print sysroot`/lib/rustlib/x86_64-pc-windows-gnu/lib" - done - - run: cargo build --target ${{ matrix.target }} --all --all-features --all-targets - - run: cargo test --target ${{ matrix.target }} - + # Android and Windows are tested in test job. + # BSDs are tested in Cirrus CI. cross: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Install Rust run: rustup update stable - - name: Install cross - uses: taiki-e/install-action@cross - # We don't test BSDs, since we already test them in Cirrus. - - name: Android - if: startsWith(matrix.os, 'ubuntu') - run: cross test --target arm-linux-androideabi + - name: Install Targets + run: rustup target add aarch64-apple-ios x86_64-unknown-linux-gnux32 x86_64-unknown-fuchsia x86_64-unknown-illumos - name: iOS - if: startsWith(matrix.os, 'macos') - run: | - rustup target add aarch64-apple-ios - cross build --target aarch64-apple-ios + run: cargo build --target aarch64-apple-ios - name: Linux x32 - if: startsWith(matrix.os, 'ubuntu') - run: | - rustup target add x86_64-unknown-linux-gnux32 - cross check --target x86_64-unknown-linux-gnux32 + run: cargo build --target x86_64-unknown-linux-gnux32 - name: Fuchsia - if: startsWith(matrix.os, 'ubuntu') - run: | - rustup target add x86_64-unknown-fuchsia - cargo build --target x86_64-unknown-fuchsia + run: cargo build --target x86_64-unknown-fuchsia - name: illumos - if: startsWith(matrix.os, 'ubuntu') - run: | - rustup target add x86_64-unknown-illumos - cargo build --target x86_64-unknown-illumos + run: cargo build --target x86_64-unknown-illumos msrv: runs-on: ${{ matrix.os }} @@ -119,6 +96,13 @@ jobs: # --no-self-update is necessary because the windows environment cannot self-update rustup.exe. run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} - run: cargo build + - name: Install Other Targets + if: startsWith(matrix.os, 'ubuntu') + run: rustup target add x86_64-unknown-freebsd x86_64-unknown-netbsd + - run: cargo build --target x86_64-unknown-freebsd + if: startsWith(matrix.os, 'ubuntu') + - run: cargo build --target x86_64-unknown-netbsd + if: startsWith(matrix.os, 'ubuntu') clippy: runs-on: ubuntu-latest