2727 DF_ENCRYPTION_DETERMINISTIC_KEY : " anlmuJ6cB3bN3biXRbYvmPsC5ALPFqGG"
2828 DF_ENCRYPTION_KEY_DERIVATION_SALT : " hzPR8D4qpOnAg7VeAhkhWw6JmmzKJB10"
2929 DF_REDIS_SIDEKIQ_URL : " redis://redis:6379/0"
30+ LATEX_CONTAINER_NAME : doubtfire-texlive
31+ LATEX_BUILD_PATH : /texlive/shell/latex_build.sh
3032
3133jobs :
3234 unit-tests :
@@ -49,21 +51,53 @@ jobs:
4951 uses : actions/checkout@v4
5052 - name : Set up docker buildx
5153 uses : docker/setup-buildx-action@v3
54+ - name : Build TexLive image
55+ uses : docker/build-push-action@v5
56+ with :
57+ context : .
58+ file : texlive.Dockerfile
59+ push : false
60+ load : true
61+ tags : doubtfire-texlive-development:local
62+ cache-from : type=gha,scope=texlive
63+ cache-to : type=gha,mode=max,scope=texlive
5264 - name : Build base doubtfire-api development image
5365 uses : docker/build-push-action@v5
5466 with :
5567 context : .
5668 push : false
5769 load : true
5870 tags : doubtfire-api-development:local
59- cache-from : type=gha
60- cache-to : type=gha,mode=max
71+ cache-from : type=gha,scope=doubtfire-api
72+ cache-to : type=gha,mode=max,scope=doubtfire-api
73+ - name : Start TexLive service
74+ uses : addnab/docker-run-action@v3
75+ with :
76+ image : doubtfire-texlive-development:local
77+ options : >
78+ --name ${{ env.LATEX_CONTAINER_NAME }}
79+ -v ${{ github.workspace }}/student-work:/student-work
80+ -v ${{ github.workspace }}/public/assets/images:/doubtfire/public/assets/images
81+ -v ${{ github.workspace }}/test_files:/doubtfire/test_files
82+ -v ${{ github.workspace }}/tmp/rails-latex:/workdir/texlive-latex
83+ --detach
84+ run : sleep infinity
85+ - name : Test TexLive container
86+ uses : addnab/docker-run-action@v3
87+ with :
88+ image : doubtfire-api-development:local
89+ options : >
90+ -v ${{ github.workspace }}:/doubtfire
91+ -v /var/run/docker.sock:/var/run/docker.sock
92+ run : docker exec -t ${{ env.LATEX_CONTAINER_NAME }} lualatex -v
6193 - name : Populate database
6294 uses : addnab/docker-run-action@v3
6395 with :
6496 image : doubtfire-api-development:local
6597 options : >
6698 -v ${{ github.workspace }}:/doubtfire
99+ -v ${{ github.workspace }}/student-work:/student-work
100+ -v /var/run/docker.sock:/var/run/docker.sock
67101 -e RAILS_ENV
68102 -e DF_STUDENT_WORK_DIR
69103 -e DF_INSTITUTION_HOST
@@ -81,13 +115,17 @@ jobs:
81115 -e DF_ENCRYPTION_DETERMINISTIC_KEY
82116 -e DF_ENCRYPTION_KEY_DERIVATION_SALT
83117 -e DF_REDIS_SIDEKIQ_URL
118+ -e LATEX_CONTAINER_NAME
119+ -e LATEX_BUILD_PATH
84120 run : bundle exec rake db:populate
85121 - name : Run unit tests
86122 uses : addnab/docker-run-action@v3
87123 with :
88124 image : doubtfire-api-development:local
89125 options : >
90126 -v ${{ github.workspace }}:/doubtfire
127+ -v ${{ github.workspace }}/student-work:/student-work
128+ -v /var/run/docker.sock:/var/run/docker.sock
91129 -e RAILS_ENV
92130 -e DF_STUDENT_WORK_DIR
93131 -e DF_INSTITUTION_HOST
@@ -105,4 +143,8 @@ jobs:
105143 -e DF_ENCRYPTION_DETERMINISTIC_KEY
106144 -e DF_ENCRYPTION_KEY_DERIVATION_SALT
107145 -e DF_REDIS_SIDEKIQ_URL
146+ -e LATEX_CONTAINER_NAME
147+ -e LATEX_BUILD_PATH
108148 run : TERM=xterm bundle exec rails test
149+ - name : Stop TexLive service
150+ run : docker rm -f ${{ env.LATEX_CONTAINER_NAME }}
0 commit comments