Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Update CI. #11

Merged
merged 3 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Check API

on:
push:
branches: [ main ]
paths:
- '**.rs'
- '**.toml'
- '.github/workflows/**'
pull_request:
branches: [ main ]
paths:
- '**.rs'
- '**.toml'
- '.github/workflows/**'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
semver:
runs-on: ubuntu-latest

steps:
- name: Setup | Install cargo-semver-checks
run: cargo install cargo-semver-checks --locked

- name: Setup | Checkout code
uses: actions/checkout@v3

- name: Check for SemVer violations | pop3-codec
run: cargo semver-checks check-release
File renamed without changes.
172 changes: 172 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
name: Build & Test

on:
push:
branches: [ main ]
paths:
- "**.rs"
- "**.toml"
- ".github/workflows/**"
pull_request:
branches: [ main ]
paths:
- "**.rs"
- "**.toml"
- ".github/workflows/**"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- uses: taiki-e/install-action@v2
with:
tool: cargo-hack

- name: Check
run: cargo hack check --workspace

test:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup | Install toolchain
run: |
rustup toolchain install stable --profile minimal
rustup toolchain install nightly --profile minimal

- name: Setup | Install cargo-fuzz
run: |
cargo install cargo-fuzz

- name: Setup | Cache dependencies
uses: Swatinem/[email protected]
id: cache
with:
cache-all-crates: true

- name: Test | Everything w/o fuzzing (macOS, Ubuntu)
if: matrix.os != 'windows-latest'
run: |
for build_mode in "" "--release";
do
for feature_mode in "" "--all-features";
do
echo "# Testing" ${build_mode} ${feature_mode}
cargo test --workspace ${build_mode} ${feature_mode} --doc
cargo test --workspace ${build_mode} ${feature_mode} --all-targets
done
done

- name: Test | Everything w/o fuzzing (Windows)
if: matrix.os == 'windows-latest'
run: |
$build_modes = @('','--release')
$feature_modes = @('','--all-features')

foreach ($build_mode in $build_modes) {
foreach ($feature_mode in $feature_modes) {
echo "# Testing" ${build_mode} ${feature_mode}
cargo test --workspace ${build_mode} ${feature_mode} --doc
cargo test --workspace ${build_mode} ${feature_mode} --all-targets
}
}

- name: Test | Limited fuzzing (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
for fuzz_target in $(cargo +nightly fuzz list);
do
echo "# Fuzzing ${fuzz_target}";
cargo +nightly fuzz run --features=ext ${fuzz_target} -- -dict=fuzz/terminals.dict -max_len=256 -only_ascii=1 -runs=25000
done

minimal-versions:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup | Install toolchain
run: |
# 1.65 is the Minimum Supported Rust Version (MSRV) for pop3-codec.
rustup toolchain install 1.65 --profile minimal
rustup toolchain install nightly --profile minimal

- name: Setup | Cache dependencies
uses: Swatinem/[email protected]
id: cache
with:
cache-all-crates: true

- name: Check
run: |
cargo +nightly update -Z minimal-versions
cargo +1.65 check --workspace --all-targets --all-features
cargo +1.65 test --workspace --all-targets --all-features
env:
RUSTFLAGS: -Dwarnings

audit:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Audit dependencies
uses: EmbarkStudios/cargo-deny-action@7257a18a9c2fe3f92b85d41ae473520dff953c97

clippy:
runs-on: ubuntu-latest

steps:
- name: Install toolchain
uses: actions-rs/toolchain@88dc2356392166efad76775c878094f4e83ff746
with:
profile: minimal
toolchain: stable
override: true
components: clippy

- name: Checkout code
uses: actions/checkout@v3

- name: Check for common mistakes and missed improvements
uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features

formatting:
runs-on: ubuntu-latest

steps:
- name: Install nightly toolchain
uses: actions-rs/toolchain@88dc2356392166efad76775c878094f4e83ff746
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt

- name: Checkout code
uses: actions/checkout@v3

- name: Check code formatting
run: cargo +nightly fmt --check
92 changes: 0 additions & 92 deletions .github/workflows/ci.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Measure test coverage

on:
push:
branches: [ main ]
paths:
- '**.rs'
- '**.toml'
- '.github/workflows/**'
pull_request:
branches: [ main ]
paths:
- '**.rs'
- '**.toml'
- '.github/workflows/**'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
coverage:
runs-on: ubuntu-latest

steps:
- name: Setup
run: |
rustup component add llvm-tools-preview
cargo install grcov

- name: Checkout code
uses: actions/checkout@v3

- name: Measure test coverage
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "coverage-%m-%p.profraw"
run: |
cargo test --all-features
grcov . \
--source-dir . \
--binary-path target/debug \
--branch \
--keep-only 'src/**' \
--output-types "lcov" \
--llvm > coveralls.lcov

- name: Upload to Coveralls
uses: coverallsapp/github-action@v2
with:
format: lcov
file: coveralls.lcov
16 changes: 16 additions & 0 deletions .github/workflows/issue_opened.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Process opened issues

on:
issues:
types:
- opened

jobs:
add-to-project:
name: Add opened issue to project board
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
project-url: https://github.com/users/duesee/projects/2
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[![Build & Test](https://github.com/duesee/pop3-codec/actions/workflows/build_and_test.yml/badge.svg)](https://github.com/duesee/pop3-codec/actions/workflows/build_and_test.yml)
[![Audit](https://github.com/duesee/pop3-codec/actions/workflows/audit.yml/badge.svg)](https://github.com/duesee/pop3-codec/actions/workflows/audit.yml)
[![Coverage](https://coveralls.io/repos/github/duesee/pop3-codec/badge.svg?branch=main)](https://coveralls.io/github/duesee/pop3-codec?branch=main)
[![Documentation](https://docs.rs/pop3-codec/badge.svg)](https://docs.rs/pop3-codec)

[![CI](https://github.com/duesee/pop3-codec/actions/workflows/ci.yml/badge.svg)](https://github.com/duesee/pop3-codec/actions/workflows/ci.yml)
[![Scheduled](https://github.com/duesee/pop3-codec/actions/workflows/scheduled.yml/badge.svg)](https://github.com/duesee/pop3-codec/actions/workflows/scheduled.yml)
[![docs](https://docs.rs/pop3-codec/badge.svg)](https://docs.rs/pop3-codec)
Expand All @@ -6,7 +11,7 @@

This crate provides types and parsers for POP3 commands. Responses are not implemented yet.

# Overview of (all?) RFCs related to POP3
# Overview of POP3 RFCs

![Overview of POP3 RFCs](./assets/overview.svg)

Expand Down
3 changes: 3 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
format_code_in_doc_comments=true
group_imports="StdExternalCrate"
imports_granularity="Crate"
Loading