Skip to content

Commit 7951087

Browse files
committed
Merge remote-tracking branch 'ci/main'
2 parents 2fdba7d + caa3616 commit 7951087

File tree

6 files changed

+182
-117
lines changed

6 files changed

+182
-117
lines changed

.github/DOCS.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Github config and workflows
2+
3+
In this folder there is configuration for codecoverage, dependabot, and ci
4+
workflows that check the library more deeply than the default configurations.
5+
6+
This folder can be or was merged using a --allow-unrelated-histories merge
7+
strategy from <https://github.com/jonhoo/rust-ci-conf/> which provides a
8+
reasonably sensible base for writing your own ci on. By using this strategy
9+
the history of the CI repo is included in your repo, and future updates to
10+
the CI can be merged later.
11+
12+
To perform this merge run:
13+
14+
```shell
15+
git remote add ci https://github.com/jonhoo/rust-ci-conf.git
16+
git fetch ci
17+
git merge --allow-unrelated-histories ci/main
18+
```
19+
20+
An overview of the files in this project is available at:
21+
<https://www.youtube.com/watch?v=xUH-4y92jPg&t=491s>, which contains some
22+
rationale for decisions and runs through an example of solving minimal version
23+
and OpenSSL issues.

.github/codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ ignore:
1818
# Make comments less noisy
1919
comment:
2020
layout: "files"
21-
require_changes: yes
21+
require_changes: true

.github/dependabot.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ updates:
1010
interval: daily
1111
ignore:
1212
- dependency-name: "*"
13-
# patch and minor updates don't matter for libraries
14-
# remove this ignore rule if your package has binaries
13+
# patch and minor updates don't matter for libraries as consumers of this library build
14+
# with their own lockfile, rather than the version specified in this library's lockfile
15+
# remove this ignore rule if your package has binaries to ensure that the binaries are
16+
# built with the exact set of dependencies and those are up to date.
1517
update-types:
1618
- "version-update:semver-patch"
1719
- "version-update:semver-minor"

.github/workflows/check.yml

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1+
# This workflow runs whenever a PR is opened or updated, or a commit is pushed to main. It runs
2+
# several checks:
3+
# - fmt: checks that the code is formatted according to rustfmt
4+
# - clippy: checks that the code does not contain any clippy warnings
5+
# - doc: checks that the code can be documented without errors
6+
# - hack: check combinations of feature flags
7+
# - msrv: check that the msrv specified in the crate is correct
8+
permissions:
9+
contents: read
10+
# This configuration allows maintainers of this repo to create a branch and pull request based on
11+
# the new branch. Restricting the push trigger to the main branch ensures that the PR only gets
12+
# built once.
113
on:
214
push:
315
branches: [main]
416
pull_request:
17+
# If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that
18+
# we don't waste CI time, and returns results quicker https://github.com/jonhoo/rust-ci-conf/pull/5
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
21+
cancel-in-progress: true
522
name: check
623
jobs:
724
fmt:
@@ -12,96 +29,85 @@ jobs:
1229
with:
1330
submodules: true
1431
- name: Install stable
15-
uses: actions-rs/toolchain@v1
32+
uses: dtolnay/rust-toolchain@stable
1633
with:
17-
profile: minimal
18-
toolchain: stable
1934
components: rustfmt
2035
- name: cargo fmt --check
21-
uses: actions-rs/cargo@v1
22-
with:
23-
command: fmt
24-
args: --check
36+
run: cargo fmt --check
2537
clippy:
2638
runs-on: ubuntu-latest
2739
name: ${{ matrix.toolchain }} / clippy
40+
permissions:
41+
contents: read
42+
checks: write
2843
strategy:
2944
fail-fast: false
3045
matrix:
46+
# Get early warning of new lints which are regularly introduced in beta channels.
3147
toolchain: [stable, beta]
3248
steps:
3349
- uses: actions/checkout@v4
3450
with:
3551
submodules: true
3652
- name: Install ${{ matrix.toolchain }}
37-
uses: actions-rs/toolchain@v1
53+
uses: dtolnay/rust-toolchain@master
3854
with:
39-
profile: minimal
4055
toolchain: ${{ matrix.toolchain }}
41-
default: true
4256
components: clippy
4357
- name: cargo clippy
44-
uses: actions-rs/clippy-check@v1
58+
uses: giraffate/clippy-action@v1
4559
with:
46-
token: ${{ secrets.GITHUB_TOKEN }}
60+
reporter: 'github-pr-check'
61+
github_token: ${{ secrets.GITHUB_TOKEN }}
4762
doc:
63+
# run docs generation on nightly rather than stable. This enables features like
64+
# https://doc.rust-lang.org/beta/unstable-book/language-features/doc-cfg.html which allows an
65+
# API be documented as only available in some specific platforms.
4866
runs-on: ubuntu-latest
4967
name: nightly / doc
5068
steps:
5169
- uses: actions/checkout@v4
5270
with:
5371
submodules: true
5472
- name: Install nightly
55-
uses: actions-rs/toolchain@v1
56-
with:
57-
profile: minimal
58-
toolchain: nightly
59-
default: true
73+
uses: dtolnay/rust-toolchain@nightly
6074
- name: cargo doc
61-
uses: actions-rs/cargo@v1
62-
with:
63-
command: doc
64-
args: --no-deps --all-features
75+
run: cargo doc --no-deps --all-features
6576
env:
6677
RUSTDOCFLAGS: --cfg docsrs
6778
hack:
79+
# cargo-hack checks combinations of feature flags to ensure that features are all additive
80+
# which is required for feature unification
6881
runs-on: ubuntu-latest
6982
name: ubuntu / stable / features
7083
steps:
7184
- uses: actions/checkout@v4
7285
with:
7386
submodules: true
7487
- name: Install stable
75-
uses: actions-rs/toolchain@v1
76-
with:
77-
profile: minimal
78-
toolchain: stable
88+
uses: dtolnay/rust-toolchain@stable
7989
- name: cargo install cargo-hack
8090
uses: taiki-e/install-action@cargo-hack
91+
# intentionally no target specifier; see https://github.com/jonhoo/rust-ci-conf/pull/4
92+
# --feature-powerset runs for every combination of features
8193
- name: cargo hack
82-
uses: actions-rs/cargo@v1
83-
with:
84-
command: hack
85-
args: --feature-powerset check --lib --tests
94+
run: cargo hack --feature-powerset check
8695
msrv:
96+
# check that we can build using the minimal rust version that is specified by this crate
8797
runs-on: ubuntu-latest
8898
# we use a matrix here just because env can't be used in job names
8999
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
90100
strategy:
91101
matrix:
92-
msrv: [1.66.0] # for jobserver
102+
msrv: ["1.66.0"] # for jobserver
93103
name: ubuntu / ${{ matrix.msrv }}
94104
steps:
95105
- uses: actions/checkout@v4
96106
with:
97107
submodules: true
98-
- name: Install ${{ matrix.toolchain }}
99-
uses: actions-rs/toolchain@v1
108+
- name: Install ${{ matrix.msrv }}
109+
uses: dtolnay/rust-toolchain@master
100110
with:
101-
profile: minimal
102111
toolchain: ${{ matrix.msrv }}
103-
default: true
104112
- name: cargo +${{ matrix.msrv }} check
105-
uses: actions-rs/cargo@v1
106-
with:
107-
command: check
113+
run: cargo check

