From 7993f1d237f35dd0d50ecd5af41cb09904fbd664 Mon Sep 17 00:00:00 2001 From: Dmitry Pankratov Date: Fri, 6 Dec 2024 21:06:45 +0100 Subject: [PATCH] Added CI and badges --- .github/workflows/rust.yml | 21 +++++++++++++++++++++ Cargo.toml | 2 ++ README.md | 6 ++++++ ci/common.bash | 6 ++++++ ci/set_rust_version.bash | 5 +++++ ci/test.bash | 15 +++++++++++++++ 6 files changed, 55 insertions(+) create mode 100644 .github/workflows/rust.yml create mode 100644 ci/common.bash create mode 100755 ci/set_rust_version.bash create mode 100755 ci/test.bash diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..7361f3d --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,21 @@ +name: CI + +on: [push, pull_request] + +jobs: + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }} + shell: bash + - run: ci/test.bash cargo ${{ matrix.target }} + shell: bash + + strategy: + fail-fast: false + matrix: + channel: [stable] + target: + - x86_64-pc-windows-msvc + - x86_64-pc-windows-gnu diff --git a/Cargo.toml b/Cargo.toml index bb74ba1..98910b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,8 @@ publish = false [package.metadata.docs.rs] targets = ["x86_64-pc-windows-gnu", "x86_64-pc-windows-msvc"] +no-default-features = true +features = ["ring"] [dependencies] rustls = { git = "https://github.com/rustls/rustls.git", default-features = false, features = [ diff --git a/README.md b/README.md index 6400948..9083e7c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # Windows CNG bridge for rustls +[![github actions](https://github.com/ancwrd1/rustls-cng/workflows/CI/badge.svg)](https://github.com/rustls/rustls-cng/actions) +[![crates](https://img.shields.io/crates/v/rustls-cng.svg)](https://crates.io/crates/rustls-cng) +[![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) +[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +[![docs.rs](https://docs.rs/rustls-cng/badge.svg)](https://docs.rs/rustls-cng) + This crate allows you to use the Windows CNG private keys together with [rustls](https://docs.rs/rustls/latest/rustls) for both the client and server sides of the TLS channel. diff --git a/ci/common.bash b/ci/common.bash new file mode 100644 index 0000000..6b0a21a --- /dev/null +++ b/ci/common.bash @@ -0,0 +1,6 @@ +required_arg() { + if [ -z "$1" ]; then + echo "Required argument $2 missing" + exit 1 + fi +} diff --git a/ci/set_rust_version.bash b/ci/set_rust_version.bash new file mode 100755 index 0000000..6c01350 --- /dev/null +++ b/ci/set_rust_version.bash @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -e +rustup update +rustup default $1 +rustup target add $2 diff --git a/ci/test.bash b/ci/test.bash new file mode 100755 index 0000000..a00a24e --- /dev/null +++ b/ci/test.bash @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Script for building your rust projects. +set -e + +source ci/common.bash + +# $1 {path} = Path to cross/cargo executable +CROSS=$1 +# $2 {string} = +TARGET_TRIPLE=$2 + +required_arg $CROSS 'CROSS' +required_arg $TARGET_TRIPLE '' + +$CROSS test --target $TARGET_TRIPLE --no-default-features --features=ring