Skip to content

Fixed an issue where TeX output contained a figure even if the captio… #448

Fixed an issue where TeX output contained a figure even if the captio…

Fixed an issue where TeX output contained a figure even if the captio… #448

Workflow file for this run

name: CI
defaults:
run:
shell: bash
on:
push:
paths-ignore:
- '.github/workflows/gh-pages.yml'
- '.github/workflows/gh_pages_requirements.txt'
pull_request:
jobs:
build-and-test:
if: contains(toJson(github.event.commits), '[ci skip]') == false && contains(toJson(github.event.commits), '[skip ci]') == false
strategy:
fail-fast: false
matrix:
include:
- os: "windows-latest"
ghc-version: "9.8.2"
- os: "ubuntu-latest"
ghc-version: "9.8.2"
- os: "macos-latest"
ghc-version: "9.8.2"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install cabal/ghc
uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc-version }}
cabal-version: '3.10.3.0'
- name: Set PATH for cabal-installed executables
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
echo "$HOME\AppData\Roaming\cabal\bin" >> $GITHUB_PATH
else
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
fi
- name: Set Cabal options
# Overwriting prevent cabal from raising an error when installing
# an executable that is already present (because of caching)
run: |
cabal update
cabal freeze
cabal user-config update -f -a "overwrite-policy: always"
cabal user-config update -f -a "install-method: copy"
cabal user-config update -f -a "split-sections: True"
cabal user-config update -f -a "executable-stripping: True"
- name: Cache cabal work
uses: actions/cache@v4
with:
path: |
dist-newstyle
${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-${{ hashFiles('cabal.project.freeze') }}-cabal-install
- name: Build pandoc-plot
shell: bash
# Try building it twice in case of flakey builds on Windows
# See https://github.com/haskell/haskell-language-server
run: |
cabal build --enable-tests || \
cabal build --enable-tests -j1
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- uses: r-lib/actions/setup-r@v2
- uses: actions/cache@v4
name: Cache Python build artifacts
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/requirements.txt') }}
- name: Install Python toolkits
run: |
python -m pip install --upgrade pip
pip install numpy wheel
pip install -r .github/workflows/requirements.txt
- name: Set up MATLAB [Linux]
if: matrix.os == 'ubuntu-latest'
uses: matlab-actions/setup-matlab@v1
- name: Install GGPlot2
run: |
Rscript -e "install.packages('ggplot2', repos='http://cran.rstudio.com/')"
- name: Install Octave, Gnuplot, Graphviz, PlantUML, and Asymptote [Linux]
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get --quiet --yes install octave
sudo apt-get --quiet --yes install gnuplot
sudo apt-get --quiet --yes install graphviz
sudo apt-get --quiet --yes install asymptote
sudo apt-get --quiet --yes install plantuml
echo $(dot -version</dev/null)
echo $(asy --version)
echo $(asy --environment)
echo $(plantuml -version)
# The ubuntu package version is too old
sudo curl -L "http://sourceforge.net/projects/plantuml/files/plantuml.jar/download" -o "/usr/share/plantuml/plantuml.jar"
echo $(plantuml -version)
echo $PATH
- name: Install Graphviz, GNUplot, and PlantUML [Windows]
if: runner.os == 'Windows'
shell: pwsh
run: |
choco install --yes --no-progress graphviz
dot -c
choco install --yes --no-progress gnuplot
choco install --yes --no-progress asymptote
choco install --yes --no-progress plantuml
plantuml -h
- name: Install Octave, Gnuplot, Graphviz, and PlantUML [Mac]
if: runner.os == 'macOS'
run: |
brew update
brew install asymptote
brew install octave
brew install gnuplot
brew install graphviz
brew install plantuml
- name: Install Plots.jl toolkit [Linux]
# Integration tests sometimes hang on MacOS and Windows
if: matrix.os == 'ubuntu-latest'
shell: julia {0}
run: |
using Pkg
Pkg.add("Plots")
# The default GR backend is a bit flaky on Linux, but
# PyPlot doesn't work on MacOS
if ("${{ matrix.os }}" == "ubuntu-latest")
Pkg.add("PyPlot")
end
- name: Set default Plots.jl backend [Linux]
if: matrix.os == 'ubuntu-latest'
run: |
mkdir ~/.julia/config
echo 'ENV["PLOTS_DEFAULT_BACKEND"]="PyPlot"' >> ~/.julia/config/startup.jl
- name: Check installed plotting toolkits
run: |
cabal install exe:pandoc-plot
pandoc-plot toolkits
- name: Unit tests
run: |
cabal test
- name: Integration tests
# Integration tests sometimes hang on MacOS
if: matrix.os == 'ubuntu-latest'
run: |
cabal install pandoc-cli
cabal install exe:pandoc-plot
pandoc --filter pandoc-plot -i tests/integration.md -t html
if [ $(ls "plots" | wc -l) == 0 ]; then
exit 1
fi
pandoc-plot clean tests/integration.md
pandoc --filter pandoc-plot -i tests/issue16.md -t native
if [ $(ls "plots" | wc -l) == 0 ]; then
exit 1
fi
pandoc-plot clean tests/issue16.md
pandoc --filter pandoc-plot -i tests/issue30.md -t native
if [ $(ls "plots" | wc -l) != 2 ]; then
exit 1
fi
pandoc-plot clean tests/issue30.md
# The idea here is to install some random package (npstreams) to
# check whether the plots will be rendered in the appropriate
# environment
python -m venv ./issue46
./issue46/bin/python -m pip install npstreams matplotlib
pandoc --filter pandoc-plot -i tests/issue46.md -t native
if [ $(ls "plots" | wc -l) != 2 ]; then
exit 1
fi
pandoc-plot clean tests/issue46.md
pandoc --filter pandoc-plot -i tests/issue53.md -t native
if [ $(ls "plots" | wc -l) != 2 ]; then
exit 1
fi
pandoc-plot clean tests/issue53.md
pandoc --filter pandoc-plot -i tests/issue55.md -t native
if [ $(ls "plots" | wc -l) != 2 ]; then
exit 1
fi
pandoc-plot clean tests/issue55.md
- name: Build documentation
run: source tools/mkmanual.sh
- name: Build artifact
run: |
mkdir artifact
cabal install exe:pandoc-plot --installdir artifact
if [[ "${{ runner.os }}" != "Windows" ]]
then
chmod u+x artifact/pandoc-plot
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-artifact
path: artifact/pandoc-plot*
retention-days: 7
- name: Build artifact [Linux - static]
if: runner.os == 'Linux'
run: |
mkdir artifact-static
cabal install exe:pandoc-plot --enable-executable-static --installdir artifact-static
chmod u+x artifact-static/pandoc-plot
- name: Upload artifact [Linux - static]
uses: actions/upload-artifact@v4
if: runner.os == 'Linux'
with:
name: ${{ runner.os }}-artifact-static
path: artifact-static/pandoc-plot
retention-days: 7
- name: Build Installer [Windows]
if: runner.os == 'Windows'
shell: pwsh
run: |
cabal install --installdir ".\installer"
$version = .\installer\pandoc-plot.exe --version
iscc /dAppVersion=$version ".\installer\pandoc-plot-setup.iss"
- name: Upload artifact [Windows - installer]
uses: actions/upload-artifact@v4
if: runner.os == 'Windows'
with:
name: ${{ runner.os }}-artifact-installer
path: installer/pandoc-plot-wininst-x86_64.exe
retention-days: 7
release:
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Compress artifacts and move to assets
run: |
mkdir assets
zip -j assets/pandoc-plot-Windows-x86_64.zip Windows-artifact/pandoc-plot.exe
mv Windows-artifact-installer/*.exe assets
zip -j assets/pandoc-plot-Linux-x86_64.zip Linux-artifact/pandoc-plot
zip -j assets/pandoc-plot-Linux-x86_64-static.zip Linux-artifact-static/pandoc-plot
zip -j assets/pandoc-plot-macOS-x86_64.zip macOS-artifact/pandoc-plot
ls -a assets
- name: Create release description
run: |
python tools/release-description.py CHANGELOG.md > description.md
cat description.md
- name: Create release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: description.md
files: |
assets/*
# winget-release:
# needs: [release]
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/download-artifact@v4
# - name: Update Winget package
# shell: pwsh
# env:
# SUBMIT: ${{ startsWith(github.ref, 'refs/tags/') }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# $VERSION = .\Windows-artifact\pandoc-plot.exe --version
# iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
# .\wingetcreate.exe update `
# -i LaurentPRenedeCotret.pandoc-plot `
# --url https://github.com/LaurentRDC/pandoc-plot/releases/download/$VERSION/pandoc-plot-wininst-x86_64.exe `
# --version $VERSION `
# --token $GITHUB_TOKEN `
# --submit $SUBMIT