From a12b16bf8b520508fce1f323a474a8e5eeb4f340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Tue, 22 Jul 2025 14:31:26 -0700 Subject: [PATCH] CI build Fixes: https://github.com/fastly/compute-sdk-cpp/issues/45 --- .github/workflows/ci.yml | 73 ++++++++++++++++++++++++++ .github/workflows/doxygen-gh-pages.yml | 20 ------- src/backend.rs | 4 +- src/error.rs | 1 + src/http/header.rs | 2 +- src/http/request.rs | 1 + src/http/response.rs | 4 +- src/lib.rs | 2 + 8 files changed, 82 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/doxygen-gh-pages.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..67d6379 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,73 @@ +name: Build WebAssembly with WASI SDK + +on: [push, pull_request] + +env: + RUSTFLAGS: -Dwarnings + +jobs: + rustfmt: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt + - name: Check Rust Format + run: cargo fmt --all -- --check + + clippy: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: clippy + - name: Install WASI SDK + uses: konsumer/install-wasi-sdk@v1 + with: + version: "25" + - name: Run clippy + run: cargo clippy --all -- -D warnings + + clangfmt: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install WASI SDK + uses: konsumer/install-wasi-sdk@v1 + with: + version: "25" + - name: Check C++ Format + run: /opt/wasi-sdk/bin/clang-format --dry-run --Werror src/**/*.h src/**/*.cpp + + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install WASI SDK + uses: konsumer/install-wasi-sdk@v1 + with: + version: "25" + + - uses: extractions/setup-just@v3 + + - uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Build WebAssembly module + run: just + + - name: Build docs + uses: DenverCoder1/doxygen-github-pages-action@v2.0.0 + if: github.ref == 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: gh-pages + folder: docs/html + config_file: Doxyfile diff --git a/.github/workflows/doxygen-gh-pages.yml b/.github/workflows/doxygen-gh-pages.yml deleted file mode 100644 index 2b9d34f..0000000 --- a/.github/workflows/doxygen-gh-pages.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Doxygen GitHub Pages Deploy Action - -on: - push: - branches: - - main - -jobs: - deploy: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - # TODO: This won't work until we're actually _building_. Duh. - - uses: DenverCoder1/doxygen-github-pages-action@v2.0.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: gh-pages - folder: docs/html - config_file: Doxyfile diff --git a/src/backend.rs b/src/backend.rs index 537f3c3..f557ac1 100644 --- a/src/backend.rs +++ b/src/backend.rs @@ -102,8 +102,8 @@ impl Backend { } fn ensure_u32(num: u128) -> u32 { - if num > std::u32::MAX as u128 { - std::u32::MAX + if num > u32::MAX as u128 { + u32::MAX } else { num as u32 } diff --git a/src/error.rs b/src/error.rs index a749445..c9f2245 100644 --- a/src/error.rs +++ b/src/error.rs @@ -37,6 +37,7 @@ pub enum FastlyError { #[error(transparent)] IoError(#[from] std::io::Error), #[error(transparent)] + #[allow(clippy::enum_variant_names)] FastlyError(#[from] fastly::Error), #[error(transparent)] FastlySendError(#[from] fastly::http::request::SendError), diff --git a/src/http/header.rs b/src/http/header.rs index 93c9d49..3e9566f 100644 --- a/src/http/header.rs +++ b/src/http/header.rs @@ -4,6 +4,6 @@ pub struct HeaderValuesIter(pub Box> impl HeaderValuesIter { pub fn next(&mut self) -> UniquePtr> { - self.0.next().unwrap_or_else(|| CxxVector::new()) + self.0.next().unwrap_or_else(CxxVector::new) } } diff --git a/src/http/request.rs b/src/http/request.rs index c92d496..7350f13 100644 --- a/src/http/request.rs +++ b/src/http/request.rs @@ -14,6 +14,7 @@ use crate::try_fe; pub struct Request(pub(crate) fastly::Request); +#[allow(clippy::module_inception)] pub mod request { use crate::{ diff --git a/src/http/response.rs b/src/http/response.rs index cd454f3..48e3510 100644 --- a/src/http/response.rs +++ b/src/http/response.rs @@ -241,8 +241,8 @@ impl Response { } fn ensure_u32(num: u128) -> u32 { - if num > std::u32::MAX as u128 { - std::u32::MAX + if num > u32::MAX as u128 { + u32::MAX } else { num as u32 } diff --git a/src/lib.rs b/src/lib.rs index 165d75a..bef19b6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::boxed_local)] + use backend::*; use config_store::*; use device_detection::*;