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

Use the same plotlyjs version number for all imports #480

Merged
Merged
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
5 changes: 1 addition & 4 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ jobs:
gen-artifacts:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# The plotly version. Bumping this environment variable should do the trick
env:
PLOTLY_VER: 2.3.0

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -33,7 +30,7 @@ jobs:
- name: "Get artifact"
run: |
cd $GITHUB_WORKSPACE
julia -e 'include(joinpath(pwd(),"deps","generate_artifacts.jl")); generate_artifacts("'"$PLOTLY_VER"'","'"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"'")'
julia -e 'include(joinpath(pwd(),"deps","generate_artifacts.jl")); generate_artifacts("'"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"'")'

- name: "Commit updated Artifacts.toml"
run: |
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ tags/
tags
site/
.ipynb_checkpoints/
assets/plotly-latest.min.js
deps/plotly-latest.min.js
assets/plotly-*.min.js
deps/plotly-*.min.js
deps/plotschema.json
deps/schema.html
deps/*.csv
Expand Down
4 changes: 3 additions & 1 deletion deps/generate_artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
using Pkg.Artifacts
using Downloads

function generate_artifacts(ver="latest", repo="https://github.com/JuliaPlots/PlotlyJS.jl")
ver = include("./plotly_cdn_version.jl")

function generate_artifacts(repo="https://github.com/JuliaPlots/PlotlyJS.jl")
artifacts_toml = joinpath(dirname(@__DIR__), "Artifacts.toml")

# if Artifacts.toml does not exist we also do not have to remove it
Expand Down
2 changes: 2 additions & 0 deletions deps/plotly_cdn_version.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# run the artifacts.yml Github Action after changing this file
"2.3.0"
3 changes: 2 additions & 1 deletion src/PlotlyJS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export plot, dataset, list_datasets, make_subplots, savefig, mgrid
# globals for this package
const _pkg_root = dirname(dirname(@__FILE__))
const _js_path = joinpath(artifact"plotly-artifacts", "plotly.min.js")
const _js_cdn_path = "https://cdn.plot.ly/plotly-latest.min.js"
const _js_version = include(joinpath(_pkg_root, "deps", "plotly_cdn_version.jl"))
const _js_cdn_path = "https://cdn.plot.ly/plotly-$(_js_version).min.js"
const _mathjax_cdn_path =
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_SVG"

Expand Down
2 changes: 1 addition & 1 deletion src/display.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function SyncPlot(

# setup scope
deps = [
"Plotly" => joinpath(artifact"plotly-artifacts", "plotly.min.js"),
"Plotly" => _js_path,
joinpath(@__DIR__, "..", "assets", "plotly_webio.bundle.js")
]
scope = Scope(imports=deps)
Expand Down
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ const M = PlotlyJS
# include("blink.jl")
include("kaleido.jl")

# these are public API
@test isfile(PlotlyJS._js_path)
@test !isempty(PlotlyJS._js_version)
@test !startswith(PlotlyJS._js_version, "v")

end
Loading