chore+fix: updates dependencies and fixes workflow

chore+fix: updates dependencies and fixes workflow
This commit is contained in:
itsscb 2024-08-28 20:22:24 +02:00 committed by GitHub
commit ab78b192f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 133 additions and 103 deletions

View File

@ -11,10 +11,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: checkout
uses: actions/checkout@v4
- name: Cache dependencies
- name: cache dependencies
uses: actions/cache@v4
with:
path: |
@ -23,42 +23,41 @@ jobs:
~/.cache/trunk/
target/
node_modules/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-${{ hashFiles('./Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-wordl
- name: Install Rust
- name: install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Add Rust target wasm32-unknown-unknown
- name: add rust target wasm32-unknown-unknown
run: rustup target add wasm32-unknown-unknown
- name: Install Trunk
- name: install trunk
run: cargo install trunk
- name: Install Node.js
- name: install node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Tailwind CSS
- name: install tailwindcss
run: npm install -g tailwindcss
- name: Build Frontend
- name: build frontend
working-directory: ./frontend/
run: |
trunk build --release
- name: Upload Frontend Artifacts
- name: upload frontend artifacts
uses: actions/upload-artifact@v4
with:
name: frontend-artifacts
path: ./frontend/dist
- name: Build and test code
- name: run tests
run: |
cargo test --verbose
@ -66,14 +65,19 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Frontend Artifacts
- name: checkout
uses: actions/checkout@v4
- name: download frontend artifacts
uses: actions/download-artifact@v4
with:
name: frontend-artifacts
- name: Checkout
uses: actions/checkout@v4
- name: display structure of downloaded files
run: ls -R
working-directory: ./frontend/dist
- uses: shuttle-hq/deploy-action@main
with:
deploy-key: ${{ secrets.SHUTTLE_API_KEY }}
working-directory: .

View File

@ -4,11 +4,11 @@ version = "0.1.0"
edition = "2021"
[dependencies]
axum = "0.7.4"
axum = "0.7.5"
http = "1.1.0"
rand = "0.8.5"
shuttle-axum = "0.45.0"
shuttle-runtime = "0.45.0"
shuttle-axum = "0.47.0"
shuttle-runtime = "0.47.0"
tower-http = { version = "0.5.2", features = ["fs", "cors"] }
tracing = "0.1.40"

63
flake.lock generated
View File

@ -1,6 +1,40 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1724748588,
"narHash": "sha256-NlpGA4+AIf1dKNq76ps90rxowlFXUsV9x7vK/mN37JM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a6292e34000dc93d43bccf78338770c1c5ec8a99",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1718428119,
"narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=",
@ -18,23 +52,21 @@
},
"root": {
"inputs": {
"nixpkgs": [
"rust-overlay",
"nixpkgs"
],
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1724293269,
"narHash": "sha256-x/XhOAszT/ejditCHUtGOjQcVg2AQhrC/QVew3i7kTI=",
"lastModified": 1724811750,
"narHash": "sha256-PvhVgQ1rm3gfhK7ts4emprhh/KMkFwXogmgsQ3srR7g=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "6dc6d34a3a217457d7044dcce32b6d537480a6a1",
"rev": "6a1c4915dca7149e7258d8c7f3ac634d8c65f6c6",
"type": "github"
},
"original": {
@ -42,6 +74,21 @@
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

100
flake.nix
View File

@ -1,67 +1,49 @@
{
description = "Example Rust development environment for Zero to Nix";
# Flake inputs
inputs = {
# nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
rust-overlay.url = "github:oxalica/rust-overlay"; # A helper for Rust + Nix
# cargo2nix.url = "github:cargo2nix/cargo2nix/";
nixpkgs.follows = "rust-overlay/nixpkgs";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
# Flake outputs
outputs = { self, nixpkgs, rust-overlay}:
let
# Overlays enable you to customize the Nixpkgs attribute set
overlays = [
# Makes a `rust-bin` attribute available in Nixpkgs
(import rust-overlay)
# Provides a `rustToolchain` attribute for Nixpkgs that we can use to
# create a Rust environment
(self: super: {
rustToolchain = super.rust-bin.stable.latest.default;
})
];
# Systems supported
allSystems = [
"x86_64-linux" # 64-bit Intel/AMD Linux
"aarch64-linux" # 64-bit ARM Linux
"x86_64-darwin" # 64-bit Intel macOS
"aarch64-darwin" # 64-bit ARM macOS
];
# rustTarget = nixpkgs.pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
# extensions = [ "rust-src" "rustup" "rust-analyzer" "rust-std" ];
# targets = [ "x86_64-unknown-linux-gnu" "wasm32-unknown-unknown" ];
# });
# Helper to provide system-specific attributes
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
in
{
# Development environment output
devShells = forAllSystems ({ pkgs }: {
default = pkgs.mkShell {
buildInputs = [
pkgs.cargo-shuttle
];
# shellHook = ''
# rustup target add wasm32-unknown-unknown
# '';
# The Nix packages provided in the environment
packages = (with pkgs; [
# The package provided by our custom overlay. Includes cargo, Clippy, cargo-fmt,
# rustdoc, rustfmt, and other tools.
rust-analyzer
clippy
trunk
tailwindcss
rustToolchain
]) ++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [ libiconv ]);
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
});
};
rustToolchain = pkgs.rust-bin.nightly.latest.default.override {
extensions = [ "rust-src" "rust-analyzer" "clippy" "rustfmt" ];
targets = [ "x86_64-unknown-linux-gnu" "wasm32-unknown-unknown" ];
};
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
rustToolchain
trunk
clippy
tailwindcss
cargo-shuttle
cargo-edit
openssl
pkg-config
];
shellHook = ''
export PATH=${rustToolchain}/bin:$PATH
export RUSTC_VERSION=$(rustc --version)
export RUST_SRC_PATH="${rustToolchain}/lib/rustlib/src/rust/library"
export OPENSSL_DIR="${pkgs.openssl.dev}"
export OPENSSL_LIB_DIR="${pkgs.openssl.out}/lib"
export OPENSSL_INCLUDE_DIR="${pkgs.openssl.dev}/include"
'';
packages = pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [ libiconv ]);
};
}
);
}

