Skip to content

Commit

Permalink
ci: setup ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Taowyoo committed Nov 2, 2023
1 parent 4c872ef commit 3a8b96a
Show file tree
Hide file tree
Showing 10 changed files with 343 additions and 30 deletions.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Checklist**
* [ ] I've searched the issue tracker for similar bugs.

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Use one of the examples to connect to `....`
2. ...
3. See error

**Applicable Version(s)**
A list of versions and platforms you've tested with.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Additional context**
Add any other context about the problem here.
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/dependency-update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Dependency Update
about: Request a dependency be updated
title: Dependency update request
labels: ''
assignees: ''

---

<!--
Please note that we are only interested in **semver-incompatible** update requests. Updates to dependencies that are
semver-compatible can be done in dependent projects without needing changes in this repository.
For example, if you are here because you believe Rustls is bringing in dependency `foo` at version `0.2.1` and
you wish Rustls used `0.2.2` instead, you should not file an issue and instead should run `cargo update` in your
dependent project. It would only be appropriate to file an issue if you require Rustls use `foo` at version `0.3.0+`.
-->

**Checklist**
* [ ] I've searched the issue tracker for similar requests
* [ ] I've confirmed my request is for a semver-incompatible update

**Is your dependency update request related to a problem? Please describe.**
A clear and concise description of what the problem is.

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Checklist**
* [ ] I've searched the issue tracker for similar requests

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
8 changes: 8 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
coverage:
status:
patch:
default:
threshold: 0.05%
project:
default:
threshold: 0.05%
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
groups:
crates-io:
patterns:
- "*"
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
213 changes: 213 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
name: rustls-mbedcrypto-provider

permissions:
contents: read

on:
pull_request:
paths-ignore:
- '*.md'
- 'LICENSE'
branches:
- master
merge_group:
schedule:
- cron: '30 13 * * 1,5'

env:
CARGO_TERM_COLOR: always
CARGO_NET_RETRY: 10

jobs:
build:
name: Build+test
runs-on: ${{ matrix.os }}
strategy:
matrix:
# test a bunch of toolchains on ubuntu
rust:
- stable
- beta
- nightly
os: [ubuntu-20.04]
# but only stable on macos/windows (slower platforms)
include:
- os: macos-latest
rust: stable
- os: windows-latest
rust: stable
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.rust }}-${{ matrix.os }}

- name: Install ${{ matrix.rust }} toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}

- name: cargo build (debug; default features)
run: cargo build --locked
shell: bash

- name: cargo test (debug; all features)
run: cargo test --locked --all-features
shell: bash
env:
RUST_BACKTRACE: 1

features:
name: Features
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: cargo build (debug; default features)
run: cargo build --locked

- name: cargo test (debug; default features)
run: cargo test --locked
env:
RUST_BACKTRACE: 1

- name: cargo test (debug; no default features)
run: cargo test --locked --no-default-features

- name: cargo test (rustls_mbedcrypto_provider; debug; no default features; tls12)
run: cargo test --locked --no-default-features --features tls12 --package rustls-mbedcrypto-provider

- name: cargo test (rustls_mbedcrypto_provider; debug; no default features; tls12, rdrand)
run: cargo test --locked --no-default-features --features tls12,rdrand --package rustls-mbedcrypto-provider

- name: cargo test (release; no run)
run: cargo test --locked --release --no-run

# TODO: add fuzz tests
# TODO: add benchmarks

docs:
name: Check for documentation errors
runs-on: ubuntu-20.04
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install rust toolchain
uses: dtolnay/rust-toolchain@nightly

- name: cargo doc (all packages; all features)
run: cargo doc --locked --all-features --no-deps --document-private-items
env:
RUSTDOCFLAGS: -Dwarnings

coverage:
name: Measure coverage
runs-on: ubuntu-20.04
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools

- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov

- name: Measure coverage
run: ./admin/coverage --lcov --output-path final.info

- name: Report to codecov.io
uses: codecov/codecov-action@v3
with:
file: final.info
fail_ci_if_error: false

# TODO: enable this after crate is published
# semver:
# name: Check semver compatibility
# runs-on: ubuntu-latest
# steps:
# - name: Checkout sources
# uses: actions/checkout@v4
# with:
# persist-credentials: false

# - name: Check semver
# uses: obi1kenobi/cargo-semver-checks-action@v2

format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy --locked --package rustls-mbedcrypto-provider --all-features --all-targets -- --deny warnings
- run: cargo clippy --locked --package rustls-mbedcrypto-provider --no-default-features --all-targets -- --deny warnings

clippy-nightly:
name: Clippy (Nightly)
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Install rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- run: cargo clippy --locked --package rustls-mbedcrypto-provider --all-features --all-targets
- run: cargo clippy --locked --package rustls-mbedcrypto-provider --no-default-features --all-targets
28 changes: 0 additions & 28 deletions .github/workflows/ci.yml

This file was deleted.

12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
.vscode/
target/

*.gcda
*.gcno
*.info
sslkeylogfile.txt
admin/rustfmt
.DS_Store
._.DS_Store
**/.DS_Store
**/._.DS_Store
/.idea
/default.profraw
2 changes: 1 addition & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
chain_width=40
max_width = 128
struct_lit_width = 80
struct_lit_width = 80
10 changes: 10 additions & 0 deletions admin/coverage
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -e

source <(cargo llvm-cov show-env --export-prefix)
cargo llvm-cov clean --workspace

cargo build --locked --all-targets --all-features
cargo test --locked --all-features
cargo llvm-cov report "$@"

0 comments on commit 3a8b96a

Please sign in to comment.