Skip to content

Commit

Permalink
Merge pull request #2 from feelpp/1-add-latex-workflow
Browse files Browse the repository at this point in the history
add latex workflow
  • Loading branch information
prudhomm authored Aug 13, 2024
2 parents 2973ec6 + 61d8136 commit d322a1c
Show file tree
Hide file tree
Showing 29 changed files with 326 additions and 15 deletions.
105 changes: 105 additions & 0 deletions .github/workflows/latex.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Compile Latex and Release PDF

on:
push:
tags:
- 'v*'
branches:
- '*'

jobs:
build_latex:
runs-on: ubuntu-latest
outputs:
prefix: ${{ steps.repo_name.outputs.prefix }}
prefixwithref: ${{ steps.repo_name.outputs.prefixwithref }}
pdf: ${{ steps.repo_name.outputs.pdf }}
tex: ${{ steps.repo_name.outputs.tex }}
env:
VERSION: ${{ github.ref_name }}
steps:
- name: Set up Git repository
uses: actions/checkout@v4

- name: Get Repository Name
id: repo_name
run: |
prefix=$(echo "${{ github.repository }}" | cut -d'/' -f2)
echo "prefix=$prefix" >> "$GITHUB_OUTPUT"
prefixwithref=$(echo "$prefix")-${{ github.ref_name }}
echo "prefixwithref=$prefixwithref" >> "$GITHUB_OUTPUT"
echo "pdf=$prefixwithref.pdf" >> "$GITHUB_OUTPUT"
echo "tex=$prefix.tex" >> "$GITHUB_OUTPUT"
- name: Install hooks
run: |
sh ./setup-hooks.sh
git checkout ${{ github.ref }} # checkout the branch or tag to update gitinfo2
- name: Compile LaTeX document
uses: xu-cheng/latex-action@v3
with:
root_file: ${{ steps.repo_name.outputs.tex }}
args: -pdf -file-line-error -halt-on-error -interaction=nonstopmode -nobibtex
latexmk_shell_escape: true
post_compile: "latexmk -c; rm -rf _minted*"

- name: Rename PDF
run: mv ${{ steps.repo_name.outputs.prefix }}.pdf ${{ steps.repo_name.outputs.pdf }}

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.repo_name.outputs.prefixwithref }}
path: |
./*.tex
./*.bib
./*.gin
./*.bbl
./readme.*
./img-*
!./.git*
!./.github*
!./.vscode*
!./.idea*
!./.DS_Store*
!./.gitignore*
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: ${{ steps.repo_name.outputs.prefixwithref }}
path: ${{ github.workspace }}/artifact
- name: List Artifact
run: ls -R ${{ github.workspace }}

- name: Archive Article
run: |
temp_dir=$(mktemp -d)
tar -czvf "${temp_dir}/${{ steps.repo_name.outputs.prefixwithref }}.tar.gz" -C artifact ./
mv "${temp_dir}/${{ steps.repo_name.outputs.prefixwithref }}.tar.gz" ./
rm -rf "$temp_dir"
- name: Check compilation of LaTeX document from artifact
uses: xu-cheng/latex-action@v3
with:
root_file: ${{ steps.repo_name.outputs.tex }}
args: -pdf -file-line-error -halt-on-error -interaction=nonstopmode -nobibtex
latexmk_shell_escape: true
post_compile: "latexmk -c; rm -rf _minted*"
work_in_root_file_dir: ${{ github.workspace }}/artifact

- name: Create Release
id: create_release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
draft: false
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') || contains(github.ref, 'preview') }}
name: Release ${{ github.ref_name }}
generate_release_notes: true
tag_name: ${{ github.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
files: |
${{ steps.repo_name.outputs.pdf }}
${{ steps.repo_name.outputs.prefixwithref }}.tar.gz
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
_minted*/*

*bbl
*.pdf
*.aux
*.log
*.run.xml
*.bcf
*.out
*.bcf
*.blg
*.toc
*.pyg
*.tdo
*.synctex*
*.synctex.gz
*.fdb_latexmk
*.fls
*.idx
*.ilg
*.ind
45 changes: 45 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"latex-workshop.latex.recipes": [
{
"name": "latexmk-pdf",
"tools": [
"latexmk-shell-escape"
]
},
{
"name": "pdflatex-shell-escape-recipe",
"tools": [
"pdflatex-shell-escape"
]
}
],
"latex-workshop.latex.tools": [
{
"name": "latexmk-shell-escape",
"command": "latexmk",
"args": [
"--shell-escape",
"-pdf",
"-interaction=nonstopmode",
"-synctex=1",
"%DOC%"
],
"env": {}
},
{
"name": "pdflatex-shell-escape",
"command": "pdflatex",
"args": [
"--shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
}
],
"latex-workshop.latex.autoBuild.run": "onFileChange",
"latex-workshop.latex.autoBuild.enabled": true,
"latex-workshop.latex.build.showOutput": "always",
"latex-workshop.latex.outDir": "%DIR%"
}
39 changes: 24 additions & 15 deletions mainReviewed.tex → ...le.swimmer-framework-contact.springer.tex
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,20 @@
\usepackage{tikz}
% \usepackage[authoryear,sort]{natbib}
% \usepackage[natbib=true]{biblatex}
\usepackage[colorlinks,citecolor=blue]{hyperref}
\IfFileExists{.git/gitHeadInfo.gin}{
\usepackage[pcount,grumpy,mark,markifdirty]{gitinfo2}
}{%
\usepackage[local,pcount,grumpy,mark,markifdirty]{gitinfo2}
}