.github/workflows/scheduled.yml

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
# Run scheduled (rolling) jobs on a nightly basis, as your crate may break independently of any
2+
# given PR. E.g., updates to rust nightly and updates to this crates dependencies. See check.yml for
3+
# information about how the concurrency cancellation and workflow triggering works
4+
permissions:
5+
contents: read
16
on:
27
push:
38
branches: [main]
49
pull_request:
510
schedule:
611
- cron: '7 7 * * *'
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
14+
cancel-in-progress: true
715
name: rolling
816
jobs:
917
# https://twitter.com/mycoliza/status/1571295690063753218
@@ -15,50 +23,36 @@ jobs:
1523
with:
1624
submodules: true
1725
- name: Install nightly
18-
uses: actions-rs/toolchain@v1
19-
with:
20-
profile: minimal
21-
toolchain: nightly
22-
default: true
26+
uses: dtolnay/rust-toolchain@nightly
2327
- name: cargo generate-lockfile
2428
if: hashFiles('Cargo.lock') == ''
25-
uses: actions-rs/cargo@v1
26-
with:
27-
command: generate-lockfile
29+
run: cargo generate-lockfile
2830
- name: cargo test --locked
29-
uses: actions-rs/cargo@v1
30-
with:
31-
command: test
32-
args: --locked --all-features --all-targets
31+
run: cargo test --locked --all-features --all-targets
3332
# https://twitter.com/alcuadrado/status/1571291687837732873
3433
update:
34+
# This action checks that updating the dependencies of this crate to the latest available that
35+
# satisfy the versions in Cargo.toml does not break this crate. This is important as consumers
36+
# of this crate will generally use the latest available crates. This is subject to the standard
37+
# Cargo semver rules (i.e cargo does not update to a new major version unless explicitly told
38+
# to).
3539
runs-on: ubuntu-latest
3640
name: ubuntu / beta / updated
37-
# There's no point running this if no Cargo.lock was checked in in the
38-
# first place, since we'd just redo what happened in the regular test job.
39-
# Unfortunately, hashFiles only works in if on steps, so we reepeat it.
40-
# if: hashFiles('Cargo.lock') != ''
41+
# There's no point running this if no Cargo.lock was checked in in the first place, since we'd
42+
# just redo what happened in the regular test job. Unfortunately, hashFiles only works in if on
43+
# steps, so we repeat it.
4144
steps:
4245
- uses: actions/checkout@v4
4346
with:
4447
submodules: true
4548
- name: Install beta
4649
if: hashFiles('Cargo.lock') != ''
47-
uses: actions-rs/toolchain@v1
48-
with:
49-
profile: minimal
50-
toolchain: beta
51-
default: true
50+
uses: dtolnay/rust-toolchain@beta
5251
- name: cargo update
5352
if: hashFiles('Cargo.lock') != ''
54-
uses: actions-rs/cargo@v1
55-
with:
56-
command: update
53+
run: cargo update
5754
- name: cargo test
5855
if: hashFiles('Cargo.lock') != ''
59-
uses: actions-rs/cargo@v1
60-
with:
61-
command: test
62-
args: --locked --all-features --all-targets
56+
run: cargo test --locked --all-features --all-targets
6357
env:
6458
RUSTFLAGS: -D deprecated

0 commit comments

Comments
 (0)