Skip to content
Open
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
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [duesee]
21 changes: 21 additions & 0 deletions .github/actions/cache_restore/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: cache_restore
runs:
using: composite
steps:
- uses: actions/cache/restore@v4
with:
path: |
# See https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
# See https://doc.rust-lang.org/cargo/guide/build-cache.html
target
key: ${{ runner.os }}|${{ github.job }}|${{ github.run_attempt }}
restore-keys: |
${{ runner.os }}|${{ github.job }}
${{ runner.os }}

18 changes: 18 additions & 0 deletions .github/actions/cache_save/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: cache_save
runs:
using: composite
steps:
- uses: actions/cache/save@v4
with:
path: |
# See https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
# See https://doc.rust-lang.org/cargo/guide/build-cache.html
target
key: ${{ runner.os }}|${{ github.job }}|${{ github.run_attempt }}

14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "weekly"
groups:
dependencies:
patterns:
- "*"
26 changes: 26 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: audit
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
# 21:43 on Wednesday and Sunday. (Thanks, crontab.guru)
- cron: '43 21 * * 3,0'
workflow_dispatch:

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

jobs:
audit:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- uses: ./.github/actions/cache_restore
- run: cargo install just
- run: just audit
- uses: ./.github/actions/cache_save
95 changes: 95 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: main
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

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

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/cache_restore
- run: cargo install just
- run: just check
- uses: ./.github/actions/cache_save

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

steps:
- uses: actions/checkout@v6

- uses: ./.github/actions/cache_restore
- run: cargo install just
- run: just test
- uses: ./.github/actions/cache_save

# benchmark:
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v6

# - uses: ./.github/actions/cache_restore
# - run: cargo install just
# - run: just bench_against_main
# - uses: ./.github/actions/cache_save

coverage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- uses: ./.github/actions/cache_restore
- run: cargo install just
- run: just coverage
- uses: ./.github/actions/cache_save

- uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e
with:
format: lcov
file: target/coverage/coverage.lcov

fuzz:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- uses: ./.github/actions/cache_restore
- run: cargo install just
- run: just fuzz
- uses: ./.github/actions/cache_save

check_msrv:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- uses: ./.github/actions/cache_restore
- run: cargo install just
- run: just check_msrv
- uses: ./.github/actions/cache_save

check_minimal_dependency_versions:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- uses: ./.github/actions/cache_restore
- run: cargo install just
- run: just check_minimal_dependency_versions
- uses: ./.github/actions/cache_save

42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: release

on:
push:
tags:
- 'smtp-codec/v*'
- 'smtp-types/v*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Extract crate name from Git tag
run: |
set -euo pipefail
tag_name=${GITHUB_REF#refs/tags/}
crate_name=${tag_name%/v*}
echo "Extracted crate name: $crate_name"
echo "CRATE_NAME=$crate_name" >> "$GITHUB_ENV"

- uses: actions/checkout@v6

- name: Assert release version matches crate version
run: |
set -euo pipefail

# Get release version from Git tag
tag_version=${GITHUB_REF#refs/tags/$CRATE_NAME/v}

# Get crate version from Cargo.toml
cd $CRATE_NAME
crate_version=$(cargo read-manifest | jq -r .version)

if [ "$tag_version" != "$crate_version" ]; then
echo "Error: Release version in Git tag (${tag_version}) does not match crate version in Cargo.toml (${crate_version}) for crate $CRATE_NAME."
exit 1
fi

- name: Publish crate to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -p $CRATE_NAME
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Cargo.lock
Comment thread
duesee marked this conversation as resolved.
/target
target
.idea

# direnv (https://direnv.net/)
.envrc
.direnv

nohup.out
30 changes: 30 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Welcome to smtp-codec's (and smtp-types') contributing guide

Thanks for investing your time to help with this project! Keep in mind that this project is driven by volunteers. Be patient and polite, and empower others to improve. Always use your best judgment and be excellent to each other.

## Principles

### Misuse resistance

We use strong-typing to eliminate invalid state.
Ask yourself: Can I instantiate a type with an invalid variable setting?
If yes, consider how to eliminate it.
If you're unsure, let's figure it out together!

## Project management

We use the [just](https://github.com/casey/just) command runner for Continuous Integration (CI).
The GitHub Actions infrastructure merely calls `just` to execute jobs.
This means that you can run all required tests for a PR using `just ci`.

### Code formatting

Please ensure that all code is formatted using `cargo +nightly fmt`.

### Testing

Run tests with `cargo test --all-features`.

## License

By contributing to this project, you agree to license your contributions under the same license as the project (MIT OR Apache-2.0).
115 changes: 115 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[workspace]
resolver = "2"
members = [
"smtp-types",
"smtp-codec",
"smtp-types",
]

[patch.crates-io]
smtp-types = { path = "smtp-types" }
smtp-codec = { path = "smtp-codec" }
[workspace.package]
rust-version = "1.85"
Loading
Loading