summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieuCoder <matthieu@matthieu-dev.xyz>2023-01-03 14:56:36 +0400
committerMatthieuCoder <matthieu@matthieu-dev.xyz>2023-01-03 14:56:36 +0400
commitf0cf9d95971b46f2219cbba2cf4dd7d52a606d88 (patch)
tree150c877e4c02f37aa3fef0e297b8af562c22084a
parent27cb69cc6c30641abc6ccdf7dde19ea6c189d543 (diff)
add ci
-rw-r--r--.github/workflows/build.yml61
-rw-r--r--.github/workflows/rust.yml22
-rw-r--r--exes/webhook/src/handler/handler.rs7
3 files changed, 64 insertions, 26 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..110d266
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,61 @@
+name: Rust
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+
+jobs:
+ lint:
+ name: Lint
+ runs-on: ubuntu-latest
+ steps:
+ - name: Setup | Checkout
+ uses: actions/checkout@v2
+ - name: Setup | Rust
+ uses: ATiltedTree/setup-rust@v1
+ with:
+ rust-version: stable
+ components: clippy
+ - name: Build | Lint
+ run: cargo clippy
+ compile:
+ name: Compile
+ runs-on: ubuntu-latest
+ steps:
+ - name: Setup | Checkout
+ uses: actions/checkout@v2
+ - name: Install Protoc
+ uses: arduino/setup-protoc@v1
+ - name: Setup | Rust
+ uses: ATiltedTree/setup-rust@v1
+ with:
+ rust-version: stable
+ - name: Build | Compile
+ run: cargo check
+ test:
+ name: Test
+ strategy:
+ matrix:
+ os:
+ - ubuntu-latest
+ - windows-latest
+ - macOS-latest
+ rust:
+ - stable
+ - beta
+ - nightly
+ runs-on: ${{ matrix.os }}
+ needs: [compile]
+ steps:
+ - name: Setup | Checkout
+ uses: actions/checkout@v2
+ - name: Install Protoc
+ uses: arduino/setup-protoc@v1
+ - name: Setup | Rust
+ uses: ATiltedTree/setup-rust@v1
+ with:
+ rust-version: ${{ matrix.rust }}
+ - name: Build | Compile
+ run: cargo test
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
deleted file mode 100644
index 31000a2..0000000
--- a/.github/workflows/rust.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-name: Rust
-
-on:
- push:
- branches: [ "main" ]
- pull_request:
- branches: [ "main" ]
-
-env:
- CARGO_TERM_COLOR: always
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v3
- - name: Build
- run: cargo build --verbose
- - name: Run tests
- run: cargo test --verbose
diff --git a/exes/webhook/src/handler/handler.rs b/exes/webhook/src/handler/handler.rs
index af79185..896e43f 100644
--- a/exes/webhook/src/handler/handler.rs
+++ b/exes/webhook/src/handler/handler.rs
@@ -84,7 +84,7 @@ impl WebhookService {
match value.kind {
InteractionType::Ping => Ok(Response::builder()
.header("Content-Type", "application/json")
- .body(r#"{"t":1}"#.into())
+ .body(r#"{"type":1}"#.into())
.unwrap()),
_ => {
debug!("calling nats");
@@ -113,7 +113,7 @@ impl WebhookService {
{
Ok(response) => Ok(Response::builder()
.header("Content-Type", "application/json")
- .body(Body::from(response.reply.unwrap()))
+ .body(Body::from(response.payload))
.unwrap()),
Err(error) => {
@@ -156,8 +156,7 @@ impl Service<hyper::Request<Body>> for WebhookService {
}
fn call(&mut self, req: Request<Body>) -> Self::Future {
- let future =
- Self::process_request(req, self.nats.clone(), self.config.discord.public_key);
+ let future = Self::process_request(req, self.nats.clone(), self.config.discord.public_key);
Box::pin(async move {
let response = future.await;