% Feel++ macro
\usepackage{xspace}
\newcommand{\feelpp}{Feel\nolinebreak\hspace{-.05em}\raisebox{.4ex}{\tiny\bf +}\nolinebreak\hspace{-.10em}\raisebox{.4ex}{\tiny\bf +}\xspace}

\newcommand{\review}[1]{\textcolor{blue}{#1}}

% see the list of further useful packages
\newcommand{\feelpp}{\texttt{Feel++}}
\newcommand{\Fluid}{\mathcal{F}} % fluid domain
\newcommand{\Real}{\mathbb{R}} % real number space
\newcommand{\Alemap}{\mathcal{A}} % Ale map
Expand Down Expand Up @@ -882,10 +891,10 @@ \subsection{Flagellated swimmer: 3D sperm cell}

\begin{figure}
\centering
\includegraphics[width=0.45\linewidth]{Figures/3d_sperm_planar/3dswimmer_00.png}
\includegraphics[width=0.45\linewidth]{Figures/3d_sperm_planar/3dswimmer_0dot5.png}
\includegraphics[width=0.45\linewidth]{Figures/3d_sperm_planar/3dswimmer_1dot85.png}
\includegraphics[width=0.45\linewidth]{Figures/3d_sperm_planar/3dswimmer_2dot65.png}
\includegraphics[width=0.45\linewidth]{img-3d_sperm_planar-3dswimmer_00.png}
\includegraphics[width=0.45\linewidth]{img-3d_sperm_planar-3dswimmer_0dot5.png}
\includegraphics[width=0.45\linewidth]{img-3d_sperm_planar-3dswimmer_1dot85.png}
\includegraphics[width=0.45\linewidth]{img-3d_sperm_planar-3dswimmer_2dot65.png}
\caption{Three dimensional simulation of a swimming sperm cell propagating planar waves on its flagellum. Flagellar beating is restricted to $xy$ plane, and the maximal amplitude of the wave is $A_{max}=\SI{4}{\micro\meter}$. The four images show the position and shape of the sperm cell at the time instants $t=\SI{0}{\second}$, $t=\SI{0.5}{\second}$, $t=\SI{1.85}{\second}$ and $t=\SI{2.65}{\second}$. }
\label{Fig:3dsperm_planar}
\end{figure}
Expand All @@ -901,7 +910,7 @@ \subsection{Multi-body swimmer: the three-sphere swimmer}

\begin{figure}
\centering
\includegraphics[scale=0.55]{Figures/three-sphere/3ss.png}
\includegraphics[scale=0.55]{img-three-sphere-3ss.png}

\caption{Representation of the three-sphere swimmer and its swimming gait. The gait is composed of four strokes in which one of the rods is alternatively retracted or elongated.}
\label{Fig:3ss1}
Expand All @@ -918,16 +927,16 @@ \subsection{Multi-body swimmer: the three-sphere swimmer}

\begin{figure}[h!]
\centering
\centerline{\includegraphics[scale=0.5]{Figures/three-sphere/sw_motion2_tmp.png}}
\centerline{\includegraphics[scale=0.5]{img-three-sphere-sw_motion2_tmp.png}}
\caption{Behavior of a three-sphere swimmer swimming towards the boundary of
the computational domain. The swimmer reorients due to contact forces and hydrodynamic interactions with the plane wall.}
\label{fig:3ss}
\end{figure}

\begin{figure}[h!]
\centering
\includegraphics[scale=0.175]{Figures/three-sphere/Horizontal.png}
\includegraphics[scale=0.175]{Figures/three-sphere/vertical.png}
\includegraphics[scale=0.175]{img-three-sphere-Horizontal.png}
\includegraphics[scale=0.175]{img-three-sphere-vertical.png}
\caption{Examples of vertical and horizontal displacements of three-sphere swimmers. The orange continuous lines corresponds to the $x$ and $y$ trajectories of a swimmer heading towards the boundary of the domain and reorienting after the contact with the wall. The blue dotted line describe the trajectories of a swimmer swimming far from the wall and parallel to it.}
\label{fig:3ss_2}
\end{figure}
Expand All @@ -947,12 +956,12 @@ \subsection{Rigid bodies with tangential velocities: squirmers}
\begin{figure}
\centering

\includegraphics[scale=0.2]{Figures/squirmer/squirmers.png}
\includegraphics[scale=0.2]{img-squirmer-squirmers.png}

\includegraphics[scale=0.14]{Figures/squirmer/t=0.1.png}
\includegraphics[scale=0.14]{Figures/squirmer/t=2.5.png}
\includegraphics[scale=0.14]{Figures/squirmer/t=3.5.png}
\includegraphics[scale=0.14]{Figures/squirmer/t=8_.png}
\includegraphics[scale=0.14]{img-squirmer-t=0.1.png}
\includegraphics[scale=0.14]{img-squirmer-t=2.5.png}
\includegraphics[scale=0.14]{img-squirmer-t=3.5.png}
\includegraphics[scale=0.14]{img-squirmer-t=8_.png}

\caption{In the top figure: trajectories of two interacting squirmers. Starting from the same initial configuration, the positions of two neutral squirmers (black lines) and pullers (red lines) are shown as they swim towards one another. \review{The dotted lines show the trajectory of the upper squirmers and the smooth lines the one of the lower squirmers. The two arrows correspond to their initial orientation.} Depending on the propulsion type, the trajectories show different behaviours.
In the bottom figures: positions of the squirmers and magnitude of the fluid velocity are shown at different time instants of the interaction.}
Expand Down Expand Up @@ -985,7 +994,7 @@ \subsection{Motion of a collection of solids: inside the zebrafish arteries}

\begin{figure}
\centering
\includegraphics[width=0.85\linewidth]{Figures/zf/zf.png}
\includegraphics[width=0.85\linewidth]{img-zf-zf.png}

\caption{Moving solid bodies in a complex two-dimensional geometry. Due to collision forces and torques, the bodies start to rotate and take different trajectories to cross the zebrafish.}
\label{Fig:insertion2D}
Expand Down
17 changes: 17 additions & 0 deletions gitHeadLocal.gin
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
\usepackage[%
shash={9c59d39},
lhash={9c59d391286daf9a71856c57b10f0f4b4e1d418b},
authname={Christophe Prud'homme},
authemail={[email protected]},
authsdate={2024-08-13},
authidate={2024-08-13 10:10:21 +0200},
authudate={1723536621},
commname={Christophe Prud'homme},
commemail={[email protected]},
commsdate={2024-08-13},
commidate={2024-08-13 10:10:21 +0200},
commudate={1723536621},
refnames={ (HEAD -> 1-add-latex-workflow, tag: v0.0.1, origin/1-add-latex-workflow)},
firsttagdescribe={v0.0.1},
reltag={v0.0.1-0-g9c59d39}
]{gitexinfo}
33 changes: 33 additions & 0 deletions hooks/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
# Copyright 2015 Brent Longborough
# Part of gitinfo2 package Version 2
# Release 2.0.7 2015-11-22
# Please read gitinfo2.pdf for licencing and other details
# -----------------------------------------------------
# Post-{commit,checkout,merge} hook for the gitinfo2 package
#
# Get the first tag found in the history from the current HEAD
FIRSTTAG=$(git describe --tags --always --dirty='-*' 2>/dev/null)
# Get the first tag in history that looks like a Release
RELTAG=$(git describe --tags --long --always --dirty='-*' --match 'v[0-9]*\.[0-9]*\.[0-9]*' 2>/dev/null)
# Hoover up the metadata
git --no-pager log -1 --date=short --decorate=short \
--pretty=format:"\usepackage[%
shash={%h},
lhash={%H},
authname={%an},
authemail={%ae},
authsdate={%ad},
authidate={%ai},
authudate={%at},
commname={%cn},
commemail={%ce},
commsdate={%cd},
commidate={%ci},
commudate={%ct},
refnames={%d},
firsttagdescribe={$FIRSTTAG},
reltag={$RELTAG}
]{gitexinfo}" HEAD > .git/gitHeadInfo.gin


File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
74 changes: 74 additions & 0 deletions release
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash

# Exit immediately if a command exits with a non-zero status
set -e

# Function to create a release
create_release() {
VERSION=$1

if [ -z "$VERSION" ]; then
echo "Usage: $0 create vx.y.z"
exit 1
fi

# Tag the repository with the provided version
git tag -a "$VERSION" -m "Release $VERSION"

# Checkout the tag to trigger post-commit hook to update gitinfo2 info file
git checkout

# show the reltag line of .git/gitHeadInfo.gin
grep reltag .git/gitHeadInfo.gin

cp .git/gitHeadInfo.gin gitHeadLocal.gin

git add gitHeadLocal.gin
git commit -m "Updated gitHeadLocal.gin for release $VERSION"
git tag -f -a "$VERSION" -m "Release $VERSION"

# Push the changes and the tags
git push origin --follow-tags

echo "Release $VERSION created and pushed successfully."
}

# Function to list releases
list_releases() {
git tag
}

# Function to delete a release
delete_release() {
VERSION=$1

if [ -z "$VERSION" ]; then
echo "Usage: $0 delete vx.y.z"
exit 1
fi

# Delete the tag locally
git tag -d "$VERSION"

# Delete the tag remotely
#git push origin --delete "$VERSION"

echo "Release $VERSION deleted successfully."
}

# Main script logic
case "$1" in
create)
create_release "$2"
;;
list)
list_releases
;;
delete)
delete_release "$2"
;;
*)
echo "Usage: $0 {create|list|delete} [version]"
exit 1
;;
esac
Loading

0 comments on commit d322a1c

Please sign in to comment.