Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
66 changes: 37 additions & 29 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,50 +45,58 @@ jobs:
- uses: actions/checkout@v2

# Cache Cargo binaries
- uses: actions/cache@v3
- uses: actions/cache@v4
id: cache
with:
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
# Only install the binaries if the cache doesn't have them
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install bonnie rust-script

# Also cache all the other Cargo files, since plenty of CI runs won't involve different dependencies
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}

- name: Run benchmark for ${{ matrix.name }} in category ${{ matrix.type }}
run: bonnie bench size ${{ matrix.type }} ${{ matrix.name }} --json | tee output.txt
run: bonnie bench size ${{ matrix.type }} ${{ matrix.name }} --json > output.txt

# Add this step to see what's actually in the file before the action runs
- name: "Debug: Display benchmark output file"
run: |
echo "--- Contents of output.txt ---"
cat output.txt
echo "------------------------------"

# Download previous benchmark result from cache (if exists)
- name: Download previous benchmark data
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark
path: ./cache
key: ${{ runner.os }}-benchmark

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
# What benchmark tool the output.txt came from
tool: "customSmallerIsBetter"
# Where the output from the benchmark tool is stored
output-file-path: output.txt
# Where the previous data file is stored
external-data-json-path: ./cache/benchmark-data.json
# Workflow will fail when an alert happens
fail-on-alert: true
# GitHub API token to make a commit comment
github-token: ${{ secrets.GITHUB_TOKEN }}
alert-threshold: "110%"
comment-on-alert: true
alert-comment-cc-users: '@arctic-hen7' # We need this kind of quoting, `@` is special in YAML
# What benchmark tool the output.txt came from
tool: "customSmallerIsBetter"
# Where the output from the benchmark tool is stored
output-file-path: output.txt
# Where the previous data file is stored
external-data-json-path: ./cache/benchmark-data.json
# Workflow will fail when an alert happens
fail-on-alert: true
# GitHub API token to make a commit comment
github-token: ${{ secrets.GITHUB_TOKEN }}
alert-threshold: "110%"
comment-on-alert: true
alert-comment-cc-users: "@arctic-hen7" # We need this kind of quoting, `@` is special in YAML
44 changes: 22 additions & 22 deletions .github/workflows/ci.yml
Copy link
Member

Choose a reason for hiding this comment

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

Why have you disabled pull request CI runs? It's important to have these so we can make sure PRs work in the codebase.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did that from the repo I forked not the push committed in order to properly identify the bug. once done, I will submit the pull request.

Copy link
Member

Choose a reason for hiding this comment

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

Ah okay, it's just that CI runs on pull requests have been disabled in the commits here. Once that's fixed I'm happy to merge this.

Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- uses: actions/cache@v3
id: cache
with:
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
# Only install the binaries if the cache doesn't have them
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
Expand All @@ -37,10 +37,10 @@ jobs:
- uses: actions/cache@v3
id: cache
with:
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
# Only install the binaries if the cache doesn't have them
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
Expand All @@ -57,10 +57,10 @@ jobs:
- uses: actions/cache@v3
id: cache
with:
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
# Only install the binaries if the cache doesn't have them
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -126,10 +126,10 @@ jobs:
- uses: actions/cache@v3
id: cache
with:
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
path: |
~/.cargo/bin/
# The cache should be OS-specific
key: ${{ runner.os }}-cargo-bins
# Only install the binaries if the cache doesn't have them
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
Expand All @@ -138,12 +138,12 @@ jobs:
# Also cache all the other Cargo files, since plenty of CI runs won't involve different dependencies
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}

# # Also cache the apt packages we need for testing
# - uses: awalsh128/cache-apt-pkgs-action@latest
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Cargo.lock
pkg/
.tribble/

.idea/
target_engine/
target_wasm/
dist/
8 changes: 8 additions & 0 deletions .idea/.gitignore

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

7 changes: 5 additions & 2 deletions examples/core/preload/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
perseus = { path = "../../../packages/perseus", features = [ "hydrate", "translator-fluent" ] }
perseus = { path = "../../../packages/perseus", features = [
"hydrate",
"translator-fluent",
] }
sycamore = "^0.8.1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
Expand All @@ -15,7 +18,7 @@ serde_json = "1"
fantoccini = "0.19"

