fix(CI): free-up disk, properly gate nightly feature and pre-install deps (#3735)

* fix(CI): pre-install tailwind and sass

* chore: retrigger CI

* fix(CI): properly set `erased_mode` in examples

* fix(CI): workflow logic install deps locally

* chore(CI): organized tailwind and sass versions

* fix: properly ignore nightly features on stable rustc

* fix(CI): typo

* fix: missing cfg attr

* fix: properly gate nightly module in `reactive_graph``

* fix: complete `rustc_nightly` cfg gate

* fix(CI): making even more space for CI workers

* fix: missing one more rustc_nightly gated feature

* fix: maximize the speed of cargo-all-features by limiting combinations to 2
This commit is contained in:
Saber Haj Rabiee
2025-03-20 14:28:07 -07:00
committed by GitHub
parent 9210636266
commit 52c770c7da
42 changed files with 185 additions and 48 deletions

View File

@@ -1,5 +1,4 @@
name: Changed Examples Matrix Call
on:
workflow_call:
inputs:
@@ -11,7 +10,6 @@ on:
matrix:
description: "Matrix"
value: ${{ jobs.get-example-changed.outputs.matrix }}
jobs:
get-example-changed:
name: Get Changed Example Matrix
@@ -23,7 +21,6 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get example project directories that changed
id: changed-dirs
uses: tj-actions/changed-files@v45
@@ -38,17 +35,17 @@ jobs:
!examples/*.md
json: true
quotepath: false
- name: List example project directories that changed
run: echo '${{ steps.changed-dirs.outputs.all_changed_files }}'
- name: Set Matrix
id: set-matrix
run: |
if [ ${{ inputs.example_changed }} == 'true' ]; then
# Create matrix with changed directories
echo "matrix={\"directory\":${{ steps.changed-dirs.outputs.all_changed_files }}}" >> "$GITHUB_OUTPUT"
directories="${{ steps.changed-dirs.outputs.all_changed_files }}"
else
directories="NO_CHANGE"
# Create matrix with one item to prevent an empty vector error
echo "matrix={\"directory\":[\"NO_CHANGE\"], \"erased_mode\": [false, true]}" >> "$GITHUB_OUTPUT"
fi
echo "matrix={\"directory\":"$directories", \"erased_mode\": [false, true]}" >> "$GITHUB_OUTPUT"

View File

@@ -19,6 +19,8 @@ env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
DEBIAN_FRONTEND: noninteractive
RUSTFLAGS: ${{ inputs.erased_mode && '--cfg erase_components' || '' }}
LEPTOS_TAILWIND_VERSION: v4.0.14
LEPTOS_SASS_VERSION: 1.86.0
jobs:
test:
name: "Run ${{ inputs.cargo_make_task }} (${{ inputs.toolchain }}) (erased_mode: ${{ inputs.erased_mode }})"
@@ -30,11 +32,19 @@ jobs:
df -h
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/local/lib/android/sdk/ndk
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf /usr/local/lib/node_modules
sudo apt-get clean
sudo apt-get purge -y '^ghc-.*' '^dotnet-.*' '^llvm-.*' '^mono-.*' '^php.*' '^ruby.*'
sudo apt-get autoremove -y
sudo apt-get clean
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
docker system prune -af
docker image prune -af
docker volume prune -f
echo "Disk space after cleanup:"
df -h
# Setup environment
@@ -125,8 +135,26 @@ jobs:
sudo apt-get update
sudo apt-get install -y libglib2.0-dev libgio2.0-cil-dev libgraphene-1.0-dev libcairo2-dev libpango1.0-dev libgtk-4-dev
fi
- name: Enter ${{ inputs.directory }}
run: |
cd ${{ inputs.directory }}
- name: Install Tailwind and Sass dependencies
if: contains(inputs.directory, 'examples')
run: |
tailwindcss_version=$(echo "$LEPTOS_TAILWIND_VERSION" | sed 's/^v//')
sass_version="$LEPTOS_SASS_VERSION"
pnpm add "tailwindcss@$tailwindcss_version" "@tailwindcss/cli@$tailwindcss_version" "sass@$sass_version"
echo "Tailwind CSS version:"
./node_modules/.bin/tailwindcss --version
echo "Sass version:"
./node_modules/.bin/sass --version
# Run Cargo Make Task
- name: ${{ inputs.cargo_make_task }}
run: |
cd ${{ inputs.directory }}
cargo make --profile=github-actions ${{ inputs.cargo_make_task }}
- name: Clean up ${{ inputs.directory }}
run: |
cargo clean || true
rm -rf node_modules || true

6
Cargo.lock generated
View File

@@ -1796,6 +1796,7 @@ dependencies = [
"rand 0.8.5",
"reactive_graph",
"rustc-hash 2.1.1",
"rustc_version",
"send_wrapper",
"serde",
"serde_json",
@@ -1953,6 +1954,7 @@ dependencies = [
"proc-macro2",
"quote",
"rstml",
"rustc_version",
"serde",
"server_fn",
"server_fn_macro 0.8.0-beta",
@@ -1993,6 +1995,7 @@ dependencies = [
"or_poisoned",
"percent-encoding",
"reactive_graph",
"rustc_version",
"send_wrapper",
"tachys",
"thiserror 2.0.12",
@@ -2742,6 +2745,7 @@ dependencies = [
"or_poisoned",
"pin-project-lite",
"rustc-hash 2.1.1",
"rustc_version",
"send_wrapper",
"serde",
"slotmap",
@@ -3295,6 +3299,7 @@ dependencies = [
"convert_case 0.6.0",
"proc-macro2",
"quote",
"rustc_version",
"syn 2.0.100",
"xxhash-rust",
]
@@ -3520,6 +3525,7 @@ dependencies = [
"reactive_graph",
"reactive_stores",
"rustc-hash 2.1.1",
"rustc_version",
"send_wrapper",
"serde",
"serde_json",

View File

@@ -81,6 +81,7 @@ opt-level = 'z'
[workspace.metadata.cargo-all-features]
skip_feature_sets = [["csr", "ssr"], ["csr", "hydrate"], ["ssr", "hydrate"]]
max_combination_size = 2
[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [

View File

@@ -34,3 +34,4 @@ rustdoc-args = ["--cfg", "docsrs"]
[package.metadata.cargo-all-features]
denylist = ["tracing"]
max_combination_size = 2

View File

@@ -1,5 +1,3 @@
use std::sync::LazyLock;
use leptos::prelude::*;
use leptos_meta::*;
use leptos_router::{
@@ -9,6 +7,7 @@ use leptos_router::{
ParamSegment, SsrMode, StaticSegment,
};
use serde::{Deserialize, Serialize};
use std::sync::LazyLock;
use thiserror::Error;
#[component]

View File

@@ -39,3 +39,4 @@ tracing = ["dep:tracing"]
[package.metadata.cargo-all-features]
denylist = ["tracing"]
max_combination_size = 2

View File

@@ -51,3 +51,4 @@ rustdoc-args = ["--generate-link-to-definition"]
[package.metadata.cargo-all-features]
denylist = ["tracing"]
max_combination_size = 2

View File

@@ -96,6 +96,9 @@ trace-component-props = [
]
delegation = ["tachys/delegation"]
[build-dependencies]
rustc_version = "0.4.1"
# Having an erasure feature rather than normal --cfg erase_components for the proc macro crate is a workaround for this rust issue:
# https://github.com/rust-lang/cargo/issues/4423
# TLDR proc macros will ignore RUSTFLAGS when --target is specified on the cargo command.
@@ -160,9 +163,13 @@ skip_feature_sets = [
"rustls",
],
]
max_combination_size = 2
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(leptos_debuginfo)'] }
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(leptos_debuginfo)',
'cfg(rustc_nightly)',
] }

8
leptos/build.rs Normal file
View File

@@ -0,0 +1,8 @@
use rustc_version::{version_meta, Channel};
fn main() {
// Set cfg flags depending on release channel
if matches!(version_meta().unwrap().channel, Channel::Nightly) {
println!("cargo:rustc-cfg=rustc_nightly");
}
}

View File

@@ -141,8 +141,8 @@
//! }
//! ```
#![cfg_attr(feature = "nightly", feature(fn_traits))]
#![cfg_attr(feature = "nightly", feature(unboxed_closures))]
#![cfg_attr(all(feature = "nightly", rustc_nightly), feature(fn_traits))]
#![cfg_attr(all(feature = "nightly", rustc_nightly), feature(unboxed_closures))]
extern crate self as leptos;

View File

@@ -37,6 +37,7 @@ rustdoc-args = ["--generate-link-to-definition"]
[package.metadata.cargo-all-features]
denylist = ["tracing"]
max_combination_size = 2
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(leptos_debuginfo)'] }

View File

@@ -19,3 +19,6 @@ futures = "0.3.0"
default = ["ssr"]
ssr = ["leptos/ssr", "dep:actix-files", "dep:actix-web"]
hydrate = ["leptos/hydrate", "dep:wasm-bindgen", "dep:gloo"]
[package.metadata.cargo-all-features]
max_combination_size = 2

View File

@@ -39,6 +39,9 @@ server_fn = { path = "../server_fn", features = ["cbor"] }
insta = "1.41"
serde = "1.0"
[build-dependencies]
rustc_version = "0.4.1"
[features]
csr = []
hydrate = []
@@ -87,6 +90,10 @@ skip_feature_sets = [
"axum",
],
]
max_combination_size = 2
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(rustc_nightly)'] }

