Skip to content

Commit

Permalink
Restructure project as Cargo workspace and drop direct dependency on …
Browse files Browse the repository at this point in the history
…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)
  • Loading branch information
dotansimha committed Nov 19, 2023
1 parent e08399d commit 93612a3
Show file tree
Hide file tree
Showing 73 changed files with 4,401 additions and 2,941 deletions.
29 changes: 14 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ on:
push:
branches:
- master
pull_request:
branches:
- master
pull_request: {}

jobs:
build:
Expand All @@ -16,7 +14,7 @@ jobs:
fail-fast: false
matrix:
include:
- { rust: 1.72.1, os: ubuntu-22.04 }
- { rust: 1.74.0, os: ubuntu-22.04 }
- { rust: 1.73.0, os: ubuntu-22.04 }
steps:
- name: checkout
Expand All @@ -30,15 +28,16 @@ jobs:
- name: check
run: cargo check

- name: build
run: cargo build
- name: "build (bin: conductor)"
run: cargo build --bin conductor --release

- name: "build (bin: cloudflare_worker_wasm)"
working-directory: crates/cloudflare_worker
run: cargo install -q worker-build && worker-build

- name: test
run: cargo test

- name: clean
run: cargo clean

graphql-over-http:
runs-on: ubuntu-22.04
steps:
Expand All @@ -47,7 +46,7 @@ jobs:

- uses: actions-rs/toolchain@v1
with:
toolchain: 1.73.0
toolchain: 1.74.0
override: true

- name: Install Node
Expand All @@ -64,7 +63,7 @@ jobs:

- uses: JarvusInnovations/background-action@v1
with:
run: cargo run -- tests/graphql-over-http/config.yaml
run: cargo run --bin conductor -- tests/graphql-over-http/config.yaml
wait-on: http-get://127.0.0.1:9000/graphql
tail: true
wait-for: 5m
Expand All @@ -85,15 +84,15 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.73.0
toolchain: 1.74.0
components: rustfmt, clippy
override: true

- name: generate config json schema
run: cargo test --test generate-config-schema
run: cargo run --bin generate-config-schema

- name: check diff
run: git diff --exit-code ./src/config/conductor.schema.json
run: git diff --exit-code ./crates/config/conductor.schema.json

lint:
runs-on: ubuntu-22.04
Expand All @@ -103,7 +102,7 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.73.0
toolchain: 1.74.0
components: rustfmt, clippy
override: true

Expand Down
47 changes: 42 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ on:
push:
branches:
- master
pull_request:
branches:
- master
pull_request: {}
release:
types: [created]

Expand Down Expand Up @@ -46,7 +44,7 @@ jobs:
workdir: .
provenance: false
push: true
files: docker/bake.hcl
files: ./crates/conductor/docker/bake.hcl
targets: build
set: |
*.cache-from=type=gha,scope=build
Expand Down Expand Up @@ -79,6 +77,45 @@ jobs:
ghcr.io/the-guild-org/conductor-t2/conductor:${{ github.event.release.tag_name }}
```
wasm:
name: compile wasm (cloudflare-worker)
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
with:
toolchain: 1.74.0
override: true

- name: "build (bin: cloudflare_worker_wasm)"
working-directory: crates/cloudflare_worker
run: cargo install -q worker-build && worker-build --release

- uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
name: upload wasm artifact
with:
name: conductor-cf-worker-wasm
path: crates/cloudflare_worker/build/

- uses: montudor/action-zip@v1
name: zip wasm artifact
if: ${{ github.event_name == 'release' }}
with:
args: zip -qq -r cloudflare-worker-wasm.zip crates/cloudflare_worker/build/

- name: upload wasm to release
if: ${{ github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: cloudflare-worker-wasm.zip
asset_name: cloudflare-worker-wasm
tag: ${{ github.ref }}
overwrite: true

binary:
name: compile binary (${{ matrix.platform.target }})
strategy:
Expand All @@ -101,7 +138,7 @@ jobs:
command: build
target: ${{ matrix.platform.target }}
args: "--locked --release"
strip: true
strip: false

- uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"yaml.schemas": {
"./src/config/conductor.schema.json": "*.yaml"
"./crates/config/conductor.schema.json": "*.yaml"
},
"rust-analyzer.linkedProjects": ["./Cargo.toml"]
}
Loading

0 comments on commit 93612a3

Please sign in to comment.