Skip to content

Commit 25dcbba

Browse files
authored
feat: impls now pull schemas
2 parents 65b262a + 8b032a7 commit 25dcbba

41 files changed

Lines changed: 781 additions & 2092 deletions

Some content is hidden

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

.github/workflows/ci-java.yml

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
name: Build & Publish on Schema Change
1+
name: Build & Publish Java Package
22

33
on:
44
push:
55
branches:
66
- main
77
paths:
8-
- "schemas/**"
98
- "java/**"
10-
- "java/pom.xml"
119
workflow_dispatch:
1210

1311
jobs:
@@ -25,6 +23,8 @@ jobs:
2523
steps:
2624
- name: Checkout Code
2725
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
2828

2929
- name: Set up JDK
3030
uses: actions/setup-java@v4
@@ -50,36 +50,29 @@ jobs:
5050
</settings>
5151
EOF
5252
53-
- name: Read Schema Version
54-
id: schema
53+
- name: Read Version
54+
id: version
5555
run: |
56-
SCHEMA_VERSION=$(cat ../schemas/VERSION | tr -d '\n')
57-
echo "Using schema version: $SCHEMA_VERSION"
58-
echo "schema_version=$SCHEMA_VERSION" >> $GITHUB_OUTPUT
56+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
57+
echo "value=$VERSION" >> $GITHUB_OUTPUT
5958
60-
- name: Read Implementation Version
61-
id: impl
59+
- name: Generate Changelog
60+
id: changelog
6261
run: |
63-
IMPL_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
64-
echo "Using implementation version: $IMPL_VERSION"
65-
echo "impl_version=$IMPL_VERSION" >> $GITHUB_OUTPUT
66-
67-
- name: Create Combined Version
68-
id: version
69-
run: |
70-
COMBINED_VERSION="${{ steps.impl.outputs.impl_version }}-schema-${{ steps.schema.outputs.schema_version }}"
71-
echo "Using combined version: $COMBINED_VERSION"
72-
echo "combined_version=$COMBINED_VERSION" >> $GITHUB_OUTPUT
62+
TAG="java-v${{ steps.version.outputs.value }}"
63+
if git rev-parse "$TAG" >/dev/null 2>&1; then
64+
LOG=$(git log "$TAG"..HEAD --oneline -- ../java)
65+
else
66+
LOG=$(git log --oneline -20 -- ../java)
67+
fi
68+
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
69+
echo "body<<$EOF" >> $GITHUB_OUTPUT
70+
echo "$LOG" >> $GITHUB_OUTPUT
71+
echo "$EOF" >> $GITHUB_OUTPUT
7372
7473
- name: Build with Maven
7574
run: mvn clean package
7675

77-
- name: Rename Artifacts for GitHub Release
78-
run: |
79-
mv target/pacts-${{ steps.impl.outputs.impl_version }}.jar target/pacts-${{ steps.version.outputs.combined_version }}.jar
80-
mv target/pacts-${{ steps.impl.outputs.impl_version }}-sources.jar target/pacts-${{ steps.version.outputs.combined_version }}-sources.jar
81-
mv target/pacts-${{ steps.impl.outputs.impl_version }}-javadoc.jar target/pacts-${{ steps.version.outputs.combined_version }}-javadoc.jar
82-
8376
- name: Publish to GitHub Packages
8477
env:
8578
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -89,17 +82,15 @@ jobs:
8982
- name: Create GitHub Release
9083
uses: softprops/action-gh-release@v2
9184
with:
92-
tag_name: java-v${{ steps.version.outputs.combined_version }}
93-
name: Java Package v${{ steps.version.outputs.combined_version }}
85+
tag_name: java-v${{ steps.version.outputs.value }}
86+
name: Java v${{ steps.version.outputs.value }}
9487
body: |
95-
Java package release for version ${{ steps.version.outputs.combined_version }}
88+
## Java Package v${{ steps.version.outputs.value }}
9689
97-
Changes:
98-
- Implementation version: ${{ steps.impl.outputs.impl_version }}
99-
- Schema version: ${{ steps.schema.outputs.schema_version }}
90+
${{ steps.changelog.outputs.body }}
10091
files: |
101-
java/target/pacts-${{ steps.version.outputs.combined_version }}.jar
102-
java/target/pacts-${{ steps.version.outputs.combined_version }}-sources.jar
103-
java/target/pacts-${{ steps.version.outputs.combined_version }}-javadoc.jar
92+
java/target/pacts-${{ steps.version.outputs.value }}.jar
93+
java/target/pacts-${{ steps.version.outputs.value }}-sources.jar
94+
java/target/pacts-${{ steps.version.outputs.value }}-javadoc.jar
10495
env:
10596
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci-rust.yml

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ on:
55
branches:
66
- main
77
paths:
8-
- "schemas/**"
98
- "rust/**"
10-
- "rust/Cargo.toml"
119
workflow_dispatch:
1210

1311
jobs:
@@ -24,6 +22,8 @@ jobs:
2422
steps:
2523
- name: Checkout Code
2624
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
2727

