From 7e1e070e23d07c24170b1ed13a1d3b49be897dd0 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Thu, 11 Apr 2024 21:55:55 -0400 Subject: [PATCH] Update organic. --- .lighthouse/pipeline-format.yaml | 14 ++-- .lighthouse/pipeline-rust-clippy.yaml | 10 +-- .lighthouse/pipeline-rust-test.yaml | 8 +- Cargo.lock | 111 +++++++++++++++++++++++++- Cargo.toml | 2 +- docker/natter/Dockerfile | 4 +- docker/natter_development/Dockerfile | 3 +- docker/natter_development/Makefile | 1 - src/error/error.rs | 28 +++---- 9 files changed, 143 insertions(+), 38 deletions(-) diff --git a/.lighthouse/pipeline-format.yaml b/.lighthouse/pipeline-format.yaml index e53d3ef..be9057f 100644 --- a/.lighthouse/pipeline-format.yaml +++ b/.lighthouse/pipeline-format.yaml @@ -1,7 +1,7 @@ apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: - name: rust-clippy + name: rust-format spec: pipelineSpec: timeouts: @@ -109,9 +109,9 @@ spec: - name: docker-image type: string description: Docker image to run. - default: alpine:3.18 + default: alpine:3.19 stepTemplate: - image: alpine:3.18 + image: alpine:3.19 name: "" resources: requests: @@ -150,9 +150,9 @@ spec: - name: docker-image type: string description: Docker image to run. - default: alpine:3.18 + default: alpine:3.19 stepTemplate: - image: alpine:3.18 + image: alpine:3.19 name: "" resources: requests: @@ -278,9 +278,9 @@ spec: - name: docker-image type: string description: Docker image to run. - default: alpine:3.18 + default: alpine:3.19 stepTemplate: - image: alpine:3.18 + image: alpine:3.19 name: "" resources: requests: diff --git a/.lighthouse/pipeline-rust-clippy.yaml b/.lighthouse/pipeline-rust-clippy.yaml index 731f07e..4a02f3d 100644 --- a/.lighthouse/pipeline-rust-clippy.yaml +++ b/.lighthouse/pipeline-rust-clippy.yaml @@ -75,7 +75,7 @@ spec: - name: revision value: df36b3853a5657fd883015cdbf07ad6466918acf - name: pathInRepo - value: task/kaniko/0.6//kaniko.yaml + value: task/kaniko/0.6/kaniko.yaml params: - name: IMAGE value: "$(params.image-name):$(tasks.fetch-repository.results.commit)" @@ -109,9 +109,9 @@ spec: - name: docker-image type: string description: Docker image to run. - default: alpine:3.18 + default: alpine:3.19 stepTemplate: - image: alpine:3.18 + image: alpine:3.19 name: "" resources: requests: @@ -219,9 +219,9 @@ spec: - name: docker-image type: string description: Docker image to run. - default: alpine:3.18 + default: alpine:3.19 stepTemplate: - image: alpine:3.18 + image: alpine:3.19 name: "" resources: requests: diff --git a/.lighthouse/pipeline-rust-test.yaml b/.lighthouse/pipeline-rust-test.yaml index 7bbc64f..87e6c40 100644 --- a/.lighthouse/pipeline-rust-test.yaml +++ b/.lighthouse/pipeline-rust-test.yaml @@ -109,9 +109,9 @@ spec: - name: docker-image type: string description: Docker image to run. - default: alpine:3.18 + default: alpine:3.19 stepTemplate: - image: alpine:3.18 + image: alpine:3.19 name: "" resources: requests: @@ -209,9 +209,9 @@ spec: - name: docker-image type: string description: Docker image to run. - default: alpine:3.18 + default: alpine:3.19 stepTemplate: - image: alpine:3.18 + image: alpine:3.19 name: "" resources: requests: diff --git a/Cargo.lock b/Cargo.lock index 2cad9e5..6384d74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -110,6 +110,12 @@ dependencies = [ "wyz", ] +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + [[package]] name = "bytes" version = "1.5.0" @@ -303,6 +309,19 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +[[package]] +name = "gloo-utils" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5555354113b18c547c1d3a98fbf7fb32a9ff4f6fa112ce823a21641a0ba3aa" +dependencies = [ + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "hashbrown" version = "0.14.1" @@ -366,6 +385,15 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +[[package]] +name = "js-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +dependencies = [ + "wasm-bindgen", +] + [[package]] name = "lexical-core" version = "0.7.6" @@ -385,6 +413,12 @@ version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + [[package]] name = "memchr" version = "2.6.4" @@ -466,11 +500,18 @@ dependencies = [ ] [[package]] -name = "organic" -version = "0.1.13" +name = "once_cell" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61b01691695303b42f9a2ff318bec83853fbeb65c96569f2fb391e7636801c6" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "organic" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21c93465150e58006a06060a7f0304ee03a90ad6108e6767b48f7237654699f" dependencies = [ + "gloo-utils", "nom 7.1.3", "walkdir", ] @@ -725,6 +766,70 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "web-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 5f39eee..9010954 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ futures = "0.3.29" include_dir = "0.7.3" # TODO: This is temporary to work on the latest organic code. Eventually switch back to using the published crate. # organic = { path = "../organic" } -organic = "0.1.13" +organic = "0.1.16" serde = { version = "1.0.189", default-features = false, features = ["std", "derive"] } serde_json = "1.0.107" tokio = { version = "1.30.0", default-features = false, features = ["rt", "rt-multi-thread", "fs", "io-util"] } diff --git a/docker/natter/Dockerfile b/docker/natter/Dockerfile index f45caee..1d9a5d7 100644 --- a/docker/natter/Dockerfile +++ b/docker/natter/Dockerfile @@ -1,4 +1,4 @@ -FROM rustlang/rust:nightly-alpine3.17 AS builder +FROM rustlang/rust:nightly-alpine3.19 AS builder RUN apk add --no-cache musl-dev @@ -8,6 +8,6 @@ COPY . . # TODO: Add static build, which currently errors due to proc_macro. RUSTFLAGS="-C target-feature=+crt-static" RUN CARGO_TARGET_DIR=/target cargo build --profile release-lto -FROM alpine:3.17 AS runner +FROM alpine:3.19 AS runner COPY --from=builder /target/release-lto/natter /usr/bin/ diff --git a/docker/natter_development/Dockerfile b/docker/natter_development/Dockerfile index bfbcdb1..8a07667 100644 --- a/docker/natter_development/Dockerfile +++ b/docker/natter_development/Dockerfile @@ -1,8 +1,9 @@ -FROM rustlang/rust:nightly-alpine3.17 AS builder +FROM rustlang/rust:nightly-alpine3.19 AS builder RUN apk add --no-cache musl-dev RUN cargo install --locked --no-default-features --features ci-autoclean cargo-cache RUN rustup component add rustfmt +RUN rustup component add clippy FROM builder AS javascript diff --git a/docker/natter_development/Makefile b/docker/natter_development/Makefile index 0cf5653..c7f575c 100644 --- a/docker/natter_development/Makefile +++ b/docker/natter_development/Makefile @@ -4,7 +4,6 @@ SHELL := bash .DELETE_ON_ERROR: MAKEFLAGS += --warn-undefined-variables MAKEFLAGS += --no-builtin-rules -OS:=$(shell uname -s) ifeq ($(origin .RECIPEPREFIX), undefined) $(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later) diff --git a/src/error/error.rs b/src/error/error.rs index 44064e3..73d08ef 100644 --- a/src/error/error.rs +++ b/src/error/error.rs @@ -3,20 +3,20 @@ use std::string::FromUtf8Error; #[derive(Debug)] pub(crate) enum CustomError { - Static(&'static str), - String(String), - IO(std::io::Error), - TomlSerialize(toml::ser::Error), - TomlDeserialize(toml::de::Error), - WalkDir(walkdir::Error), - Tokio(tokio::task::JoinError), - Serde(serde_json::Error), - Utf8(Utf8Error), - FromUtf8(FromUtf8Error), - DusterCompile(duster::renderer::CompileError), - DusterRender(duster::renderer::RenderError), - PathStripPrefix(std::path::StripPrefixError), - UrlParseError(url::ParseError), + Static(#[allow(dead_code)] &'static str), + String(#[allow(dead_code)] String), + IO(#[allow(dead_code)] std::io::Error), + TomlSerialize(#[allow(dead_code)] toml::ser::Error), + TomlDeserialize(#[allow(dead_code)] toml::de::Error), + WalkDir(#[allow(dead_code)] walkdir::Error), + Tokio(#[allow(dead_code)] tokio::task::JoinError), + Serde(#[allow(dead_code)] serde_json::Error), + Utf8(#[allow(dead_code)] Utf8Error), + FromUtf8(#[allow(dead_code)] FromUtf8Error), + DusterCompile(#[allow(dead_code)] duster::renderer::CompileError), + DusterRender(#[allow(dead_code)] duster::renderer::RenderError), + PathStripPrefix(#[allow(dead_code)] std::path::StripPrefixError), + UrlParseError(#[allow(dead_code)] url::ParseError), } impl From for CustomError {