Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit 93612a3

Browse files
authored
Restructure project as Cargo workspace and drop direct dependency on a HTTP server, and also CF Worker (wasm) runtime (#127)
* restructure ok separated config now wip wip wip ok ok ok it's working again ok getting there ok bring back plugins fix graphiql fix graphiql again fix tracing ok ok ok fix clippy, fmt, over-http and ci fix benches fix deps fix docker image fix * compile and run conductor as WASM (for CloudFlare Worker) (#134)
1 parent e08399d commit 93612a3

73 files changed

Lines changed: 4401 additions & 2941 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.yaml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ on:
44
push:
55
branches:
66
- master
7-
pull_request:
8-
branches:
9-
- master
7+
pull_request: {}
108

119
jobs:
1210
build:
@@ -16,7 +14,7 @@ jobs:
1614
fail-fast: false
1715
matrix:
1816
include:
19-
- { rust: 1.72.1, os: ubuntu-22.04 }
17+
- { rust: 1.74.0, os: ubuntu-22.04 }
2018
- { rust: 1.73.0, os: ubuntu-22.04 }
2119
steps:
2220
- name: checkout
@@ -30,15 +28,16 @@ jobs:
3028
- name: check
3129
run: cargo check
3230

33-
- name: build
34-
run: cargo build
31+
- name: "build (bin: conductor)"
32+
run: cargo build --bin conductor --release
33+
34+
- name: "build (bin: cloudflare_worker_wasm)"
35+
working-directory: crates/cloudflare_worker
36+
run: cargo install -q worker-build && worker-build
3537

3638
- name: test
3739
run: cargo test
3840

39-
- name: clean
40-
run: cargo clean
41-
4241
graphql-over-http:
4342
runs-on: ubuntu-22.04
4443
steps:
@@ -47,7 +46,7 @@ jobs:
4746

4847
- uses: actions-rs/toolchain@v1
4948
with:
50-
toolchain: 1.73.0
49+
toolchain: 1.74.0
5150
override: true
5251

5352
- name: Install Node
@@ -64,7 +63,7 @@ jobs:
6463

6564
- uses: JarvusInnovations/background-action@v1
6665
with:
67-
run: cargo run -- tests/graphql-over-http/config.yaml
66+
run: cargo run --bin conductor -- tests/graphql-over-http/config.yaml
6867
wait-on: http-get://127.0.0.1:9000/graphql
6968
tail: true
7069
wait-for: 5m
@@ -85,15 +84,15 @@ jobs:
8584
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
8685
- uses: actions-rs/toolchain@v1
8786
with:
88-
toolchain: 1.73.0
87+
toolchain: 1.74.0
8988
components: rustfmt, clippy
9089
override: true
9190

9291
- name: generate config json schema
93-
run: cargo test --test generate-config-schema
92+
run: cargo run --bin generate-config-schema
9493

9594
- name: check diff
96-
run: git diff --exit-code ./src/config/conductor.schema.json
95+
run: git diff --exit-code ./crates/config/conductor.schema.json
9796

9897
lint:
9998
runs-on: ubuntu-22.04
@@ -103,7 +102,7 @@ jobs:
103102
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
104103
- uses: actions-rs/toolchain@v1
105104
with:
106-
toolchain: 1.73.0
105+
toolchain: 1.74.0
107106
components: rustfmt, clippy
108107
override: true
109108

.github/workflows/release.yaml

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ on:
44
push:
55
branches:
66
- master
7-
pull_request:
8-
branches:
9-
- master
7+
pull_request: {}
108
release:
119
types: [created]
1210

@@ -46,7 +44,7 @@ jobs:
4644
workdir: .
4745
provenance: false
4846
push: true
49-
files: docker/bake.hcl
47+
files: ./crates/conductor/docker/bake.hcl
5048
targets: build
5149
set: |
5250
*.cache-from=type=gha,scope=build
@@ -79,6 +77,45 @@ jobs:
7977
ghcr.io/the-guild-org/conductor-t2/conductor:${{ github.event.release.tag_name }}
8078
```
8179
80+
wasm:
81+
name: compile wasm (cloudflare-worker)
82+
runs-on: ubuntu-22.04
83+
steps:
84+
- name: checkout
85+
uses: actions/checkout@v4
86+
87+
- uses: actions-rs/toolchain@v1
88+
with:
89+
toolchain: 1.74.0
90+
override: true
91+
92+
- name: "build (bin: cloudflare_worker_wasm)"
93+
working-directory: crates/cloudflare_worker
94+
run: cargo install -q worker-build && worker-build --release
95+
96+
- uses: actions/upload-artifact@v3
97+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
98+
name: upload wasm artifact
99+
with:
100+
name: conductor-cf-worker-wasm
101+
path: crates/cloudflare_worker/build/
102+
103+
- uses: montudor/action-zip@v1
104+
name: zip wasm artifact
105+
if: ${{ github.event_name == 'release' }}
106+
with:
107+
args: zip -qq -r cloudflare-worker-wasm.zip crates/cloudflare_worker/build/
108+
109+
- name: upload wasm to release
110+
if: ${{ github.event_name == 'release' }}
111+
uses: svenstaro/upload-release-action@v2
112+
with:
113+
repo_token: ${{ secrets.GITHUB_TOKEN }}
114+
file: cloudflare-worker-wasm.zip
115+
asset_name: cloudflare-worker-wasm
116+
tag: ${{ github.ref }}
117+
overwrite: true
118+
82119
binary:
83120
name: compile binary (${{ matrix.platform.target }})
84121
strategy:
@@ -101,7 +138,7 @@ jobs:
101138
command: build
102139
target: ${{ matrix.platform.target }}
103140
args: "--locked --release"
104-
strip: true
141+
strip: false
105142

106143
- uses: actions/upload-artifact@v3
107144
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"yaml.schemas": {
3-
"./src/config/conductor.schema.json": "*.yaml"
3+
"./crates/config/conductor.schema.json": "*.yaml"
44
},
55
"rust-analyzer.linkedProjects": ["./Cargo.toml"]
66
}

0 commit comments

Comments
 (0)