Add clippy check before bake
This commit is contained in:
parent
5ad4ad7cc2
commit
a4838723f5
@ -1,37 +1,44 @@
|
|||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bake:
|
clippy:
|
||||||
name: Build and push Docker images
|
name: Run clippy analysis
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
- name: Run clippy
|
||||||
- name: Set up QEMU
|
run: cargo clippy --all-targets --all-features
|
||||||
uses: docker/setup-qemu-action@v3
|
bake:
|
||||||
|
name: Build and push Docker images
|
||||||
- name: Login to git.garen.dev Container Registry
|
runs-on: ubuntu-latest
|
||||||
uses: docker/login-action@v3
|
needs: clippy
|
||||||
with:
|
permissions:
|
||||||
registry: git.garen.dev
|
contents: read
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
steps:
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
- name: Set up Docker Buildx
|
- name: Set up QEMU
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
with:
|
- name: Login to git.garen.dev Container Registry
|
||||||
platforms: linux/amd64, linux/arm64
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
- name: Bake and push
|
registry: git.garen.dev
|
||||||
uses: docker/bake-action@v6
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
with:
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
files: docker-bake.hcl
|
- name: Set up Docker Buildx
|
||||||
source: .
|
uses: docker/setup-buildx-action@v3
|
||||||
push: true
|
with:
|
||||||
|
platforms: linux/amd64, linux/arm64
|
||||||
|
- name: Bake and push
|
||||||
|
uses: docker/bake-action@v6
|
||||||
|
with:
|
||||||
|
files: docker-bake.hcl
|
||||||
|
source: .
|
||||||
|
push: true
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
name: clippy
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "main" ]
|
|
||||||
pull_request:
|
|
||||||
# The branches below must be a subset of the branches above
|
|
||||||
branches: [ "main" ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
clippy:
|
|
||||||
name: Run rust-clippy analyzing
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
security-events: write
|
|
||||||
actions: read
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
|
|
||||||
with:
|
|
||||||
profile: minimal
|
|
||||||
toolchain: nightly
|
|
||||||
components: clippy
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Install required cargo
|
|
||||||
run: cargo install clippy-sarif sarif-fmt
|
|
||||||
|
|
||||||
- name: Run rust-clippy
|
|
||||||
run:
|
|
||||||
cargo clippy
|
|
||||||
--all-features
|
|
||||||
--message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Upload analysis results to GitHub
|
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
|
||||||
with:
|
|
||||||
sarif_file: rust-clippy-results.sarif
|
|
||||||
wait-for-processing: true
|
|
@ -1,4 +1,4 @@
|
|||||||
use crate::protocol::mctypes::VarInt;
|
use crate::protocol::types::VarInt;
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
|
||||||
pub struct Sniffer {
|
pub struct Sniffer {
|
||||||
|
@ -11,7 +11,7 @@ use error::{Error, NetworkError};
|
|||||||
use tokio::net::TcpStream;
|
use tokio::net::TcpStream;
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
use tokio_util::sync::CancellationToken;
|
use tokio_util::sync::CancellationToken;
|
||||||
use tracing::{debug, error, info, trace};
|
use tracing::{info, trace};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Proxy {
|
pub struct Proxy {
|
||||||
@ -91,7 +91,7 @@ impl App for Proxy {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut client_error = false;
|
let mut client_error = false;
|
||||||
let mut server_error = false;
|
let server_error = false;
|
||||||
|
|
||||||
// At the same time, try to read packets from the server and client.
|
// At the same time, try to read packets from the server and client.
|
||||||
// Forward the packet onto the other.
|
// Forward the packet onto the other.
|
||||||
@ -140,7 +140,7 @@ impl App for Proxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
server_error = true;
|
// server_error = true;
|
||||||
return match e {
|
return match e {
|
||||||
NetworkError::Parsing => {
|
NetworkError::Parsing => {
|
||||||
trace!("Got invalid data from upstream");
|
trace!("Got invalid data from upstream");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user