Skip to content

Commit ddc7aab

Browse files
authored
chore: add CI, Codeowners, and issue/PR templates (#1)
These are mostly copied over from `tokio-rs/tracing`, with modifications (removing builds for other crates, etc).
1 parent df9c4d2 commit ddc7aab

File tree

9 files changed

+361
-0
lines changed

9 files changed

+361
-0
lines changed

.config/nextest.toml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# recommended nextest profile for CI jobs (from
2+
# https://nexte.st/book/configuration.html#profiles)
3+
[profile.ci]
4+
# Print out output for failing tests as soon as they fail, and also at the end
5+
# of the run (for easy scrollability).
6+
failure-output = "immediate-final"
7+
# Do not cancel the test run on the first failure.
8+
fail-fast = false
9+
10+
# TODO(eliza): uncomment this when we can get nicer JUnit output from nextest...
11+
# [profile.ci.junit]
12+
# path = "junit.xml"

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @jtescher

.github/ISSUE_TEMPLATE/bug_report.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: 🐛 Bug Report
3+
about: If something isn't working as expected 🤔.
4+
5+
---
6+
7+
## Bug Report
8+
<!--
9+
Thank you for reporting an issue.
10+
11+
Please fill in as much of the template below as you're able.
12+
-->
13+
14+
### Version
15+
16+
<!--
17+
List the versions of all `tracing` crates you are using. The easiest way to get
18+
this information is using `cargo-tree`.
19+
20+
`cargo install cargo-tree`
21+
(see install here: https://github.com/sfackler/cargo-tree)
22+
23+
Then:
24+
25+
`cargo tree | grep tracing`
26+
-->
27+
28+
### Platform
29+
30+
<!---
31+
Output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows)
32+
-->
33+
34+
### Description
35+
36+
<!--
37+
38+
Enter your issue details below this comment.
39+
40+
One way to structure the description:
41+
42+
<short summary of the bug>
43+
44+
I tried this code:
45+
46+
<code sample that causes the bug>
47+
48+
I expected to see this happen: <explanation>
49+
50+
Instead, this happened: <explanation>
51+
-->
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: 💡 Feature Request
3+
about: I have a suggestion (and may want to implement it 🙂)!
4+
5+
---
6+
7+
## Feature Request
8+
9+
### Motivation
10+
11+
<!--
12+
Please describe the use case(s) or other motivation for the new feature.
13+
-->
14+
15+
### Proposal
16+
17+
<!--
18+
How should the new feature be implemented, and why? Add any considered
19+
drawbacks.
20+
-->
21+
22+
### Alternatives
23+
24+
<!--
25+
Are there other ways to solve this problem that you've considered? What are
26+
their potential drawbacks? Why was the proposed solution chosen over these
27+
alternatives?
28+
-->

.github/PULL_REQUEST_TEMPLATE.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!--
2+
Thank you for your Pull Request. Please provide a description above and review
3+
the requirements below.
4+
5+
Bug fixes and new features should include tests.
6+
7+
Contributors guide: https://github.com/tokio-rs/tracing-opentelemetry/blob/master/CONTRIBUTING.md
8+
-->
9+
10+
## Motivation
11+
12+
<!--
13+
Explain the context and why you're making that change. What is the problem
14+
you're trying to solve? If a new feature is being added, describe the intended
15+
use case that feature fulfills.
16+
-->
17+
18+
## Solution
19+
20+
<!--
21+
Summarize the solution and provide any necessary context needed to understand
22+
the code change.
23+
-->

.github/dependabot.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: cargo
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
ignore:
9+
- dependency-name: opentelemetry-jaeger
10+
versions:
11+
- 0.12.0
12+
- dependency-name: opentelemetry
13+
versions:
14+
- 0.13.0

.github/workflows/CI.yml

+175
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request: {}
8+
9+
env:
10+
# Disable incremental compilation.
11+
#
12+
# Incremental compilation is useful as part of an edit-build-test-edit cycle,
13+
# as it lets the compiler avoid recompiling code that hasn't changed. However,
14+
# on CI, we're not making small edits; we're almost always building the entire
15+
# project from scratch. Thus, incremental compilation on CI actually
16+
# introduces *additional* overhead to support making future builds
17+
# faster...but no future builds will ever occur in any given CI environment.
18+
#
19+
# See https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
20+
# for details.
21+
CARGO_INCREMENTAL: 0
22+
# Allow more retries for network requests in cargo (downloading crates) and
23+
# rustup (installing toolchains). This should help to reduce flaky CI failures
24+
# from transient network timeouts or other issues.
25+
CARGO_NET_RETRY: 10
26+
RUSTUP_MAX_RETRIES: 10
27+
# Don't emit giant backtraces in the CI logs.
28+
RUST_BACKTRACE: short
29+
30+
jobs:
31+
### check jobs ###
32+
33+
check:
34+
# Run `cargo check` first to ensure that the pushed code at least compiles.
35+
name: cargo check
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v3
39+
- uses: dtolnay/rust-toolchain@stable
40+
- name: Check
41+
run: cargo check --all --tests --benches
42+
43+
style:
44+
# Check style.
45+
name: cargo fmt
46+
needs: check
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v3
50+
- uses: dtolnay/rust-toolchain@stable
51+
with:
52+
components: rustfmt
53+
- name: rustfmt
54+
run: cargo fmt --all -- --check
55+
56+
warnings:
57+
# Check for any warnings. This is informational and thus is allowed to fail.
58+
runs-on: ubuntu-latest
59+
needs: check
60+
steps:
61+
- uses: actions/checkout@v3
62+
- uses: dtolnay/rust-toolchain@stable
63+
with:
64+
components: clippy
65+
- name: Clippy
66+
uses: actions-rs/clippy-check@v1
67+
with:
68+
token: ${{ secrets.GITHUB_TOKEN }}
69+
args: --all --examples --tests --benches -- -D warnings
70+
71+
cargo-hack:
72+
needs: check
73+
name: cargo check (feature combinations)
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/checkout@v3
77+
- uses: dtolnay/rust-toolchain@stable
78+
- name: install cargo-hack
79+
uses: taiki-e/install-action@cargo-hack
80+
- run: cargo hack check --feature-powerset --no-dev-deps
81+
82+
check-msrv:
83+
# Run `cargo check` on our minimum supported Rust version (1.56.0). This
84+
# checks with minimal versions; maximal versions are checked above.
85+
name: "cargo check (+MSRV -Zminimal-versions)"
86+
needs: check
87+
runs-on: ubuntu-latest
88+
strategy:
89+
matrix:
90+
toolchain:
91+
- 1.56.0
92+
- stable
93+
steps:
94+
- uses: actions/checkout@v3
95+
- name: install Rust nightly
96+
uses: dtolnay/rust-toolchain@nightly
97+
- name: "install Rust ${{ matrix.toolchain }}"
98+
uses: dtolnay/rust-toolchain@master
99+
with:
100+
toolchain: ${{ matrix.toolchain }}
101+
- name: install cargo-hack
102+
uses: taiki-e/install-action@cargo-hack
103+
- name: install cargo-minimal-versions
104+
uses: taiki-e/install-action@cargo-minimal-versions
105+
- name: cargo minimal-versions check
106+
working-directory: ${{ matrix.subcrate }}
107+
run: cargo minimal-versions check --feature-powerset --no-dev-deps
108+
109+
### test jobs #############################################################
110+
111+
test:
112+
# Test against stable Rust across macOS, Windows, and Linux, and against
113+
# beta and nightly rust on Ubuntu.
114+
name: "cargo test (${{ matrix.rust }} on ${{ matrix.os }})"
115+
needs: check
116+
strategy:
117+
matrix:
118+
# test all Rust versions on ubuntu-latest
119+
os: [ubuntu-latest]
120+
rust: [stable, beta, nightly]
121+
# test stable Rust on Windows and MacOS as well
122+
include:
123+
- rust: stable
124+
os: windows-latest
125+
- rust: stable
126+
os: macos-latest
127+
fail-fast: false
128+
runs-on: ${{ matrix.os }}
129+
steps:
130+
- uses: actions/checkout@v3
131+
- name: "install Rust ${{ matrix.rust }}"
132+
uses: dtolnay/rust-toolchain@master
133+
with:
134+
toolchain: ${{ matrix.rust }}
135+
- name: install cargo-nextest
136+
uses: taiki-e/install-action@nextest
137+
- name: Run tests
138+
run: cargo nextest run --profile ci --workspace
139+
# TODO(eliza): punt on this for now because the generated JUnit report is
140+
# missing some fields that this action needs to give good output.
141+
# - name: Publish Test Report
142+
# uses: mikepenz/action-junit-report@v3
143+
# if: always() # always run even if the previous step fails
144+
# with:
145+
# report_paths: 'target/nextest/ci/junit.xml'
146+
# check_name: "cargo test (Rust ${{ matrix.rust }} on ${{ matrix.os }})"
147+
# check_title_template: "{{SUITE_NAME}}::{{TEST_NAME}}"
148+
- name: Run doctests
149+
run: cargo test --doc --workspace
150+
151+
test-build-wasm:
152+
name: build tests (wasm)
153+
needs: check
154+
runs-on: ubuntu-latest
155+
steps:
156+
- uses: actions/checkout@v3
157+
- uses: dtolnay/rust-toolchain@stable
158+
with:
159+
target: wasm32-unknown-unknown
160+
- name: build all tests
161+
run: cargo test --no-run
162+
163+
# all required checks except for the main test run (which we only require
164+
# specific matrix combinations from)
165+
all_required:
166+
name: "all systems go!"
167+
runs-on: ubuntu-latest
168+
needs:
169+
- style
170+
- cargo-hack
171+
- check-msrv
172+
- test-build-wasm
173+
- test
174+
steps:
175+
- run: exit 0

.github/workflows/audit.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Security audit
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
7+
env:
8+
# Disable incremental compilation.
9+
#
10+
# Incremental compilation is useful as part of an edit-build-test-edit cycle,
11+
# as it lets the compiler avoid recompiling code that hasn't changed. However,
12+
# on CI, we're not making small edits; we're almost always building the entire
13+
# project from scratch. Thus, incremental compilation on CI actually
14+
# introduces *additional* overhead to support making future builds
15+
# faster...but no future builds will ever occur in any given CI environment.
16+
#
17+
# See https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
18+
# for details.
19+
CARGO_INCREMENTAL: 0
20+
# Allow more retries for network requests in cargo (downloading crates) and
21+
# rustup (installing toolchains). This should help to reduce flaky CI failures
22+
# from transient network timeouts or other issues.
23+
CARGO_NET_RETRY: 10
24+
RUSTUP_MAX_RETRIES: 10
25+
# Don't emit giant backtraces in the CI logs.
26+
RUST_BACKTRACE: short
27+
28+
jobs:
29+
security_audit:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v3
33+
- uses: actions-rs/audit-check@v1
34+
with:
35+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v[0-9]+.*
7+
8+
jobs:
9+
create-release:
10+
name: Create GitHub release
11+
# only publish from the origin repository
12+
if: github.repository_owner == 'tokio-rs'
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: taiki-e/create-gh-release-action@v1
17+
with:
18+
changelog: "CHANGELOG.md"
19+
title: "$version"
20+
branch: v0.1.x
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)