[pre-commit.ci] pre-commit autoupdate #330
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
name: Build and Test | |
on: | |
push: | |
pull_request: | |
release: | |
types: | |
- published | |
- edited | |
schedule: | |
- cron: '15 1 * * 6' | |
jobs: | |
build-test-push: | |
runs-on: ubuntu-latest | |
env: | |
DOCKERHUB_USERNAME: gokhlayeh # used in non trustworthy section of the job | |
buildx_platforms: linux/amd64 | |
steps: | |
# preparation | |
# | |
- name: Remove unused packages from disk | |
run: | | |
sudo rm -rf /usr/local/lib/android | |
sudo rm -rf /usr/share/dotnet | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# | |
# build unstable image used for test suite | |
# | |
- name: Build testing image | |
uses: docker/build-push-action@v5 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
context: ./docker | |
file: ./docker/Dockerfile | |
load: true | |
push: false | |
tags: ${{ env.DOCKERHUB_USERNAME }}/latex:testing | |
# | |
# run test suite | |
# | |
- name: Compile EPS test document | |
run: docker run -v "$(pwd):/github/workspace" -w /github/workspace/test/eps ${{ env.DOCKERHUB_USERNAME }}/latex:testing latexmk -outdir=build -pdf -interaction=nonstopmode -file-line-error main.tex | |
- name: Compile FontAwesome5 test document | |
run: docker run -v "$(pwd):/github/workspace" -w /github/workspace/test/fontawesome5 ${{ env.DOCKERHUB_USERNAME }}/latex:testing latexmk -outdir=build -pdf -interaction=nonstopmode -file-line-error main.tex | |
- name: Symlink latexmkrc to root of workspace | |
run: ln -sf test/gnuplot/.latexmkrc | |
- name: Compile GNUPlot test document | |
run: docker run -v "$(pwd):/github/workspace" -w /github/workspace/test/gnuplot ${{ env.DOCKERHUB_USERNAME }}/latex:testing latexmk -outdir=build -pdf -interaction=nonstopmode -file-line-error main.tex | |
- name: Compile pdf2svg test document | |
run: docker run -v "$(pwd):/github/workspace" -w /github/workspace/test/pdf2svg ${{ env.DOCKERHUB_USERNAME }}/latex:testing latexmk -outdir=. -pdf -interaction=nonstopmode -file-line-error main.tex | |
- name: Compile PlantUML test document | |
run: docker run -v "$(pwd):/github/workspace" -w /github/workspace/test/plantuml ${{ env.DOCKERHUB_USERNAME }}/latex:testing latexmk -outdir=. -pdf -lualatex -interaction=nonstopmode -file-line-error main.tex | |
- name: Compile PythonTeX test document | |
run: docker run -v "$(pwd):/github/workspace" -w /github/workspace/test/pythontex ${{ env.DOCKERHUB_USERNAME }}/latex:testing latexmk -outdir=build -pdf -interaction=nonstopmode -file-line-error main.tex | |
- name: Compile SVG test document | |
run: docker run -v "$(pwd):/github/workspace" -w /github/workspace/test/svg ${{ env.DOCKERHUB_USERNAME }}/latex:testing latexmk -outdir=build -pdf -interaction=nonstopmode -file-line-error main.tex | |
# | |
# push image (if trusted commit) | |
# | |
- name: Login to DockerHub | |
if: ${{ github.event_name == 'release' || ((github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/master') }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push unstable | |
if: ${{ github.event_name == 'release' || ((github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/master') }} | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./docker | |
file: ./docker/Dockerfile | |
platforms: ${{ env.buildx_platforms }} | |
load: false | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/latex:unstable | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Determine release tag name | |
if: ${{ github.event_name == 'release' }} | |
id: vars | |
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10}) | |
- name: Build and push release | |
if: ${{ github.event_name == 'release' }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./docker | |
file: ./docker/Dockerfile | |
platforms: ${{ env.buildx_platforms }} | |
load: false | |
push: true | |
tags: | | |
${{ secrets.DOCKERHUB_USERNAME }}/latex:${{steps.vars.outputs.tag}}, | |
${{ secrets.DOCKERHUB_USERNAME }}/latex:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Update Docker Hub description | |
if: ${{ github.event_name == 'release' || (github.event_name == 'push' && github.ref == 'refs/heads/master') }} | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
readme-filepath: README.md | |
repository: ${{ secrets.DOCKERHUB_USERNAME }}/latex |