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

Frontend test: instantiate and precompile before #2862

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
25 changes: 24 additions & 1 deletion .github/workflows/FrontendTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,30 @@ jobs:

- name: Install Pluto.jl packages
run: |
julia --project=$GITHUB_WORKSPACE -e "using Pkg; Pkg.instantiate()"
julia --project=$GITHUB_WORKSPACE -e '
using Pkg
Pkg.instantiate()

# run all the notebooks once to get the package environments ready
import Pluto
nbs = readdir(joinpath("test", "frontend", "fixtures"); join=true)

for n in nbs
try
@info "running" n
try
Pluto.activate_notebook_environment(n; show_help=false)
catch
Pkg.activate()
end
Pkg.instantiate()
Pkg.precompile()
include(n)
Pkg.instantiate()
Pkg.precompile()
catch
end
end'

- uses: actions/setup-node@v3
with:
Expand Down
51 changes: 26 additions & 25 deletions src/packages/PkgUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function update_notebook_environment(path::String; kwargs...)
end


function activate_notebook_environment(path::String)
function activate_notebook_environment(path::String; show_help::Bool=true)
notebook_ref = Ref(load_notebook(path))

ensure_has_nbpkg(notebook_ref[])
Expand Down Expand Up @@ -199,30 +199,31 @@ function activate_notebook_environment(path::String)
# end
# end

println()
"""

> Notebook environment activated!

## Step 1.
_Press `]` to open the Pkg REPL._

The notebook environment is currently active.

## Step 2.
The notebook file and your REPL environment are now synced. This means that:
1. Any changes you make in the REPL environment will be written to the notebook file. For example, you can `pkg> update` or `pkg> add SomePackage`, and the notebook file will update.
2. Whenever the notebook file changes, the REPL environment will be updated from the notebook file.

## Step 3.
When you are done, you can exit the notebook environment by deactivating it:

```
pkg> activate
```
""" |> Markdown.parse |> display
println()

if show_help
println()
"""

> Notebook environment activated!

## Step 1.
_Press `]` to open the Pkg REPL._

The notebook environment is currently active.

## Step 2.
The notebook file and your REPL environment are now synced. This means that:
1. Any changes you make in the REPL environment will be written to the notebook file. For example, you can `pkg> update` or `pkg> add SomePackage`, and the notebook file will update.
2. Whenever the notebook file changes, the REPL environment will be updated from the notebook file.

## Step 3.
When you are done, you can exit the notebook environment by deactivating it:

```
pkg> activate
```
""" |> Markdown.parse |> display
println()
end

end

Expand Down
Loading