diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e69de29..5ccfb0d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -0,0 +1,47 @@ + +name: CI +on: + pull_request: + branches: + - master + push: + branches: + - master + tags: '*' +jobs: + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia. + - 'nightly' + os: + - ubuntu-latest + arch: + - x64 + steps: + - name: Checkout + uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - uses: actions/cache@v1 + env: + cache-name: cache-artifacts + with: + path: ~/.julia/artifacts + key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} + restore-keys: | + ${{ runner.os }}-test-${{ env.cache-name }}- + ${{ runner.os }}-test- + ${{ runner.os }}- + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v1 + with: + file: lcov.info diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml new file mode 100644 index 0000000..ce8d353 --- /dev/null +++ b/.github/workflows/CompatHelper.yml @@ -0,0 +1,16 @@ +name: CompatHelper + +on: + schedule: + - cron: '00 00 * * *' + +jobs: + CompatHelper: + runs-on: ubuntu-latest + steps: + - name: Pkg.add("CompatHelper") + run: julia -e 'using Pkg; Pkg.add("CompatHelper")' + - name: CompatHelper.main() + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: julia -e 'using CompatHelper; CompatHelper.main()' diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml new file mode 100644 index 0000000..f49313b --- /dev/null +++ b/.github/workflows/TagBot.yml @@ -0,0 +1,15 @@ +name: TagBot +on: + issue_comment: + types: + - created + workflow_dispatch: +jobs: + TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' + runs-on: ubuntu-latest + steps: + - uses: JuliaRegistries/TagBot@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + ssh: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.github/workflows/auto_close_all_issues.yml b/.github/workflows/auto_close_all_issues.yml new file mode 100644 index 0000000..7f1afd6 --- /dev/null +++ b/.github/workflows/auto_close_all_issues.yml @@ -0,0 +1,16 @@ +name: Auto-Close All Issues +on: + issues: + issue_comment: +jobs: + auto_close_all_issues: + if: ${{ !github.event.issue.pull_request }} + runs-on: ubuntu-latest + steps: + - if: github.actor != 'JuliaTagBot' + uses: peter-evans/close-issue@v1 + with: + comment: | + We do not accept issues on the MakieTeX.jl repository. + Please open your issue on the Makie.jl repository instead: + https://github.com/JuliaPlots/Makie.jl/issues diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index c4eae57..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,22 +0,0 @@ -Julia 1.3: - image: julia:1.3 - script: julia --project='@.' -e 'using Pkg; Pkg.build(); Pkg.test(; coverage=true)' - coverage: /Test Coverage (\d+\.\d+%)/ - after_script: - - julia -e 'using Printf; using Pkg; Pkg.add("Coverage"); using Coverage; c, t = get_summary(process_folder()); @printf "Test Coverage %.2f%%\n" 100c/t' -pages: - image: julia:1.3 - stage: deploy - script: - - julia --project=docs -e ' - using Pkg; - Pkg.develop(PackageSpec(path=pwd())); - Pkg.instantiate(); - include("docs/make.jl");' - - mkdir -p public - - mv docs/build public/dev - artifacts: - paths: - - public - only: - - master diff --git a/src/MakieTeX.jl b/src/MakieTeX.jl index b74a695..16a4bb3 100644 --- a/src/MakieTeX.jl +++ b/src/MakieTeX.jl @@ -15,4 +15,5 @@ export TeXDocument, CachedTeX export dvi2svg, latex2dvi, rsvg2recordsurf, svg2rsvg export teximg, teximg!, TeXImg export LTeX + end # document diff --git a/src/rendering.jl b/src/rendering.jl index 00fdd2d..e29afa5 100644 --- a/src/rendering.jl +++ b/src/rendering.jl @@ -1,4 +1,11 @@ -const DVISVGM_PATH = Ref(readchomp(`which dvisvgm`)) +const DVISVGM_PATH = Ref{String}() + +function dvisvg() + if !isassigned(DVISVGM_PATH) + DVISVGM_PATH[] = readchomp(`which dvisvgm`) + end + return DVISVGM_PATH[] +end function compile_latex( document::AbstractString; @@ -42,7 +49,7 @@ function dvi2svg( # dvisvgm a DVI file from stdin, and receive a SVG string from # stdout. This greatly simplifies the pipeline, and anyone with # a working TeX installation should have these utilities available. - dvisvgm = open(`$(DVISVGM_PATH[]) --bbox=$bbox $options --no-fonts --stdin --stdout`, "r+") + dvisvgm = open(`$(dvisvg()) --bbox=$bbox $options --no-fonts --stdin --stdout`, "r+") write(dvisvgm, dvi) @@ -112,7 +119,7 @@ function rsvg2img(handle::Rsvg.RsvgHandle, dpi = 72.0) # Then, it's possible to store the image in a native Julia array, # which simplifies the process of rendering. d = Rsvg.handle_get_dimensions(handle) - + # Cairo does not draw "empty" pixels, so we need to fill here w, h = d.width, d.height img = fill(Colors.ARGB32(1,1,1,0), w, h)