Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP DON'T MERGE #1665

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/static_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Create a new release

on:
push:
branches:
- fix/static_build
jobs:
test-release:
name: Build for Linux
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@main
- name: Build-musl
run: |
echo "Building static binaries using ekidd/rust-musl-builder"
docker build -t fastn-build-image .
docker run --name fastn-build fastn-build-image
mkdir -p out
docker cp fastn-build:/home/rust/src/target/x86_64-unknown-linux-musl/release/fastn out/
- name: ls files
run: |
ls target/
ls out/
file out/fastn
66 changes: 35 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ reqwest = { version = "0.11", features = ["json"] }
rink = { git = "https://github.com/DioxusLabs/dioxus", rev = "fb52673433cc57a70c86185ffa7da5fa3a2394da" }
ron = "0.8"
rquickjs = { version = "0.4", features = ["macro"] }
quick-js = "0.4"
rustc-hash = "1"
rusty-hook = "0.11"
serde = { version = "1", features = ["derive"] }
Expand Down
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ekidd/rust-musl-builder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should move this to .github folder.


# We need to add the source code to the image because `rust-musl-builder`
# assumes a UID of 1000
ADD --chown=rust:rust . ./

CMD RUSTFLAGS="-Clink-arg=-Wl,--allow-multiple-definition" cargo build --release --features=auth
4 changes: 3 additions & 1 deletion fastn-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ controller = ["remote"]
# is created for every user, and local edits in the workspace is allowed.
remote = []

auth = ["oauth2", "diesel", "diesel_migrations", "diesel-async", "lettre"]
auth = ["oauth2", "diesel", "diesel_migrations", "diesel-async", "lettre", "argon2"]

[dependencies]
actix-web.workspace = true
antidote.workspace = true
argon2 = { workspace = true, optional = true }
async-lock.workspace = true
async-recursion.workspace = true
camino.workspace = true
chrono.workspace = true
clap.workspace = true
colored.workspace = true
deadpool-postgres.workspace = true
Expand Down
6 changes: 0 additions & 6 deletions fastn-js/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,12 @@ repository.workspace = true
homepage.workspace = true

[dependencies]
#rquickjs = { workspace = true, optional = true }
pretty.workspace = true
itertools.workspace = true
indoc.workspace = true
fastn-grammar.workspace = true
prettify-js.workspace = true
camino.workspace = true

[target.'cfg(not(windows))'.dependencies]
quick-js.workspace = true

[target.'cfg(windows)'.dependencies]
rquickjs.workspace = true

[dev-dependencies]
Expand Down
44 changes: 6 additions & 38 deletions fastn-js/src/ssr.rs
Original file line number Diff line number Diff line change
@@ -1,48 +1,16 @@
pub fn run_test(js: &str) -> Vec<bool> {
#[cfg(target_os = "windows")]
{
rquickjs::Context::full(&rquickjs::Runtime::new().unwrap())
.unwrap()
.with(|ctx| ctx.eval::<Vec<bool>, _>(js).unwrap())
}
#[cfg(not(target_os = "windows"))]
{
// Added logging support from console from within context
let context = quick_js::Context::builder()
.console(
|level: quick_js::console::Level, args: Vec<quick_js::JsValue>| {
eprintln!("{}: {:?}", level, args);
},
)
.build()
.unwrap();
context.eval_as::<Vec<bool>>(js).unwrap()
}
rquickjs::Context::full(&rquickjs::Runtime::new().unwrap())
.unwrap()
.with(|ctx| ctx.eval::<Vec<bool>, _>(js).unwrap())
}

pub fn ssr_str(js: &str) -> String {
let all_js = fastn_js::all_js_with_test();
let js = format!("{all_js}{js}");

#[cfg(target_os = "windows")]
{
rquickjs::Context::full(&rquickjs::Runtime::new().unwrap())
.unwrap()
.with(|ctx| ctx.eval::<String, _>(js).unwrap())
}
#[cfg(not(target_os = "windows"))]
{
// Added logging support from console from within context
let context = quick_js::Context::builder()
.console(
|level: quick_js::console::Level, args: Vec<quick_js::JsValue>| {
eprintln!("{}: {:?}", level, args);
},
)
.build()
.unwrap();
context.eval_as::<String>(js.as_str()).unwrap()
}
rquickjs::Context::full(&rquickjs::Runtime::new().unwrap())
.unwrap()
.with(|ctx| ctx.eval::<String, _>(js).unwrap())
}

pub fn ssr(ast: &[fastn_js::Ast]) -> String {
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading