Skip to content

Commit e3e28c4

Browse files
authored
Merge pull request #136 from grafbase/tomhoule-qmutplwyrzvq
Move protoc-gen-grafbase-subgraph over from grafbase/grafbase repo
2 parents 0bc8a34 + 77be4fd commit e3e28c4

36 files changed

+9125
-1
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: protoc-gen-grafbase-subgraph-release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- 'protoc-gen-grafbase-subgraph-*'
8+
9+
permissions:
10+
contents: write
11+
12+
env:
13+
CARGO_PROFILE_DEV_DEBUG: 0
14+
CARGO_PROFILE_TEST_DEBUG: 0
15+
CARGO_TERM_COLOR: 'always'
16+
17+
jobs:
18+
build-and-upload:
19+
name: Build and upload artifact
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
platform:
24+
[
25+
{ 'target': 'x86_64-unknown-linux-musl', 'runner': 'depot-ubuntu-24.04-8' },
26+
{ 'target': 'aarch64-unknown-linux-musl', 'runner': 'depot-ubuntu-24.04-arm-8' },
27+
{ 'target': 'aarch64-apple-darwin', 'runner': 'depot-macos-latest' },
28+
{ 'target': 'x86_64-pc-windows-msvc', 'runner': 'depot-windows-2022-8' },
29+
]
30+
runs-on: ${{ matrix.platform.runner }}
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: Install Rust
36+
uses: ./.github/actions/install-rust
37+
with:
38+
target: ${{ matrix.platform.target }}
39+
40+
- name: Install musl-tools
41+
if: ${{ contains(matrix.platform.target, 'linux') }}
42+
shell: bash
43+
run: |
44+
sudo apt-get install musl musl-tools
45+
# This seems like a horrible hack that might come back to bite, but lets see!
46+
sudo ln -s /bin/g++ /bin/musl-g++
47+
sudo ln -s /bin/g++ /bin/aarch64-linux-musl-g++
48+
49+
- name: Build binaries
50+
shell: bash
51+
run: |
52+
cargo build -p protoc-gen-grafbase-subgraph --release
53+
54+
- name: Prepare binary (Unix)
55+
if: matrix.platform.target != 'x86_64-pc-windows-msvc'
56+
run: |
57+
cd target/release
58+
tar -czf protoc-gen-grafbase-subgraph-${{ matrix.platform.target }}.tar.gz protoc-gen-grafbase-subgraph
59+
60+
- name: Prepare binary (Windows)
61+
if: matrix.platform.target == 'x86_64-pc-windows-msvc'
62+
run: |
63+
cd target/release
64+
7z a protoc-gen-grafbase-subgraph-${{ matrix.platform.target }}.zip protoc-gen-grafbase-subgraph.exe
65+
66+
- name: Upload assets (Unix)
67+
if: matrix.platform.target != 'x86_64-pc-windows-msvc'
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: protoc-gen-grafbase-subgraph-${{ matrix.platform.target }}
71+
path: target/release/protoc-gen-grafbase-subgraph-${{ matrix.platform.target }}.tar.gz
72+
73+
- name: Upload assets (Windows)
74+
if: matrix.platform.target == 'x86_64-pc-windows-msvc'
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: protoc-gen-grafbase-subgraph-${{ matrix.platform.target }}
78+
path: target/release/protoc-gen-grafbase-subgraph-${{ matrix.platform.target }}.zip
79+
80+
create-release:
81+
name: Create GitHub release
82+
needs: build-and-upload
83+
runs-on: ubuntu-latest
84+
steps:
85+
- name: Checkout code
86+
uses: actions/checkout@v4
87+
88+
- name: Get version from tag
89+
id: get_version
90+
run: echo "VERSION=${GITHUB_REF#refs/tags/protoc-gen-grafbase-subgraph-}" >> $GITHUB_OUTPUT
91+
92+
- name: Download all artifacts
93+
uses: actions/download-artifact@v4
94+
with:
95+
path: artifacts
96+
97+
- name: Create GitHub Release
98+
id: create_release
99+
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2
100+
with:
101+
draft: false
102+
prerelease: false
103+
files: |
104+
artifacts/protoc-gen-grafbase-subgraph-x86_64-unknown-linux-musl/protoc-gen-grafbase-subgraph-x86_64-unknown-linux-musl.tar.gz
105+
artifacts/protoc-gen-grafbase-subgraph-aarch64-unknown-linux-musl/protoc-gen-grafbase-subgraph-aarch64-unknown-linux-musl.tar.gz
106+
artifacts/protoc-gen-grafbase-subgraph-aarch64-apple-darwin/protoc-gen-grafbase-subgraph-aarch64-apple-darwin.tar.gz
107+
artifacts/protoc-gen-grafbase-subgraph-x86_64-pc-windows-msvc/protoc-gen-grafbase-subgraph-x86_64-pc-windows-msvc.zip