2828
- name: Install Rust
2929
uses: dtolnay/rust-toolchain@v1
@@ -41,49 +41,42 @@ jobs:
4141
restore-keys: |
4242
${{ runner.os }}-cargo-
4343
44-
- name: Read Schema Version
45-
id: schema
44+
- name: Read Version
45+
id: version
4646
run: |
47-
SCHEMA_VERSION=$(cat ../schemas/VERSION | tr -d '\n')
48-
echo "Using schema version: $SCHEMA_VERSION"
49-
echo "schema_version=$SCHEMA_VERSION" >> $GITHUB_OUTPUT
47+
VERSION=$(grep '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
48+
echo "value=$VERSION" >> $GITHUB_OUTPUT
5049
51-
- name: Read Implementation Version
52-
id: impl
50+
- name: Generate Changelog
51+
id: changelog
5352
run: |
54-
IMPL_VERSION=$(grep '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
55-
echo "Using implementation version: $IMPL_VERSION"
56-
echo "impl_version=$IMPL_VERSION" >> $GITHUB_OUTPUT
57-
58-
- name: Create Combined Version
59-
id: version
60-
run: |
61-
COMBINED_VERSION="${{ steps.impl.outputs.impl_version }}+schema.${{ steps.schema.outputs.schema_version }}"
62-
echo "Using combined version: $COMBINED_VERSION"
63-
echo "combined_version=$COMBINED_VERSION" >> $GITHUB_OUTPUT
53+
TAG="rust-v${{ steps.version.outputs.value }}"
54+
if git rev-parse "$TAG" >/dev/null 2>&1; then
55+
LOG=$(git log "$TAG"..HEAD --oneline -- ../rust)
56+
else
57+
LOG=$(git log --oneline -20 -- ../rust)
58+
fi
59+
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
60+
echo "body<<$EOF" >> $GITHUB_OUTPUT
61+
echo "$LOG" >> $GITHUB_OUTPUT
62+
echo "$EOF" >> $GITHUB_OUTPUT
6463
6564
- name: Build
6665
run: cargo build --release
6766

68-
- name: Run tests
67+
- name: Run Tests
6968
run: cargo test
7069

71-
- name: Rename staticlib for GitHub Release
72-
run: |
73-
cp target/release/libpacts.a target/release/libpacts-${{ steps.version.outputs.combined_version }}.a
74-
7570
- name: Create GitHub Release
7671
uses: softprops/action-gh-release@v2
7772
with:
78-
tag_name: rust-v${{ steps.version.outputs.combined_version }}
79-
name: Rust Crate v${{ steps.version.outputs.combined_version }}
73+
tag_name: rust-v${{ steps.version.outputs.value }}
74+
name: Rust v${{ steps.version.outputs.value }}
8075
body: |
81-
Rust crate release for version ${{ steps.version.outputs.combined_version }}
76+
## Rust Crate v${{ steps.version.outputs.value }}
8277
83-
Changes:
84-
- Implementation version: ${{ steps.impl.outputs.impl_version }}
85-
- Schema version: ${{ steps.schema.outputs.schema_version }}
78+
${{ steps.changelog.outputs.body }}
8679
files: |
87-
rust/target/release/libpacts-${{ steps.version.outputs.combined_version }}.a
80+
rust/target/release/libpacts.a
8881
env:
8982
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

java/pom.xml

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>net.hydrius</groupId>
77
<artifactId>pacts</artifactId>
8-
<version>1.0.0</version>
8+
<version>1.0.1</version>
99
<packaging>jar</packaging>
1010

1111
<name>Pacts</name>
@@ -16,26 +16,6 @@
1616
</properties>
1717

1818
<build>
19-
<resources>
20-
<resource>
21-
<directory>${project.basedir}/../schemas</directory>
22-
<targetPath>schemas</targetPath>
23-
<includes>
24-
<include>**/*.json</include>
25-
<include>VERSION</include>
26-
</includes>
27-
</resource>
28-
</resources>
29-
<testResources>
30-
<testResource>
31-
<directory>${project.basedir}/../schemas</directory>
32-
<targetPath>schemas</targetPath>
33-
<includes>
34-
<include>**/*.json</include>
35-
<include>VERSION</include>
36-
</includes>
37-
</testResource>
38-
</testResources>
3919
<plugins>
4020
<plugin>
4121
<groupId>org.apache.maven.plugins</groupId>
@@ -88,6 +68,11 @@
8868
</execution>
8969
</executions>
9070
</plugin>
71+
<plugin>
72+
<groupId>org.apache.maven.plugins</groupId>
73+
<artifactId>maven-surefire-plugin</artifactId>
74+
<version>3.5.4</version>
75+
</plugin>
9176
</plugins>
9277
</build>
9378

@@ -96,7 +81,7 @@
9681
<dependency>
9782
<groupId>org.testcontainers</groupId>
9883
<artifactId>testcontainers-bom</artifactId>
99-
<version>1.21.3</version>
84+
<version>2.0.2</version>
10085
<type>pom</type>
10186
<scope>import</scope>
10287
</dependency>
@@ -132,6 +117,16 @@
132117
<groupId>com.fasterxml.jackson.datatype</groupId>
133118
<artifactId>jackson-datatype-jsr310</artifactId>
134119
</dependency>
120+
<dependency>
121+
<groupId>com.fasterxml.jackson.dataformat</groupId>
122+
<artifactId>jackson-dataformat-yaml</artifactId>
123+
</dependency>
124+
<dependency>
125+
<groupId>org.jetbrains</groupId>
126+
<artifactId>annotations</artifactId>
127+
<version>26.0.2-1</version>
128+
<scope>provided</scope>
129+
</dependency>
135130

136131
<dependency>
137132
<groupId>org.junit.jupiter</groupId>

0 commit comments

Comments
 (0)