-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #237 from siefkenj/ci
Add CI
- Loading branch information
Showing
15 changed files
with
202 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Build Textbook | ||
|
||
on: | ||
push: | ||
branches: ["master", "main"] | ||
pull_request: | ||
branches: ["master", "main"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run makedist.sh in Docker container | ||
run: | | ||
cd ./ci | ||
./prepare-for-ci.sh | ||
docker compose up -d | ||
docker compose exec -T ibllinearalgebra ./makedist.sh | ||
docker compose down | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: textbook | ||
path: ci/dist/ | ||
|
||
- name: Verifies all PDFs were built | ||
run: | | ||
cd ./ci | ||
./verify-all-compiled.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
ci/book* | ||
*.aux | ||
*.fls | ||
*.idx | ||
*.ilg | ||
*.ind | ||
*.toc | ||
*.xdv | ||
*.log | ||
*.out | ||
draft | ||
testing | ||
html-conversion | ||
newdocumentclass | ||
*-bak | ||
node_modules | ||
slide-conversion |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Base image for LaTeX CI | ||
FROM ghcr.io/xu-cheng/texlive-small:latest | ||
WORKDIR /workdir | ||
|
||
# Install additional LaTeX packages | ||
RUN tlmgr update --self | ||
# tlmgr --force install textpos everypage enumitem ifthen tikz wrapfig marginnote mparhack marginfix indextools nicematrix fnpct systeme datatool pgfplots environ tcolorbox tikzfill pdfcol titlesec changepage pdfx datetime fmtcount lipsum mathdesign tikz-cd translations xstring ly1 hyperxmp ifmtarg luacode | ||
RUN tlmgr --force install \ | ||
textpos \ | ||
everypage \ | ||
enumitem \ | ||
wrapfig \ | ||
marginnote \ | ||
mparhack \ | ||
marginfix \ | ||
indextools \ | ||
nicematrix \ | ||
fnpct \ | ||
systeme \ | ||
datatool \ | ||
pgfplots \ | ||
environ \ | ||
tcolorbox \ | ||
tikzfill \ | ||
pdfcol \ | ||
titlesec \ | ||
changepage \ | ||
pdfx \ | ||
datetime \ | ||
fmtcount \ | ||
lipsum \ | ||
mathdesign \ | ||
tikz-cd \ | ||
translations \ | ||
xstring \ | ||
ly1 \ | ||
hyperxmp \ | ||
ifmtarg \ | ||
luacode | ||
|
||
# Set a custom prompt | ||
ENV PS1="\[\033[01;32m\]IBLLinearAlgebra\[\033[00m\]:\[\033[01;35m\]\w\[\033[00m\] $ " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Continuous Integration | ||
|
||
This folder contains files related to continuous integration (CI) for automatically building | ||
and rebuilding the textbook source when needed. | ||
|
||
### Building a new version of the Docker image | ||
|
||
```bash | ||
docker build . -t siefkenj/build-images:ibllinearalgebra | ||
``` | ||
|
||
### Run the docker image | ||
|
||
```bash | ||
docker run -v `pwd`:/workdir -w /workdir -it --rm siefkenj/build-images:ibllinearalgebra | ||
``` | ||
|
||
### Publish the docker image | ||
|
||
After `docker login`, run: | ||
|
||
```bash | ||
docker push siefkenj/build-images:ibllinearalgebra | ||
``` | ||
|
||
### Copying book source | ||
|
||
```bash | ||
rsync -rl --include='*/' --include='*.tex' --include='*.sty' --include='*.png' --include='*.jpg' --include='*.svg' --include="*.cls" --include="images/*" --exclude='*' ../book/ ./book-copy/ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: "3" | ||
services: | ||
ibllinearalgebra: | ||
image: siefkenj/build-images:ibllinearalgebra | ||
volumes: | ||
- ./book-copy:/workdir/book | ||
- ./dist:/workdir/dist | ||
- ../makedist.sh:/workdir/makedist.sh:ro | ||
working_dir: /workdir | ||
stdin_open: true | ||
tty: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#/bin/bash | ||
|
||
rm -rf book-copy | ||
|
||
# make a copy of all essential files | ||
rsync -rlv --include='*/' --include='*.tex' --include='*.sty' --include='*.png' --include='*.jpg' --include='*.svg' --include="*.cls" --include="images/*" --exclude='*' ../book/ ./book-copy/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
BUILD_DIR=./book-copy | ||
EXIT_CODE=0 | ||
|
||
for texfile in $BUILD_DIR/linearalgebra*.tex; do | ||
# Get the base name of the file (without path and extension) | ||
basefile=$(basename "$texfile" .tex) | ||
|
||
# Check if the corresponding PDF file exists | ||
if [[ ! -f "./dist/$basefile.pdf" ]]; then | ||
# If the PDF file does not exist, cat the corresponding log file | ||
if [[ -f "$BUILD_DIR/$basefile.log" ]]; then | ||
echo "" >&2 | ||
echo "" >&2 | ||
echo "THERE WAS AN ERROR WHEN BUILDING $basefile.pdf" >&2 | ||
echo "Log file for $basefile:" >&2 | ||
|
||
cat "$BUILD_DIR/$basefile.log" >&2 | ||
|
||
echo "" >&2 | ||
EXIT_CODE=1 | ||
else | ||
echo "Log file for $basefile does not exist." >&2 | ||
EXIT_CODE=1 | ||
fi | ||
fi | ||
done | ||
|
||
exit $EXIT_CODE |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.