8
leptos_macro/build.rs Normal file
View File

@@ -0,0 +1,8 @@
use rustc_version::{version_meta, Channel};
fn main() {
// Set cfg flags depending on release channel
if matches!(version_meta().unwrap().channel, Channel::Nightly) {
println!("cargo:rustc-cfg=rustc_nightly");
}
}

View File

@@ -1,6 +1,6 @@
//! Macros for use with the Leptos framework.
#![cfg_attr(feature = "nightly", feature(proc_macro_span))]
#![cfg_attr(all(feature = "nightly", rustc_nightly), feature(proc_macro_span))]
#![forbid(unsafe_code)]
// to prevent warnings from popping up when a nightly feature is stabilized
#![allow(stable_features)]
@@ -359,7 +359,7 @@ fn view_macro_impl(tokens: TokenStream, template: bool) -> TokenStream {
fn normalized_call_site(site: proc_macro::Span) -> Option<String> {
cfg_if::cfg_if! {
if #[cfg(all(debug_assertions, feature = "nightly"))] {
if #[cfg(all(debug_assertions, feature = "nightly", rustc_nightly))] {
Some(leptos_hot_reload::span_to_stable_id(
site.source_file().path(),
site.start().line()

View File

@@ -327,9 +327,9 @@ fn is_attr_let(key: &NodeName) -> bool {
}
}
pub fn items_to_clone_to_tokens<'a>(
items_to_clone: &'a [Ident],
) -> impl Iterator<Item = TokenStream> + 'a {
pub fn items_to_clone_to_tokens(
items_to_clone: &[Ident],
) -> impl Iterator<Item = TokenStream> + '_ {
items_to_clone.iter().map(|ident| {
let ident_ref = quote_spanned!(ident.span()=> &#ident);
quote! { let #ident = ::core::clone::Clone::clone(#ident_ref); }

View File

@@ -611,7 +611,7 @@ fn node_to_tokens(
fn text_to_tokens(text: &LitStr) -> TokenStream {
// on nightly, can use static string optimization
if cfg!(feature = "nightly") {
if cfg!(all(feature = "nightly", rustc_nightly)) {
quote! {
::leptos::tachys::view::static_types::Static::<#text>
}
@@ -1512,7 +1512,7 @@ fn attribute_value(
Some(value) => match &value.value {
KVAttributeValue::Expr(expr) => {
if let Expr::Lit(lit) = expr {
if cfg!(feature = "nightly") {
if cfg!(all(feature = "nightly", rustc_nightly)) {
if let Lit::Str(str) = &lit.lit {
return quote! {
::leptos::tachys::view::static_types::Static::<#str>

View File

@@ -43,6 +43,7 @@ tracing = ["dep:tracing"]
[package.metadata.cargo-all-features]
denylist = ["tracing"]
max_combination_size = 2
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]

View File

@@ -33,6 +33,7 @@ rustdoc-args = ["--generate-link-to-definition"]
[package.metadata.cargo-all-features]
denylist = ["tracing"]
max_combination_size = 2
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(leptos_debuginfo)'] }

View File

@@ -32,6 +32,9 @@ tokio = { version = "1.43", features = ["rt-multi-thread", "macros"] }
tokio-test = { version = "0.4.4" }
any_spawner = { workspace = true, features = ["futures-executor", "tokio"] }
[build-dependencies]
rustc_version = "0.4.1"
[features]
nightly = []
serde = ["dep:serde"]
@@ -47,6 +50,10 @@ rustdoc-args = ["--cfg", "docsrs"]
[package.metadata.cargo-all-features]
denylist = ["tracing"]
max_combination_size = 2
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(leptos_debuginfo)'] }
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(leptos_debuginfo)',
'cfg(rustc_nightly)',
] }

8
reactive_graph/build.rs Normal file
View File

@@ -0,0 +1,8 @@
use rustc_version::{version_meta, Channel};
fn main() {
// Set cfg flags depending on release channel
if matches!(version_meta().unwrap().channel, Channel::Nightly) {
println!("cargo:rustc-cfg=rustc_nightly");
}
}

View File

@@ -68,8 +68,8 @@
//! [Reactively](https://github.com/modderme123/reactively), as described
//! [in this article](https://dev.to/modderme123/super-charging-fine-grained-reactive-performance-47ph).
#![cfg_attr(feature = "nightly", feature(unboxed_closures))]
#![cfg_attr(feature = "nightly", feature(fn_traits))]
#![cfg_attr(all(feature = "nightly", rustc_nightly), feature(unboxed_closures))]
#![cfg_attr(all(feature = "nightly", rustc_nightly), feature(fn_traits))]
#![deny(missing_docs)]
use std::{fmt::Arguments, future::Future};
@@ -92,7 +92,7 @@ pub mod wrappers;
use computed::ScopedFuture;
#[cfg(feature = "nightly")]
#[cfg(all(feature = "nightly", rustc_nightly))]
mod nightly;
/// Reexports frequently-used traits.

View File

@@ -56,6 +56,9 @@ features = [
"Response",
]
[build-dependencies]
rustc_version = "0.4.1"
[features]
tracing = ["dep:tracing"]
ssr = ["dep:percent-encoding"]
@@ -66,9 +69,11 @@ rustdoc-args = ["--generate-link-to-definition"]
[package.metadata.cargo-all-features]
denylist = ["tracing"]
max_combination_size = 2
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(leptos_debuginfo)',
'cfg(erase_components)',
'cfg(rustc_nightly)',
] }

8
router/build.rs Normal file
View File

@@ -0,0 +1,8 @@
use rustc_version::{version_meta, Channel};
fn main() {
// Set cfg flags depending on release channel
if matches!(version_meta().unwrap().channel, Channel::Nightly) {
println!("cargo:rustc-cfg=rustc_nightly");
}
}

View File

@@ -121,8 +121,8 @@
#![forbid(unsafe_code)]
#![deny(missing_docs)]
#![cfg_attr(feature = "nightly", feature(auto_traits))]
#![cfg_attr(feature = "nightly", feature(negative_impls))]
#![cfg_attr(all(feature = "nightly", rustc_nightly), feature(auto_traits))]
#![cfg_attr(all(feature = "nightly", rustc_nightly), feature(negative_impls))]
/// Components for route definition and for enhanced links and forms.
pub mod components;

View File

@@ -200,7 +200,7 @@ where
}
// TODO can we support Option<T> and T in a non-nightly way?
#[cfg(feature = "nightly")]
#[cfg(all(feature = "nightly", rustc_nightly))]
mod option_param {
use super::{IntoParam, ParamsError};
use std::{str::FromStr, sync::Arc};

View File

@@ -231,6 +231,7 @@ skip_feature_sets = [
"rkyv",
],
]
max_combination_size = 2
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(leptos_debuginfo)'] }

View File

@@ -19,3 +19,6 @@ nightly = ["server_fn_macro/nightly"]
ssr = ["server_fn_macro/ssr"]
actix = ["server_fn_macro/actix"]
axum = ["server_fn_macro/axum"]
[package.metadata.cargo-all-features]
max_combination_size = 2

View File

@@ -16,6 +16,11 @@ xxhash-rust = { version = "0.8.12", features = ["const_xxh64"] }
const_format = "0.2.33"
convert_case = "0.6.0"
[build-dependencies]
rustc_version = "0.4.1"
[features]
nightly = []
ssr = []
@@ -26,3 +31,9 @@ reqwest = []
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]
[package.metadata.cargo-all-features]
max_combination_size = 2
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(rustc_nightly)'] }

8
server_fn_macro/build.rs Normal file
View File

@@ -0,0 +1,8 @@
use rustc_version::{version_meta, Channel};
fn main() {
// Set cfg flags depending on release channel
if matches!(version_meta().unwrap().channel, Channel::Nightly) {
println!("cargo:rustc-cfg=rustc_nightly");
}
}

View File

@@ -1,4 +1,4 @@
#![cfg_attr(feature = "nightly", feature(proc_macro_span))]
#![cfg_attr(all(feature = "nightly", rustc_nightly), feature(proc_macro_span))]
#![forbid(unsafe_code)]
#![deny(missing_docs)]

View File

@@ -169,6 +169,9 @@ serde_json = { version = "1", optional = true }
tokio-test = "0.4.4"
tokio = { version = "1.43", features = ["rt", "macros"] }
[build-dependencies]
rustc_version = "0.4.1"
[features]
default = ["testing"]
delegation = [] # enables event delegation
@@ -200,9 +203,11 @@ skip_feature_sets = [
"delegation",
],
]
max_combination_size = 2
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(leptos_debuginfo)',
'cfg(erase_components)',
'cfg(rustc_nightly)',
] }

8
tachys/build.rs Normal file
View File

@@ -0,0 +1,8 @@
use rustc_version::{version_meta, Channel};
fn main() {
// Set cfg flags depending on release channel
if matches!(version_meta().unwrap().channel, Channel::Nightly) {
println!("cargo:rustc-cfg=rustc_nightly");
}
}

View File

@@ -170,7 +170,7 @@ impl CustomAttributeKey for Arc<str> {
const KEY: &'static str = "";
}
#[cfg(feature = "nightly")]
#[cfg(all(feature = "nightly", rustc_nightly))]
impl<const K: &'static str> CustomAttributeKey
for crate::view::static_types::Static<K>
{

View File

@@ -202,7 +202,7 @@ impl<'a> AttributeValue for &'a str {
}
}
#[cfg(feature = "nightly")]
#[cfg(all(feature = "nightly", rustc_nightly))]
impl<const V: &'static str> AttributeValue
for crate::view::static_types::Static<V>
{

View File

@@ -571,7 +571,7 @@ impl IntoClass for (&'static str, bool) {
}
}
#[cfg(feature = "nightly")]
#[cfg(all(feature = "nightly", rustc_nightly))]
impl<const V: &'static str> IntoClass for crate::view::static_types::Static<V> {
const TEMPLATE: &'static str = V;

View File

@@ -745,7 +745,7 @@ where
/*
#[cfg(all(test, feature = "testing"))]
mod tests {
#[cfg(feature = "nightly")]
#[cfg(all(feature = "nightly", rustc_nightly))]
use super::RenderHtml;
use super::{main, p, HtmlElement};
use crate::{
@@ -782,7 +782,7 @@ mod tests {
);
}
#[cfg(feature = "nightly")]
#[cfg(all(feature = "nightly", rustc_nightly))]
#[test]
fn html_render_allocates_appropriate_buffer() {
use crate::view::static_types::Static;

View File

@@ -2,7 +2,7 @@ use super::attribute::{
maybe_next_attr_erasure_macros::next_attr_output_type, Attribute,
NextAttribute,
};
#[cfg(feature = "nightly")]
#[cfg(all(feature = "nightly", rustc_nightly))]
use crate::view::static_types::Static;
use crate::{
html::attribute::maybe_next_attr_erasure_macros::next_attr_combine,
@@ -661,7 +661,7 @@ impl_style_value!(String);
#[cfg(feature = "oco")]
impl_style_value!(oco_ref::Oco<'static, str>);
#[cfg(feature = "nightly")]
#[cfg(all(feature = "nightly", rustc_nightly))]
impl<const V: &'static str> IntoStyleValue for Static<V> {
type AsyncOutput = Self;
type State = Self;
@@ -707,7 +707,7 @@ impl<const V: &'static str> IntoStyleValue for Static<V> {
}
}
#[cfg(feature = "nightly")]
#[cfg(all(feature = "nightly", rustc_nightly))]
impl<const V: &'static str> IntoStyleValue for Option<Static<V>> {
type AsyncOutput = Self;
type State = Self;
@@ -764,7 +764,7 @@ impl<const V: &'static str> IntoStyleValue for Option<Static<V>> {
}
}
#[cfg(feature = "nightly")]
#[cfg(all(feature = "nightly", rustc_nightly))]
impl<const V: &'static str> IntoStyle for crate::view::static_types::Static<V> {
type AsyncOutput = Self;
type State = ();

View File

@@ -6,7 +6,10 @@
// this is specifically used for `unsized_const_params` below
// this allows us to use const generic &'static str for static text nodes and attributes
#![allow(incomplete_features)]
#![cfg_attr(feature = "nightly", feature(unsized_const_params))]
#![cfg_attr(
all(feature = "nightly", rustc_nightly),
feature(unsized_const_params)
)]
#![deny(missing_docs)]
/// Commonly-used traits.

View File

@@ -22,7 +22,7 @@ pub mod iterators;
pub mod keyed;
mod primitives;
/// Optimized types for static strings known at compile time.
#[cfg(feature = "nightly")]
#[cfg(all(feature = "nightly", rustc_nightly))]
pub mod static_types;
/// View implementation for string types.
pub mod strings;