Skip to content

Commit

Permalink
Merge pull request #75 from lquerel/changelog-automation
Browse files Browse the repository at this point in the history
Code coverage automation + CHANGELOG.md init
  • Loading branch information
jsuereth authored Apr 3, 2024
2 parents bc9555a + 3af97af commit ec0d0c7
Show file tree
Hide file tree
Showing 64 changed files with 2,043 additions and 81 deletions.
16 changes: 16 additions & 0 deletions .github/codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 1
round: down
range: "60...100"
status:
project:
default:
target: auto
threshold: 0.5%

ignore:
- "crates/xtask" # Part of the build system
- "src" # CLI (not tested yet)
33 changes: 25 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ name: CI
permissions:
contents: read

on:
pull_request:
push:
branches:
- main
on: [push, pull_request]

env:
RUST_BACKTRACE: 1
Expand Down Expand Up @@ -54,7 +50,7 @@ jobs:
- name: No-default features
run: cargo test --workspace --no-default-features
msrv:
name: "Check MSRV: 1.70.0"
name: Check MSRV
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down Expand Up @@ -105,7 +101,7 @@ jobs:
# run: cargo doc --workspace --all-features --no-deps --document-private-items
run: cargo doc --workspace --no-deps --document-private-items
rustfmt:
name: rustfmt
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -121,6 +117,7 @@ jobs:
- name: Check formatting
run: cargo fmt --all -- --check
check-external-types:
name: Check external types
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -136,7 +133,7 @@ jobs:
cargo install cargo-check-external-types
./scripts/check_external_types.sh
clippy:
name: clippy
name: Clippy
runs-on: ubuntu-latest
permissions:
security-events: write # to upload sarif results
Expand Down Expand Up @@ -171,3 +168,23 @@ jobs:
wait-for-processing: true
- name: Report status
run: cargo clippy --workspace --all-targets -- -D warnings --allow deprecated
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin
- name: Gather coverage
run: cargo tarpaulin --workspace --output-dir coverage --out lcov -e xtask -e weaver
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: open-telemetry/weaver
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ just.zsh

