diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f06ccfa --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,78 @@ +name: ci +on: [push, pull_request] +env: + RUSTFLAGS: "-D warnings" +jobs: + test: + name: Test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + rust: [1.78.0, stable, beta, nightly] + env: + VCPKG_ROOT: "${{ github.workspace }}\\vcpkg" + VCPKGRS_TRIPLET: x64-windows-release + # Ensure that OpenSSL is dynamically linked. + VCPKGRS_DYNAMIC: 1 + steps: + - name: Checkout repository + uses: actions/checkout@v1 + - name: Install Rust + uses: hecrj/setup-rust-action@v2 + with: + rust-version: ${{ matrix.rust }} + - if: matrix.os == 'ubuntu-latest' + run: sudo apt-get install -y libssl-dev + - if: matrix.os == 'windows-latest' + id: vcpkg + uses: johnwason/vcpkg-action@v6 + with: + pkgs: openssl + triplet: ${{ env.VCPKGRS_TRIPLET }} + token: ${{ github.token }} + github-binarycache: true + - if: matrix.rust == 'stable' + run: rustup component add clippy + - if: matrix.rust == 'stable' + run: cargo clippy --all-features --all-targets -- -D warnings + - if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest' + run: cargo fmt --all -- --check + - run: cargo check --no-default-features --all-targets + - run: cargo test --all-features + + minimal-versions: + name: Check minimal versions + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v1 + - name: Install Rust + uses: hecrj/setup-rust-action@v2 + with: + rust-version: "1.78.0" + - name: Install nightly Rust + run: rustup install nightly + - name: Check with minimal-versions + run: | + cargo +nightly update -Z minimal-versions + cargo check --all-features --all-targets --locked + + extra-tests: + name: Extra tests + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v1 + - name: Install Rust + uses: hecrj/setup-rust-action@v2 + - name: Install supporting tools/libraries + run: | + # The tests compare their output to that of LDNS tools, so we need to + # install them. Some tests work with DNSSEC keys for which the OpenSSL + # library must be compiled against which requires C build programs and + # pkg-config. Install everything we need. + sudo apt-get update + sudo apt-get install -y build-essential ldnsutils libssl-dev pkg-config + - name: Run tests that are normally ignored + run: cargo test --all-features --all-targets -- --ignored