]> git.puffer.fish Git - matthieu/nova.git/commitdiff
add ci
authorMatthieuCoder <matthieu@matthieu-dev.xyz>
Tue, 3 Jan 2023 10:56:36 +0000 (14:56 +0400)
committerMatthieuCoder <matthieu@matthieu-dev.xyz>
Tue, 3 Jan 2023 10:56:36 +0000 (14:56 +0400)
.github/workflows/build.yml [new file with mode: 0644]
.github/workflows/rust.yml [deleted file]
exes/webhook/src/handler/handler.rs

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644 (file)
index 0000000..110d266
--- /dev/null
@@ -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 (file)
index 31000a2..0000000
+++ /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
index af79185026c1c7e31d757b5554665f0dcf626755..896e43ffba7bc900b2a129fc3ab61c690a27b15d 100644 (file)
@@ -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;