Skip to content

Commit 6f2bd3f

Browse files
committed
Big refactor
0 parents  commit 6f2bd3f

File tree

15 files changed

+955
-0
lines changed

15 files changed

+955
-0
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
day: tuesday

.github/renovate.json5

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"schedule": "every 6 weeks on tuesday",
4+
"customManagers": [
5+
{
6+
"customType": "regex",
7+
"fileMatch": [
8+
"Cargo.toml$"
9+
],
10+
"matchStrings": [
11+
"rust-version = \"(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)\""
12+
],
13+
"depNameTemplate": "rust-version",
14+
"packageNameTemplate": "rust-lang/rust",
15+
"datasourceTemplate": "github-releases"
16+
}
17+
],
18+
"packageRules": [
19+
{
20+
"commitMessageTopic": "bump rust-version",
21+
"matchManagers": [
22+
"custom.regex"
23+
],
24+
"matchPackageNames": [
25+
"rust-version"
26+
],
27+
"extractVersion": "^(?<version>\\d+\\.\\d+)", // drop patch version
28+
"schedule": [
29+
"* * * * *"
30+
],
31+
"minimumReleaseAge": "6 months",
32+
"internalChecksFilter": "strict"
33+
}
34+
]
35+
}

.github/workflows/automerge.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Auto-merge safe bot PRs
2+
on: pull_request
3+
4+
permissions:
5+
contents: write
6+
pull-requests: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: github.actor == 'dependabot[bot]'
12+
steps:
13+
- name: Enable auto-merge
14+
run: gh pr merge --auto --merge "$PR_URL"
15+
env:
16+
PR_URL: ${{github.event.pull_request.html_url}}
17+
18+
renovate:
19+
runs-on: ubuntu-latest
20+
if: github.actor == 'renovate[bot]'
21+
steps:
22+
- name: Enable auto-merge
23+
run: gh pr merge --auto --merge "$PR_URL"
24+
env:
25+
PR_URL: ${{github.event.pull_request.html_url}}

.github/workflows/ci.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
merge_group:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
tests:
11+
name: Tests
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
toolchain: ["stable", "stable 6 months ago"]
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
- name: Install Rust toolchain
20+
uses: dtolnay/rust-toolchain@stable
21+
with:
22+
toolchain: ${{ matrix.toolchain }}
23+
- name: Build tests
24+
run: cargo test --workspace --no-run
25+
- name: Run tests
26+
run: cargo test --workspace
27+
28+
style:
29+
name: Style
30+
runs-on: ubuntu-latest
31+
env:
32+
RUSTFLAGS: -Dwarnings
33+
RUSTDOCFLAGS: -Dwarnings
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
- name: Install Rust toolchain
38+
uses: dtolnay/rust-toolchain@nightly
39+
with:
40+
components: rustfmt, clippy
41+
- name: Install cargo-docs-rs
42+
uses: dtolnay/install@cargo-docs-rs
43+
- name: Check docs
44+
run: cargo docs-rs
45+
- name: Check lints
46+
run: cargo clippy
47+
- name: Check fmt
48+
run: cargo fmt -- --check
49+
50+
semver:
51+
name: API
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Checkout repository
55+
uses: actions/checkout@v4
56+
- name: Semver checks
57+
uses: obi1kenobi/cargo-semver-checks-action@v2
58+
with:
59+
package: build-rs

.github/workflows/publish.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Publish
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
7+
jobs:
8+
publish:
9+
name: Publish
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
- name: Install Rust toolchain
15+
uses: dtolnay/rust-toolchain@stable
16+
- name: Publish
17+
run: cargo publish
18+
env:
19+
CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_REGISTRY_TOKEN}}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

Cargo.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
name = "build-rs"
3+
version = "0.2.0"
4+
edition = "2021"
5+
rust-version = "1.70"
6+
publish = false
7+
8+
[features]
9+
10+
## Experimental API. This feature flag is **NOT** semver stable.
11+
unstable = []
12+
13+
[workspace]
14+
members = ["test-lib"]

src/allow_use.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use std::sync::OnceLock;
2+
3+
fn rust_version_minor() -> u32 {
4+
static VERSION_MINOR: OnceLock<u32> = OnceLock::new();
5+
*VERSION_MINOR.get_or_init(|| {
6+
crate::input::cargo_pkg_rust_version()
7+
.split('.')
8+
.nth(1)
9+
.unwrap_or("70")
10+
.parse()
11+
.unwrap()
12+
})
13+
}
14+
15+
pub(crate) fn double_colon_directives() -> bool {
16+
rust_version_minor() >= 77
17+
}

0 commit comments

Comments
 (0)