View File

@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
web-sys = { version = "0.3.69", features = [
web-sys = { version = "0.3.70", features = [
"HtmlElement",
"HtmlInputElement",
"KeyboardEvent",
@ -17,4 +17,4 @@ wasm-bindgen-futures = "0.4.43"
wasm-bindgen = "0.2.93"
yewdux = "0.10.0"
gloo-net = "0.6.0"
serde = { version = "1.0.198", features = ["derive"] }
serde = { version = "1.0.209", features = ["derive"] }

12
frontend/flake.lock generated
View File

@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1724015816,
"narHash": "sha256-hVESnM7Eiz93+4DeiE0a1TwMeaeph1ytRJ5QtqxYRWg=",
"lastModified": 1724748588,
"narHash": "sha256-NlpGA4+AIf1dKNq76ps90rxowlFXUsV9x7vK/mN37JM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9aa35efbea27d320d0cdc5f922f0890812affb60",
"rev": "a6292e34000dc93d43bccf78338770c1c5ec8a99",
"type": "github"
},
"original": {
@ -62,11 +62,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1724034091,
"narHash": "sha256-b1g7w0sw+MDAhUAeCoX1vlTghsqcDZkxr+k9OZmxPa8=",
"lastModified": 1724811750,
"narHash": "sha256-PvhVgQ1rm3gfhK7ts4emprhh/KMkFwXogmgsQ3srR7g=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "c7d36e0947826e0751a5214ffe82533fbc909bc0",
"rev": "6a1c4915dca7149e7258d8c7f3ac634d8c65f6c6",
"type": "github"
},
"original": {

View File

@ -24,6 +24,7 @@
buildInputs = with pkgs; [
rustToolchain
trunk
clippy
tailwindcss
];

View File

@ -1,14 +1,10 @@
module.exports = {
purge: {
mode: "all",
content: [
"./src/**/*.rs",
"./src/pages/documents.rs",
"./index.html",
"./src/**/*.html",
"./src/**/*.css",
],
},
content: [
"./src/**/*.rs",
"./index.html",
"./src/**/*.html",
"./src/**/*.css",
],
theme: {},
variants: {},
plugins: [],