Skip to content

Commit 788b5e3

Browse files
martypittclaude
andauthored
Add spec module (#3)
* Add preflight-spec module and upgrade Gradle to 9.3.1 Introduces the preflight-spec module — a standalone markdown parsing/writing library for Preflight test spec files. Each spec is a markdown file that serves as both living documentation and a machine-parseable test definition. - New module: preflight-core/preflight-spec with TestSpecReader, TestSpecWriter, data model (TestSpec, Stub, StubMode), and internal parsers for front matter and HTML comment directives - 46 tests covering parsing, writing, round-trip, and error cases - MarkdownSpec base class in preflight-runtime for executing spec files as Kotest tests - Upgraded all Gradle wrappers from 8.13 to 9.3.1 (bundles Kotlin 2.2.21, required for Orbital 0.37.0-SNAPSHOT compatibility) - Fixed KafkaContainerSupport for removed emitConsumerInfoMessages parameter - Removed broken ExamplesSpec that referenced compileOnly types from test source Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Gitignore .idea/kotlinc.xml Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add ResultFormat to support typedInstance qualifier in Expected Results The Expected Results code block info string can now include a format qualifier (e.g. `json typedInstance`) to distinguish plain JSON from Orbital TypedInstance JSON. Defaults to plain JSON for backwards compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Auto-discover and execute .spec.md files as tests The Gradle plugin now generates a PreflightSpecRunner test class that extends MarkdownSpec, so any .spec.md files in test-resources/specs/ are automatically discovered and run as tests without hand-written code. MarkdownSpec now filters for the .spec.md suffix specifically. Includes a new spec-project example demonstrating spec-only testing with no Kotlin test files required. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add BUILDING.md and fix release workflow Add build/release documentation covering local builds, Maven Local publishing, version bumping, and the release process. Fix release.yml to also publish preflight-spec to the Orbital Maven repo and add missing AWS credentials for S3 authentication. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * added docs on new spec format * Default the version on TestSpec * Update default versions of Taxi and Orbital * Added building notes --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fba417a commit 788b5e3

File tree

44 files changed

+2960
-75
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2960
-75
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ jobs:
3131
run: echo "GPG key loaded"
3232

3333
- name: Build and publish
34-
run: ./gradlew build :preflight-core:preflight-gradle-plugin:publishPlugins :preflight-core:preflight-runtime:publishMavenPublicationToOrbitalRepository
34+
run: ./gradlew build :preflight-core:preflight-gradle-plugin:publishPlugins :preflight-core:preflight-runtime:publishMavenPublicationToOrbitalRepository :preflight-core:preflight-spec:publishMavenPublicationToOrbitalRepository
3535
env:
3636
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
3737
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
3838
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
3939
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
40+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
41+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
4042

4143
- name: Create GitHub Release
4244
uses: softprops/action-gh-release@v1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
.idea/**/contentModel.xml
2020

2121
# Sensitive or high-churn files
22+
.idea/**/kotlinc.xml
2223
.idea/**/dataSources/
2324
.idea/**/dataSources.ids
2425
.idea/**/dataSources.local.xml

.idea/kotlinc.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/modules.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

BUILDING.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Building and Releasing
2+
3+
## Building locally
4+
5+
```bash
6+
cd preflight-core
7+
./gradlew build
8+
```
9+
10+
This builds all modules (`preflight-spec`, `preflight-runtime`, `preflight-gradle-plugin`) and runs their tests.
11+
12+
To also run the example project tests:
13+
14+
```bash
15+
# From the repo root
16+
./gradlew build
17+
```
18+
19+
## Installing to local Maven repo
20+
21+
To test changes locally before releasing, publish all modules to `~/.m2`:
22+
23+
```bash
24+
cd preflight-core
25+
./gradlew publishAllMavenLocal
26+
```
27+
28+
### Using a local pre-release version in another project
29+
30+
Consuming projects need `mavenLocal()` in their `pluginManagement` repositories so Gradle can find the locally-published plugin:
31+
32+
```kotlin
33+
// settings.gradle.kts
34+
pluginManagement {
35+
repositories {
36+
mavenLocal()
37+
gradlePluginPortal()
38+
}
39+
}
40+
```
41+
42+
Then reference the local version in `build.gradle.kts`:
43+
44+
```kotlin
45+
plugins {
46+
id("com.orbitalhq.preflight") version "0.1.0" // matches the version you published locally
47+
}
48+
```
49+
50+
The plugin itself injects the Orbital Maven repositories automatically, so no other repository configuration is needed in the consuming project.
51+
52+
## Bumping the version
53+
54+
The version is set in one place: `preflight-core/build.gradle.kts`
55+
56+
```kotlin
57+
allprojects {
58+
group = "com.orbitalhq.preflight"
59+
version = "0.1.0" // <-- change this
60+
}
61+
```
62+
63+
All submodules inherit this version. The Gradle plugin also embeds it at build time via a generated `Versions.kt` constant.
64+
65+
## Releasing
66+
67+
Releases are triggered by pushing a git tag. GitHub Actions handles building, signing, and publishing.
68+
69+
```bash
70+
# 1. Make sure you're on main with a clean tree
71+
git checkout main
72+
git pull
73+
74+
# 2. Bump the version in preflight-core/build.gradle.kts, commit
75+
76+
# 3. Tag the release
77+
git tag v0.1.0
78+
79+
# 4. Push the commit and tag
80+
git push origin main
81+
git push origin v0.1.0
82+
```
83+
84+
The `release.yml` workflow then:
85+
1. Builds the project with JDK 21
86+
2. Signs artifacts with GPG
87+
3. Publishes the Gradle plugin to the **Gradle Plugin Portal**
88+
4. Publishes `preflight-runtime` and `preflight-spec` to the **Orbital Maven repository** (`s3://repo.orbitalhq.com/release`)
89+
5. Creates a GitHub Release with JARs and auto-generated notes
90+
91+
## Where artifacts are published
92+
93+
| Artifact | Destination | How consumers resolve it |
94+
|-----------------------------------------|-----------------------------------------------------------|-------------------------------------------------------------|
95+
| `com.orbitalhq.preflight` Gradle plugin | [Gradle Plugin Portal](https://plugins.gradle.org/) | `plugins { id("com.orbitalhq.preflight") }` |
96+
| `preflight-runtime` | Orbital Maven repo (`https://repo.orbitalhq.com/release`) | `maven { url = uri("https://repo.orbitalhq.com/release") }` |
97+
| `preflight-spec` | Orbital Maven repo (same) | Same repository config |
98+
99+
Nothing is published to Maven Central. Consumers need the Orbital Maven repository in their `repositories {}` block to resolve the runtime (the Gradle plugin injects this automatically).
100+
101+
## Required CI secrets
102+
103+
These must be configured in the GitHub repository settings:
104+
105+
- `GRADLE_PUBLISH_KEY` / `GRADLE_PUBLISH_SECRET` — Gradle Plugin Portal credentials
106+
- `GPG_PRIVATE_KEY` / `GPG_PASSPHRASE` — artifact signing
107+
- `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` — S3 access for Orbital Maven repo

docs/pages/_meta.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export default {
22
// Controlling the order these are shown in the sidebar
33
"index": "Getting started",
44
"writing-tests" : "Writing tests",
5+
"spec-files" : "Spec files",
56
"stubbing" : "Stubbing responses",
67
"integration-testing": "Integration testing",
78
"environment-variables" : "Environment variables",

docs/pages/index.mdx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,19 @@ Here's the directory structure:
8989
```
9090
├── src
9191
│ └── schema.taxi
92-
├── test
92+
├── test (Optional - for Kotlin tests)
9393
│ └── SchemaSpec.kt
94-
└── test-resources (Optional)
95-
└── env.conf (Optional)
94+
├── test-resources
95+
│ ├── env.conf (Optional - environment variables)
96+
│ └── specs (Optional - markdown spec files)
97+
│ └── my-test.spec.md
9698
taxi.conf
9799
build.gradle.kts
98100
settings.gradle.kts (Often blank)
99101
```
100102

103+
Tests can be written as Kotlin code in `test/` (see [Writing tests](/writing-tests)), as markdown spec files in `test-resources/specs/` (see [Spec files](/spec-files)), or both.
104+
101105
Then, to write your first test, create a folder `test` next to your `src` folder.
102106
By convention, these are named ending in `Spec.kt` or `Test.kt`.
103107

0 commit comments

Comments
 (0)