Skip to content

Commit 7a46b29

Browse files
authored
chore: workspace restructure and 3-file CI migration (#134)
## Summary - **Workspace restructure**: convert flat crate to workspace with `crates/lambda_sqs/` crate directory; workspace `Cargo.toml` with `[workspace.package]` and `[workspace.dependencies]`; crate `Cargo.toml` using workspace inheritance - **Release config**: split into workspace `release.toml` (shared settings, no PRLOG) and crate `release.toml` (`tag-name = "lambda_sqs-v{{version}}"`, fixed version regex, `pre-release-hook`); PRLOG owned by `toolkit/release_prlog` — no cargo-release replacements for PRLOG - **CI migration** to `jerus-org/circleci-toolkit@4.11.0`: replace old single-file config (setup, pipeline flags, old release workflow) with 3-file model - `config.yml`: `required_builds_rolling`, `common_tests_rolling`, dual security pattern, `code_coverage` with `package: lambda_sqs` - `update_prlog.yml`: new file with `toolkit/update_prlog` + `toolkit/label` - `release.yml`: new file with `toolkit/calculate_versions`, `toolkit/release_crate`, `toolkit/release_prlog` - **release-hook.sh**: fix missing `--name`, `--package`, `--repository-dir` args to `gen-changelog` > **Note**: PR #133 (`chore/pre-migration-fixes`) should merge before this one. The pre-migration fixes in #133 are included in this branch — once #133 merges, rebase this branch onto `main`. ## Test plan - [x] PR #133 merged first - [x] CI `validation` workflow passes on this branch - [x] `cargo build` and `cargo test` pass with workspace structure - [ ] All three CI files present with correct content - [x] CircleCI project settings updated: "pull_request merged" → `update_prlog.yml`; manual trigger → `release.yml` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
2 parents 2f5c261 + eb0e80c commit 7a46b29

16 files changed

Lines changed: 500 additions & 157 deletions

.circleci/config.yml

Lines changed: 34 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,13 @@ parameters:
44
min_rust_version:
55
type: string
66
default: "1.82"
7-
fingerprint:
8-
type: string
9-
default: SHA256:OkxsH8Z6Iim6WDJBaII9eTT9aaO1f3eDc6IpsgYYPVg
10-
validation_flag:
11-
type: boolean
12-
default: false
13-
description: "If true, the validation pipeline will be executed."
14-
success_flag:
15-
type: boolean
16-
default: false
17-
description: "If true, the success pipeline will be executed."
18-
release_flag:
19-
type: boolean
20-
default: false
21-
description: "If true, the success pipeline will be executed."
227

238
orbs:
24-
toolkit: jerus-org/circleci-toolkit@4.4.3
25-
26-
# Custom executors removed - using toolkit rolling executors instead
9+
toolkit: jerus-org/circleci-toolkit@4.11.0
2710

2811
workflows:
29-
check_last_commit:
30-
when:
31-
and:
32-
- not:
33-
equal: [scheduled_pipeline, << pipeline.trigger_source >>]
34-
- not: << pipeline.parameters.success_flag >>
35-
- not: << pipeline.parameters.validation_flag >>
36-
- not: << pipeline.parameters.release_flag >>
37-
38-
jobs:
39-
- toolkit/choose_pipeline:
40-
name: choose pipeline based on committer
41-
context: bot-check
42-
4312
validation:
44-
when:
45-
and:
46-
- not:
47-
equal: [scheduled_pipeline, << pipeline.trigger_source >>]
48-
- not: << pipeline.parameters.success_flag >>
49-
- << pipeline.parameters.validation_flag >>
50-
- not: << pipeline.parameters.release_flag >>
5113
jobs:
52-
# Signature verification for trusted PRs (with write access for comments)
5314
- toolkit/verify_commit_signatures:
5415
name: verify_commit_signatures_trusted
5516
context: bot-check
@@ -60,99 +21,56 @@ workflows:
6021
ignore:
6122
- main
6223
- /pull\/[0-9]+/
63-
# Signature verification for forked PRs (read-only, no comments)
6424
- toolkit/verify_commit_signatures:
6525
name: verify_commit_signatures_forked
6626
post_comment: false
6727
update_pcu: false
68-
filters:
69-
branches:
70-
only: /pull\/[0-9]+/
71-
- toolkit/label:
72-
min_rust_version: << pipeline.parameters.min_rust_version >>
73-
context: pcu-app
7428
filters:
7529
branches:
7630
only:
77-
- main
78-
- toolkit/code_coverage:
79-
min_rust_version: << pipeline.parameters.min_rust_version >>
80-
- toolkit/required_builds:
81-
min_rust_version: << pipeline.parameters.min_rust_version >>
82-
- toolkit/test_doc_build:
31+
- /pull\/[0-9]+/
32+
- toolkit/required_builds_rolling:
8333
min_rust_version: << pipeline.parameters.min_rust_version >>
8434
- toolkit/optional_builds:
8535
min_rust_version: << pipeline.parameters.min_rust_version >>
86-
- toolkit/common_tests:
36+
filters:
37+
branches:
38+
ignore: main
39+
- toolkit/test_doc_build:
8740
min_rust_version: << pipeline.parameters.min_rust_version >>
41+
filters:
42+
branches:
43+
ignore: main
8844
- toolkit/idiomatic_rust:
8945
min_rust_version: << pipeline.parameters.min_rust_version >>
90-
- toolkit/update_prlog:
46+
filters:
47+
branches:
48+
ignore: main
49+
- toolkit/common_tests_rolling:
50+
min_rust_version: << pipeline.parameters.min_rust_version >>
51+
- toolkit/security:
52+
name: security audit only
53+
sonarcloud: false
54+
filters:
55+
branches:
56+
only:
57+
- main
58+
- /pull\/[0-9]+/
59+
- toolkit/security:
60+
name: security with sonarcloud
61+
context: SonarCloud
9162
filters:
9263
branches:
9364
ignore:
9465
- /pull\/[0-9]+/
9566
- main
96-
requires:
97-
- verify_commit_signatures_trusted
98-
- toolkit/required_builds
99-
- toolkit/common_tests
100-
- toolkit/idiomatic_rust
101-
- toolkit/code_coverage
102-
context:
103-
- release
104-
- bot-check
105-
ssh_fingerprint: << pipeline.parameters.fingerprint >>
106-
min_rust_version: << pipeline.parameters.min_rust_version >>
107-
108-
on_success:
109-
when:
110-
and:
111-
- not:
112-
equal: [scheduled_pipeline, << pipeline.trigger_source >>]
113-
- << pipeline.parameters.success_flag >>
114-
- not: << pipeline.parameters.validation_flag >>
115-
- not: << pipeline.parameters.release_flag >>
116-
117-
jobs:
118-
- toolkit/end_success
119-
120-
release:
121-
when:
122-
or:
123-
- and:
124-
- equal: [scheduled_pipeline, << pipeline.trigger_source >>]
125-
- equal: ["release check", << pipeline.schedule.name >>]
126-
- and:
127-
- not: << pipeline.parameters.success_flag >>
128-
- not: << pipeline.parameters.validation_flag >>
129-
- << pipeline.parameters.release_flag >>
130-
jobs:
131-
- toolkit/save_next_version:
132-
min_rust_version: << pipeline.parameters.min_rust_version >>
133-
134-
- toolkit/make_release:
135-
context:
136-
- release
137-
- bot-check
138-
requires:
139-
- toolkit/save_next_version
140-
pre-steps:
141-
- attach_workspace:
142-
at: /tmp/workspace
143-
- run:
144-
name: Set SEMVER based on next-version file
145-
command: |
146-
set +ex
147-
export SEMVER=$(cat /tmp/workspace/next-version)
148-
echo $SEMVER
149-
echo "export SEMVER=$SEMVER" >> "$BASH_ENV"
150-
ssh_fingerprint: << pipeline.parameters.fingerprint >>
151-
min_rust_version: << pipeline.parameters.min_rust_version >>
152-
when_use_workspace: false
153-
154-
- toolkit/no_release:
67+
- toolkit/code_coverage:
15568
min_rust_version: << pipeline.parameters.min_rust_version >>
69+
package: lambda_sqs
70+
filters:
71+
branches:
72+
ignore:
73+
- /pull\/[0-9]+/
74+
- main
15675
requires:
157-
- toolkit/save_next_version:
158-
- failed
76+
- security with sonarcloud

.circleci/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
version: 2.1
2+
3+
parameters:
4+
lambda_sqs_version:
5+
type: string
6+
default: ""
7+
description: "Override lambda_sqs crate version (empty = nextsv auto-detect)"
8+
workspace_version:
9+
type: string
10+
default: ""
11+
description: "Override workspace v* version (empty = nextsv auto-detect)"
12+
13+
orbs:
14+
toolkit: jerus-org/circleci-toolkit@4.11.0
15+
16+
jobs:
17+
tools:
18+
executor: toolkit/rust_env_rolling
19+
steps:
20+
- run:
21+
name: Verify tools
22+
command: |
23+
set -ex
24+
nextsv --version
25+
pcu --version
26+
cargo release --version
27+
jq --version
28+
29+
workflows:
30+
release:
31+
jobs:
32+
- tools
33+
34+
- toolkit/calculate_versions:
35+
name: calculate-versions
36+
requires: [tools]
37+
crates: "lambda_sqs:lambda_sqs-v"
38+
crate_version_overrides: "lambda_sqs:<< pipeline.parameters.lambda_sqs_version >>"
39+
workspace_version_override: << pipeline.parameters.workspace_version >>
40+
41+
- approve-release:
42+
type: approval
43+
requires: [calculate-versions]
44+
45+
- toolkit/release_crate:
46+
name: release-lambda_sqs
47+
requires: [approve-release]
48+
package: lambda_sqs
49+
crate_tag_prefix: lambda_sqs-v
50+
context:
51+
- release
52+
- bot-check
53+
- pcu-app
54+
55+
- toolkit/release_prlog:
56+
requires: [release-lambda_sqs]
57+
context:
58+
- release
59+
- bot-check
60+
- pcu-app

.circleci/update_prlog.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: 2.1
2+
3+
parameters:
4+
update_pcu:
5+
type: boolean
6+
default: false
7+
description: "If true, pcu is updated from its main github branch before running."
8+
9+
orbs:
10+
toolkit: jerus-org/circleci-toolkit@4.11.0
11+
12+
workflows:
13+
update_prlog:
14+
jobs:
15+
- toolkit/update_prlog:
16+
name: update-prlog-on-main
17+
context:
18+
- release
19+
- bot-check
20+
- pcu-app
21+
min_rust_version: "1.82"
22+
target_branch: "main"
23+
pcu_from_merge: --from-merge
24+
update_pcu: << pipeline.parameters.update_pcu >>
25+
pcu_verbosity: "-vvv"
26+
- toolkit/label:
27+
min_rust_version: "1.82"
28+
context: pcu-app
29+
requires:
30+
- update-prlog-on-main

Cargo.toml

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,17 @@
1-
[package]
2-
name = "lambda_sqs"
1+
[workspace]
2+
members = ["crates/lambda_sqs"]
3+
resolver = "2"
4+
5+
[workspace.package]
36
version = "0.3.1"
4-
description = """
5-
Handles an SQS event and provides a vec of your type for processing.
6-
"""
7-
edition = "2021"
87
authors = ["Jeremiah Russell <jrussell@jerus.ie>"]
98
license = "MIT OR Apache-2.0"
10-
rust-version = "1.81"
119
repository = "https://github.com/jerus-org/lambda_sqs"
12-
readme = "README.md"
13-
documentation = "https://docs.rs/lambda-sqs"
14-
categories = ["web-programming"]
15-
keywords = ["aws", "sqs", "lambda"]
16-
exclude = [
17-
".circleci/config.yml",
18-
".fossa.yml",
19-
".github/workflows/fossa.yml",
20-
".github/workflows/rust_security_audit.yml",
21-
".gitignore",
22-
".vscode/settings.json",
23-
".whitesource",
24-
"markdownlint.jsonc",
25-
"renovate.json",
26-
]
10+
edition = "2021"
11+
rust-version = "1.82"
2712

28-
[dependencies]
13+
[workspace.dependencies]
2914
serde = { version = "1.0.228", features = ["derive"] }
3015
serde_json = "1.0.149"
3116
lambda_runtime = "1.0.2"
32-
33-
[dev-dependencies]
3417
tokio = "1.49.0"
35-
36-
[package.metadata.docs.rs]
37-
all-features = true
38-
rustdoc-args = ["--cfg", "docsrs"]

crates/lambda_sqs/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

crates/lambda_sqs/Cargo.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[package]
2+
name = "lambda_sqs"
3+
version.workspace = true
4+
description = """
5+
Handles an SQS event and provides a vec of your type for processing.
6+
"""
7+
edition.workspace = true
8+
authors.workspace = true
9+
license.workspace = true
10+
rust-version.workspace = true
11+
repository.workspace = true
12+
readme = "README.md"
13+
documentation = "https://docs.rs/lambda-sqs"
14+
categories = ["web-programming"]
15+
keywords = ["aws", "sqs", "lambda"]
16+
include = [
17+
"**/*.rs",
18+
"Cargo.toml",
19+
"README.md",
20+
"LICENSE-MIT",
21+
"LICENSE-APACHE",
22+
"CHANGELOG.md",
23+
]
24+
25+
[dependencies]
26+
serde.workspace = true
27+
serde_json.workspace = true
28+
lambda_runtime.workspace = true
29+
30+
[dev-dependencies]
31+
tokio.workspace = true
32+
33+
[package.metadata.docs.rs]
34+
all-features = true
35+
rustdoc-args = ["--cfg", "docsrs"]

0 commit comments

Comments
 (0)