# test generated code
**/observed_output/*

/output
98 changes: 96 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,99 @@

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [unreleased]

### 🚀 Features

- *(registry)* Improve resolved schema and registry api usability.
- *(registry)* Introduce the concept of named registries
- *(stats)* Implement registry stats command
- *(resolve)* Implement registry resolve command
- *(template)* Add a more complex example generating markdown files per group prefix
- *(template)* Reimplement template generation based on minijinja + jaq (jq-like filters)
- *(cli)* Add quiet mode
- *(generator)* Add support for all group types
- *(generator)* Add jq-like filter support to make artifact generation more flexible
- *(generator)* Complete the weaver registry generate command.
- *(cli)* Add update-markdown sub-command and align sub-command args in the registry command.
- *(registry)* Improve unit test to check the generated markdown
- *(registry)* Add unit test to check the generated markdown
- *(registry)* Generate markdown from jinja2 templates
- *(template)* Generate markdown files describing a registry
- *(template)* Add template syntax configuration
- *(template)* Initialize template engine with a root directory to support include clause.
- *(template)* Expose template.set_file_name method to dynamically define the file name of the output.
- *(template)* Generate registry from templates
- *(resolve)* Improve error reporting
- *(resolve)* Fix typo
- *(resolve)* Implement `include` constraint
- *(resolve)* Check `any_of` constraints
- *(template)* Integrate with minininja
- *(template)* Start integration of the case converter
- *(template)* Replace tera with minijinja to improve error handling
- *(registry)* Refactor registry sub-commands.
- *(registry)* Add `weaver check registry` command
- *(resolver)* Simplify semantic convention registry resolution function

### 🐛 Bug Fixes

- *(resolution)* Adjust other unit tests to take into account the fix
- *(resolution)* Make resolution process easy to test in unit tests
- *(resolution)* Fix resolution order
- *(resolution)* Create minimal example reproducing the bug

### 📚 Documentation

- *(template)* Add documentation to describe the template engine.
- Describe crates layout and add README.md files for every crates in the workspace.
- Clean up README.md

### 🧪 Testing

- *(integration)* Create integration test to check parsing and resolution of the official semconv repo.

### ⚙️ Miscellaneous Tasks

- *(coverage)* Improve test coverage
- *(coverage)* Remove xtask and main command line from the code coverage
- *(coverage)* Apply `tarpaulin` coverage to the entire workspace
- *(install)* Add `cargo tarpaulin` in the list of tools to install
- *(build)* Trigger ci.yml workflow for all push and pull request
- *(coverage)* Add test code coverage with cargo tarpaulin
- *(clippy)* Add more clippy lints
- *(clippy)* Fix more clippy issues
- *(clippy)* Fix explicit_into_iter_loop clippy issue
- *(git)* Make the output dir invisible for git
- *(changelog)* Add git cliff configuration
- *(code)* Make error enums non-exhaustive
- *(code)* Implement #54
- *(code)* Fix str_to_string clippy lint issues
- *(code)* Implement #54 + new clippy lint rule
- *(build)* Fix doc lint issue
- *(build)* Fix GH action
- *(build)* Add xtask
- *(build)* Replace script/check_workspace with cargo xtask validate
- *(build)* Define lint rules globally from the cargo workspace
- *(build)* Clippy lint rules to remove unwrap and enforce must_use when needed
- *(build)* Fix clippy issues
- *(doc)* Update README.md to describe check and generate sub-commands
- *(build)* Fix clippy issue
- *(build)* Fix merge issue.
- *(build)* Update cargo lock
- *(compatibility)* Align attribute type and examples definitions
- *(compatibility)* Align requirement level definition
- *(compatibility)* Align stability definition
- *(compatibility)* Make resolved registry compatible with official registry syntax
- *(clippy)* Fix clippy lint issues
- *(error)* Improve compound error management
- *(ci)* Fix toolchain version issue
- *(ci)* Attempt to fix toolchain version issue
- *(build)* Fix ci workflow
- *(build)* Fix scripts path
- *(build)* Remove allowed-external-types.toml files from the Typos control.
- *(build)* Add control procedures for workspace and public API policies
- *(build)* Run build and test only with ubuntu target for now.
- *(build)* Remove macos target for the build (API rate limit reached, we need to figure out that later).
- Add cargo lock file.
- *(dep)* Bump dependency versions
- Migrate f5/otel-weaver repo to open-telemetry/weaver repo
11 changes: 3 additions & 8 deletions Cargo.lock

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

61 changes: 61 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ unused_qualifications = "deny"
unused_results = "deny"
unused_extern_crates = "deny"

unsafe_op_in_unsafe_fn = "warn"
unused_macro_rules = "warn"

[lints]
workspace = true

Expand All @@ -119,3 +122,61 @@ type_complexity = "allow"
wrong_self_convention = "allow"
rc_buffer = "warn"
str_to_string = "warn"
checked_conversions = "warn"
create_dir = "warn"
dbg_macro = "warn"
debug_assert_with_mut_call = "warn"
empty_enum = "warn"
enum_glob_use = "warn"
exit = "warn"
expl_impl_clone_on_copy = "warn"
explicit_deref_methods = "warn"
explicit_into_iter_loop = "warn"
fallible_impl_from = "warn"
filter_map_next = "warn"
flat_map_option = "warn"
float_cmp_const = "warn"
fn_params_excessive_bools = "warn"
from_iter_instead_of_collect = "warn"
imprecise_flops = "warn"
inefficient_to_string = "warn"
infinite_loop = "warn"
invalid_upcast_comparisons = "warn"
items_after_statements = "warn"
large_digit_groups = "warn"
large_stack_arrays = "warn"
large_types_passed_by_value = "warn"
linkedlist = "warn"
lossy_float_literal = "warn"
macro_use_imports = "warn"
match_wildcard_for_single_variants = "warn"
mem_forget = "warn"
mutex_integer = "warn"
needless_continue = "warn"
needless_for_each = "warn"
negative_feature_names = "warn"
path_buf_push_overwrite = "warn"
ptr_as_ptr = "warn"
rc_mutex = "warn"
redundant_feature_names = "warn"
ref_option_ref = "warn"
rest_pat_in_fully_bound_structs = "warn"
same_functions_in_if_condition = "warn"
self_named_module_files = "warn"
semicolon_if_nothing_returned = "warn"
single_match_else = "warn"
string_add = "warn"
string_add_assign = "warn"
string_lit_as_bytes = "warn"
trait_duplication_in_bounds = "warn"
verbose_file_reads = "warn"
wildcard_imports = "warn"
zero_sized_map_values = "warn"
string_to_string = "warn"

#exhaustive_enums = "warn"
#doc_markdown = "warn"
#exhaustive_structs = "warn"
#todo = "warn"
#implicit_clone = "warn"
#inconsistent_struct_constructor = "warn"
89 changes: 89 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# git-cliff ~ default configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.

[changelog]
# changelog header
header = """
# Changelog\n
All notable changes to this project will be documented in this file.\n
"""
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits | unique(attribute="message") %}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }}\
{% endfor %}
{% endfor %}\n
"""
# template for the changelog footer
footer = """
<!-- generated by git-cliff -->
"""
# remove the leading and trailing s
trim = true
# postprocessors
postprocessors = [
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
]

[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# Replace issue numbers
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
# Check spelling of the commit with https://github.com/crate-ci/typos
# If the spelling is incorrect, it will be automatically fixed.
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore\\(deps.*\\)", skip = true },
{ message = "^chore\\(pr\\)", skip = true },
{ message = "^chore\\(pull\\)", skip = true },
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# regex for matching git tags
# tag_pattern = "v[0-9].*"
# regex for skipping tags
# skip_tags = ""
# regex for ignoring tags
# ignore_tags = ""
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "newest"
# limit the number of commits included in the changelog.
# limit_commits = 42
Loading

0 comments on commit ec0d0c7

Please sign in to comment.