Cargo.lock

Lines changed: 83 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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,24 @@ hashbrown = "0.15"
7373
http = "1.3"
7474
indexmap = "2.9.0"
7575
indoc = "2.0.6"
76-
insta = { version = "1.42.2", features = ["json"] }
76+
insta = { version = "1.42.2", features = ["json", "glob"] }
7777
itertools = "0.14.0"
7878
jiff = "0.2.6"
7979
jwt-compact = "0.8.0"
8080
names = "0.14.0"
8181
oauth-protected-resource-shared = { version = "0.1.0", path = "crates/oauth-protected-resource-shared" }
8282
openidconnect = "4.0.0"
8383
ory-client = "=1.9.0"
84+
paste = "1"
8485
pem = "3.0.5"
8586
percent-encoding = "2"
8687
pkcs1 = "0.7.5"
8788
pkcs8 = "0.10.2"
8889
postcard = "1"
8990
pretty_assertions = "1.4.1"
9091
prost = { version = "0.13.5", default-features = false, features = ["std"] }
92+
protobuf = "3"
93+
protobuf-support = "3"
9194
rand = "*"
9295
rapidhash = "1.4"
9396
regex = "1.11.1"
@@ -100,6 +103,7 @@ sha2 = "0.10.8"
100103
sql-ast = { version = "0.1.0", path = "crates/sql-ast" }
101104
sqlx = { version = "0.8.4", default-features = false }
102105
strum = { version = "0.27.1", features = ["derive"] }
106+
tempfile = "3"
103107
template = { path = "crates/template" }
104108
tokio = { version = "1", features = ["rt-multi-thread", "macros", "test-util"] }
105109
tokio-stream = "0.1.17"
@@ -109,4 +113,5 @@ tonic-build = { version = "0.12.3", features = ["prost"] }
109113
tracing = "0.1.41"
110114
tracing-subscriber = "0.3"
111115
url = { version = "2.5.4", features = ["serde"] }
116+
walkdir = "2"
112117
wiremock = "0.6.3"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/out/
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## 0.2.0 - 2025-07-24
2+
3+
### Added
4+
5+
- **GraphQL Directive Support**: Added support for all directive options defined in `options.proto`:
6+
- `object_directives` and `input_object_directives` for object-level directives
7+
- `input_field_directives` and `output_field_directives` for field-level directives
8+
- `enum_directives` for enum-level directives
9+
- `enum_value_directives` for enum value-level directives
10+
- **Query Field Mapping**: Added support for mapping gRPC service methods to GraphQL Query fields instead of Mutations:
11+
- `is_graphql_query_field` and `is_graphql_mutation_field` options on individual methods
12+
- `graphql_default_to_query_fields` and `graphql_default_to_mutation_fields` options on services to make all methods default to Query (or Mutation) fields
13+
- **Query Type Generation**: The generator now creates a `type Query` in addition to `type Mutation` and `type Subscription` based on method configurations
14+
15+
## 0.1.0 - 2025-04-15
16+
17+
- Initial release. The output matches the directives expected by version 0.1.0 of the grpc extension.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[package]
2+
name = "protoc-gen-grafbase-subgraph"
3+
version = "0.1.0"
4+
edition.workspace = true
5+
license.workspace = true
6+
homepage.workspace = true
7+
keywords.workspace = true
8+
repository.workspace = true
9+
10+
[dependencies]
11+
indexmap.workspace = true
12+
paste.workspace = true
13+
protobuf.workspace = true
14+
protobuf-support.workspace = true
15+
16+
[dev-dependencies]
17+
insta.workspace = true
18+
tempfile.workspace = true
19+
walkdir.workspace = true
20+
21+
[lints]
22+
workspace = true

0 commit comments

Comments
 (0)