[target.'cfg(engine)'.dependencies]
tokio = { version = "1", features = [ "macros", "rt", "rt-multi-thread" ] }
tokio = { version = "1", features = ["macros", "rt", "rt-multi-thread"] }
## **WARNING!** Before running this example outside the Perseus repo, replace the below line with
## the one commented out below it (changing the path dependency to the version you want to use)
perseus-axum = { package = "perseus-integration", path = "../../../packages/perseus-integration", default-features = false }
Expand Down
27 changes: 14 additions & 13 deletions packages/perseus-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ repository = "https://github.com/framesurge/perseus"
homepage = "https://framesurge.sh/perseus"
readme = "./README.md"
keywords = ["wasm", "cli", "webdev", "ssg", "ssr"]
categories = ["wasm", "development-tools", "asynchronous", "gui", "command-line-utilities"]
include = [
"src/",
"Cargo.toml",
".perseus/",
"README.proj.md"
categories = [
"wasm",
"development-tools",
"asynchronous",
"gui",
"command-line-utilities",
]
include = ["src/", "Cargo.toml", ".perseus/", "README.proj.md"]

autotests = false

Expand All @@ -36,24 +37,24 @@ indicatif = "0.17"
console = "0.15"
serde = "1"
serde_json = "1"
clap = { version = "4.2", features = [ "color", "derive" ] }
clap = { version = "4.2", features = ["color", "derive"] }
fs_extra = "1"
tokio = { version = "1", features = [ "macros", "rt-multi-thread", "sync" ] }
tokio = { version = "1", features = ["macros", "rt-multi-thread", "sync"] }
warp = "0.3"
command-group = "2"
ctrlc = { version = "3.2", features = ["termination"] }
notify = "6"
futures = "0.3"
tokio-stream = "0.1"
reqwest = { version = "0.11", features = [ "json", "stream" ] }
reqwest = { version = "0.11", features = ["json", "stream"] }
tar = "0.4"
flate2 = "1"
directories = "5"
cargo_metadata = "0.15"
cargo-lock = "8"
minify-js = "=0.4.3" # Be careful changing this, and test extensively!
cargo-lock = "10"
minify-js = "=0.4.3" # Be careful changing this, and test extensively!
walkdir = "2"
openssl = { version = "0.10.52", optional = true}
openssl = { version = "0.10.52", optional = true }
brotlic = "0.8"

[dev-dependencies]
Expand All @@ -71,4 +72,4 @@ path = "src/bin/main.rs"

[features]
# `reqwest` uses the system-native transport layer by default, this is necessary in some environments
vendored-openssl = [ "openssl/vendored" ]
vendored-openssl = ["openssl/vendored"]
6 changes: 5 additions & 1 deletion packages/perseus-cli/src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,11 @@ fn minify_js(from: &Path, to: &Path) -> Result<(), DeployError> {
// Guaranteed to be UTF-8 output
&mut minified,
)
.map_err(|err| DeployError::MinifyError { source: err })?;
// This is the updated line
.map_err(|err| DeployError::MinifyError {
source: Box::new(std::io::Error::other(err.to_string())),
})?;

let minified =
String::from_utf8(minified).map_err(|err| DeployError::MinifyNotUtf8 { source: err })?;
fs::write(to, minified).map_err(|err| DeployError::WriteMinifiedJsFailed { source: err })?;
Expand Down
5 changes: 4 additions & 1 deletion packages/perseus-cli/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,14 @@ pub enum DeployError {
#[source]
source: std::io::Error,
},

#[error("failed to minify javascript bundle (this is probably an upstream bug, re-try with `--no-minify-js`)")]
MinifyError {
#[source]
source: minify_js::MinifyError,
source: Box<dyn std::error::Error + Send + Sync>,
// source: minify_js::Error,
},

#[error("minified js was not utf-8 (this is a bug, re-try with `--no-minify-js` for now)")]
MinifyNotUtf8 {
#[source]
Expand Down