Skip to content

Commit

Permalink
ci/github (#4)
Browse files Browse the repository at this point in the history
* Add one codecov

* Merge another codecov

* Merge another codecov

* Merge another codecov

* Merge another codecov

* Place codecov config under .github

* Add (only) ASAN workflow

* Add first coverage workflow

* Merge another coverage.yml

* Merge another coverage.yml

* Add first features workflow

* Merge another features workflow

* Merge another features workflow

* Merge another features workflow

* Add (only) loom workflow

* Add (only) LSAN workflow

* Add first minial workflow

* Add (only) miri workflow

* Add first msrv workflow

* Merge another msrv workflow

* Merge another msrv workflow

* Merge another msrv workflow

* Add (only) no-std workflow

* Add first os-check workflow

* Merge another os-check workflow

* Add first style workflow

* Merge another style workflow

* Merge another style workflow

* Add first test workflow

* Merge another test workflow

* Merge another test workflow

* Merge another test workflow

* Make everything use checkout@v3

* Standardize on 'main' as branch name

* Missed a submodule checkout

* Add TODOs from twitter thread

* Practice what you preach

* mv github .github

This should make it possible to have rust-ci-conf as a remote you merge
from.

* Merge safety workflows

* Catch upcoming deprecations

* More concise name for scheduled jobs

* Allow examples and binaries to require features

* Use dependabot, but only for major versions

* ignore is a list

* Notify if actions themselves are outdated

* Bump codecov/codecov-action from 2 to 3

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2 to 3.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@v2...v3)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Move to maintained rust installer

See actions-rs/toolchain#216

* Fix install message for msrv

* Get rid of most actions-rs bits

Given that that project is unmaintained.

actions-rs/toolchain#216

* Minimal token permissions

See tokio-rs/tokio#5072

* Remove -Zmiri-tag-raw-pointers as it's now default

* Unbreak cargo hack for non-libraries (#4)

* Add action to run doctest. (#3)

`cargo test --all-features` does not run doc-tests. For more information
see rust-lang/cargo#6669.

* chore: automatically cancel superseded Actions runs (#5)

* [sanity] More robust injection of opt-level 1 (#9)

Fixes #8

* Quote MSRV version to avoid float parsing (#11)

Put 1.70 in there (for instance if you want to pin against OnceLock stabilizing) and it will actually test 1.7 as it appears github auto converts this to a float?

Putting in quotes seems to do the right thing here

* Install Openssl for Windows (#12)

* Don't install OpenSSL on Windows by default

* Bump actions/checkout from 3 to 4 (#13)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs: Add documentation based on the youtube video (#10)

* Nit: Selecting direct minimal versions flag is -Zdirect-minimal-versions (#16)

* Add one codecov

* Merge another codecov

* Merge another codecov

* Merge another codecov

* Merge another codecov

* Place codecov config under .github

* Add (only) ASAN workflow

* Add first coverage workflow

* Merge another coverage.yml

* Merge another coverage.yml

* Add first features workflow

* Merge another features workflow

* Merge another features workflow

* Merge another features workflow

* Add (only) loom workflow

* Add (only) LSAN workflow

* Add first minial workflow

* Add (only) miri workflow

* Add first msrv workflow

* Merge another msrv workflow

* Merge another msrv workflow

* Merge another msrv workflow

* Add (only) no-std workflow

* Add first os-check workflow

* Merge another os-check workflow

* Add first style workflow

* Merge another style workflow

* Merge another style workflow

* Add first test workflow

* Merge another test workflow

* Merge another test workflow

* Merge another test workflow

* Make everything use checkout@v3

* Standardize on 'main' as branch name

* Missed a submodule checkout

* Add TODOs from twitter thread

* Practice what you preach

* mv github .github

This should make it possible to have rust-ci-conf as a remote you merge
from.

* Merge safety workflows

* Catch upcoming deprecations

* More concise name for scheduled jobs

* Allow examples and binaries to require features

* Use dependabot, but only for major versions

* ignore is a list

* Notify if actions themselves are outdated

* Bump codecov/codecov-action from 2 to 3

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2 to 3.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@v2...v3)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Move to maintained rust installer

See actions-rs/toolchain#216

* Fix install message for msrv

* Get rid of most actions-rs bits

Given that that project is unmaintained.

actions-rs/toolchain#216

* Minimal token permissions

See tokio-rs/tokio#5072

* Remove -Zmiri-tag-raw-pointers as it's now default

* Unbreak cargo hack for non-libraries (#4)

* Add action to run doctest. (#3)

`cargo test --all-features` does not run doc-tests. For more information
see rust-lang/cargo#6669.

* chore: automatically cancel superseded Actions runs (#5)

* [sanity] More robust injection of opt-level 1 (#9)

Fixes #8

* Quote MSRV version to avoid float parsing (#11)

Put 1.70 in there (for instance if you want to pin against OnceLock stabilizing) and it will actually test 1.7 as it appears github auto converts this to a float?

Putting in quotes seems to do the right thing here

* Install Openssl for Windows (#12)

* Don't install OpenSSL on Windows by default

* Bump actions/checkout from 3 to 4 (#13)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs: Add documentation based on the youtube video (#10)

* Nit: Selecting direct minimal versions flag is -Zdirect-minimal-versions (#16)

* chore(github): create the code owners file

* chore(github): add the funding methods

* chore(github): create the issue templates

* chore(github): create the PR template

* chore(mergify): create `mergify` config

* chore(github): remove the `nostd` workflow

* chore(github): remove the `os-check` step and updated the branch name

* chore(github): create the CI workflow

* chore(github): update the branch name

* fix(workflow): disable the loom step for now

* fix(minimal-versions): set the minimal versoin of `thiserror` at 1.0.2

* fix(workflow): update the minimal rust version

* chore(codespell): create the codespell ignore file

* fix(workflow): don't try to build on windows or macos

* docs: fix typos

* chore(codespell): ignore `crate`

* fix(workflow): install X11

* fix(workflow): fix typos

* chore(mergify): disable the Dbpndabot rule

* chore(github): remove the CI workflow

* chore(github): add lint step to the test workflow

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Jon Gjengset <jon@thesquareplanet.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tudyx <56633664+Tudyx@users.noreply.github.com>
Co-authored-by: Burkhard Mittelbach <wasabi37a@googlemail.com>
Co-authored-by: Simen Bekkhus <sbekkhus91@gmail.com>
Co-authored-by: James Chacon <chacon.james@gmail.com>
Co-authored-by: Rod Elias <rodiney@gmail.com>
Co-authored-by: Josh McKinney <joshka@users.noreply.github.com>
Co-authored-by: Mathias Pius <g+github@pius.io>
  • Loading branch information
10 people committed Dec 12, 2023
1 parent 19a6d13 commit ef500f8
Show file tree
Hide file tree
Showing 21 changed files with 659 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .codespellignore
@@ -0,0 +1,3 @@
lqth
Lqth
crate
8 changes: 8 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
@@ -0,0 +1,8 @@
# See https://help.github.com/articles/about-codeowners/
# for more info about CODEOWNERS file

# It uses the same pattern rule for gitignore file
# https://git-scm.com/docs/gitignore#_pattern_format

# Core
* @0x61nas
23 changes: 23 additions & 0 deletions .github/DOCS.md
@@ -0,0 +1,23 @@
# Github config and workflows

In this folder there is configuration for codecoverage, dependabot, and ci
workflows that check the library more deeply than the default configurations.

This folder can be or was merged using a --allow-unrelated-histories merge
strategy from <https://github.com/jonhoo/rust-ci-conf/> which provides a
reasonably sensible base for writing your own ci on. By using this strategy
the history of the CI repo is included in your repo, and future updates to
the CI can be merged later.

To perform this merge run:

```shell
git remote add ci https://github.com/jonhoo/rust-ci-conf.git
git fetch ci
git merge --allow-unrelated-histories ci/main
```

An overview of the files in this project is available at:
<https://www.youtube.com/watch?v=xUH-4y92jPg&t=491s>, which contains some
rationale for decisions and runs through an example of solving minimal version
and OpenSSL issues.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
@@ -0,0 +1,3 @@
#github: 0x61nas
custom: ["https://www.buymeacoffee.com/0x61nas"]
ko_fi: 0x61nas
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,41 @@
---
name: Bug report 🐛
about: Report a bug to help us improve
title: ""
labels: "bug"
assignees: "0x61nas"
---

**Describe the bug**

<!--- A clear and concise description of what the bug is. -->

**To reproduce**

<!---
Steps to reproduce the behavior:
1. Build with '...' arguments
2. Run with '....' arguments
4. Use '...' configuration options
5. See error
-->

**Expected behavior**

<!--- A clear and concise description of what you expected to happen. -->

**Screenshots / Logs**

<!--- If applicable, add screenshots to help explain your problem. -->

**Software information**

<!--- Please fill the following fields -->

- Operating system: <!--- e.g. Arch GNU/Linux x86_64 6.2.1-arch1-1 -->
- Rust version: <!--- e.g. rustc 1.69.0-nightly (7281249a1 2023-02-27) -->
- Project version: <!--- e.g. 0.1.0 -->

**Additional context**

<!--- Add any other context about the problem here. -->
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,23 @@
---
name: Feature request
about: Make a suggestion for the project
title: ""
labels: "enhancement"
assignees: "0x61nas"
---

**Is your feature request related to a problem? Please describe.**

<!--- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

**Describe the solution you'd like**

<!--- A clear and concise description of what you want to happen. -->

**Describe alternatives you've considered**

<!--- A clear and concise description of any alternative solutions or features you've considered. -->

**Additional context**

<!--- Add any other context or screenshots about the feature request here. -->
40 changes: 40 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,40 @@
<!--- Thank you for contributing to lqth! -->

## Description

<!--- Describe your changes in detail -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

## Screenshots / Logs (if applicable)

## Types of Changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation (no code change)
- [ ] Refactor (refactoring production code)
- [ ] Other <!--- (provide information) -->

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->

- [ ] My code follows the code style of this project.
- [ ] I have updated the documentation accordingly.
- [ ] I have formatted the code with [rustfmt](https://github.com/rust-lang/rustfmt).
- [ ] I checked the lints with [clippy](https://github.com/rust-lang/rust-clippy).
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
21 changes: 21 additions & 0 deletions .github/codecov.yml
@@ -0,0 +1,21 @@
# ref: https://docs.codecov.com/docs/codecovyml-reference
coverage:
# Hold ourselves to a high bar
range: 85..100
round: down
precision: 1
status:
# ref: https://docs.codecov.com/docs/commit-status
project:
default:
# Avoid false negatives
threshold: 1%

# Test files aren't important for coverage
ignore:
- "tests"

# Make comments less noisy
comment:
layout: "files"
require_changes: true
19 changes: 19 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
- package-ecosystem: cargo
directory: /
schedule:
interval: daily
ignore:
- dependency-name: "*"
# patch and minor updates don't matter for libraries as consumers of this library build
# with their own lockfile, rather than the version specified in this library's lockfile
# remove this ignore rule if your package has binaries to ensure that the binaries are
# built with the exact set of dependencies and those are up to date.
update-types:
- "version-update:semver-patch"
- "version-update:semver-minor"
23 changes: 23 additions & 0 deletions .github/mergify.yml
@@ -0,0 +1,23 @@
pull_request_rules:
# - name: Automatic merge for Dependabot pull requests
# conditions:
# - "author=dependabot[bot]"
# - "check-success=ci"
# actions:
# merge:
# method: squash

- name: Automatic update to the aurora branch for pull requests
conditions:
- -conflict # skip PRs with conflicts
- -draft # skip GH draft PRs
- -author=dependabot[bot] # skip dependabot PRs
actions:
update:

- name: Automatic merge on approval
conditions:
- "#approved-reviews-by>=1"
actions:
merge:
method: squash
167 changes: 167 additions & 0 deletions .github/workflows/check.yml
@@ -0,0 +1,167 @@
# This workflow runs whenever a PR is opened or updated, or a commit is pushed to aurora. It runs
# several checks:
# - fmt: checks that the code is formatted according to rustfmt
# - clippy: checks that the code does not contain any clippy warnings
# - doc: checks that the code can be documented without errors
# - hack: check combinations of feature flags
# - msrv: check that the msrv specified in the crate is correct
permissions:
contents: read
# This configuration allows auroratainers of this repo to create a branch and pull request based on
# the new branch. Restricting the push trigger to the aurora branch ensures that the PR only gets
# built once.
on:
push:
branches: [aurora]
pull_request:
# If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that
# we don't waste CI time, and returns results quicker https://github.com/jonhoo/rust-ci-conf/pull/5
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
name: check
jobs:
fmt:
runs-on: ubuntu-latest
name: stable / fmt
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: cargo fmt --check
run: cargo fmt --check
clippy:
runs-on: ubuntu-latest
name: ${{ matrix.toolchain }} / clippy
permissions:
contents: read
checks: write
strategy:
fail-fast: false
matrix:
# Get early warning of new lints which are regularly introduced in beta channels.
toolchain: [stable, beta]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- name: cargo clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
doc:
# run docs generation on nightly rather than stable. This enables features like
# https://doc.rust-lang.org/beta/unstable-book/language-features/doc-cfg.html which allows an
# API be documented as only available in some specific platforms.
runs-on: ubuntu-latest
name: nightly / doc
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install nightly
uses: dtolnay/rust-toolchain@nightly
- name: cargo doc
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: --cfg docsrs
hack:
# cargo-hack checks combinations of feature flags to ensure that features are all additive
# which is required for feature unification
runs-on: ubuntu-latest
name: ubuntu / stable / features
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: cargo install cargo-hack
uses: taiki-e/install-action@cargo-hack
# intentionally no target specifier; see https://github.com/jonhoo/rust-ci-conf/pull/4
# --feature-powerset runs for every combination of features
- name: cargo hack
run: cargo hack --feature-powerset check
msrv:
# check that we can build using the minimal rust version that is specified by this crate
runs-on: ubuntu-latest
# we use a matrix here just because env can't be used in job names
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
strategy:
matrix:
msrv: ["1.65.0"] # 2021 edition requires 1.56
name: ubuntu / ${{ matrix.msrv }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install ${{ matrix.msrv }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.msrv }}
- name: cargo +${{ matrix.msrv }} check
run: cargo check

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
if: github.event_name != 'pull_request'
uses: actions/checkout@v4
- name: Checkout the repository
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy

- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2

- name: Run cargo-deny
uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check licenses sources

- name: Run cargo-audit
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run committed
uses: crate-ci/committed@master
with:
args: "-vv"
commits: "HEAD"

- name: Run lychee
uses: lycheeverse/lychee-action@v1
with:
args: -v *.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run codespell
uses: codespell-project/actions-codespell@master
with:
check_filenames: true
check_hidden: true
ignore_words_file: .codespellignore
skip: target,.git,_typos.toml

0 comments on commit ef500f8

Please sign in to comment.