[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: Make GH Actions less reliant on TL mirror availability (945edf64)
Marcel Fabian Krüger
tex at 2krueger.de
Tue Feb 28 03:19:22 CET 2023
Repository : https://github.com/latex3/latex2e
On branch : develop
Link : https://github.com/latex3/latex2e/commit/945edf64b8eb05bb4eea37cdc458e9348dbb26a7
>---------------------------------------------------------------
commit 945edf64b8eb05bb4eea37cdc458e9348dbb26a7
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Mon Feb 27 20:10:31 2023 +0100
Make GH Actions less reliant on TL mirror availability
>---------------------------------------------------------------
945edf64b8eb05bb4eea37cdc458e9348dbb26a7
.github/workflows/main.yaml | 29 +++++++++++++++++++----
.github/workflows/trigger.yaml | 54 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 78 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index 71fa5114..8c1c03b2 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -13,6 +13,23 @@ on:
# requests get tested even if their branch comes from a fork.
jobs:
+ # Update the TeX Live tree if necessary
+ texlive-cache:
+ runs-on: ubuntu-20.04
+ name: Update TeX Live
+ outputs:
+ cache_key: ${{ steps.texlive.outputs.cache_key }}
+ steps:
+ # Boilerplate
+ - name: Checkout repository
+ uses: actions/checkout at v3
+ - name: Install TeX Live
+ id: texlive
+ uses: zauguin/install-texlive at v3
+ with:
+ # List the required TeX Live packages in a separate file to allow reuse in
+ # different workflows.
+ package_file: .github/tl_packages
# The l3build job contains the actual work. We misuse the matrix mechanism to
# create three jobs which only differ in minimal elements.
# For tags we do not run this since we run the release job instead.
@@ -72,18 +89,20 @@ jobs:
l3build_cmd: cd required && l3build doc -q -H --show-log-on-error
artifact_name: Documentation
name: ${{ matrix.name }}
+ needs: texlive-cache
steps:
# Boilerplate
- name: Checkout repository
uses: actions/checkout at v3
# We need Ghostscript for dvips and XeTeX tests.
- run: sudo apt-get update && sudo apt-get install ghostscript
- - name: Install TeX Live
- uses: zauguin/install-texlive at v2
+ - name: Restore TeX Live from cache
+ uses: actions/cache/restore at v3
with:
- # List the required TeX Live packages in a separate file to allow reuse in
- # different workflows.
- package_file: .github/tl_packages
+ path: ~/texlive
+ key: ${{ needs.texlive-cache.outputs.cache_key }}
+ fail-on-cache-miss: true
+ - run: echo $HOME/texlive/bin/x86_64-linux >> $GITHUB_PATH
- name: Run l3build
run: ${{ matrix.l3build_cmd }}
# Now we create the artifacts: There are two cases where this happens.
diff --git a/.github/workflows/trigger.yaml b/.github/workflows/trigger.yaml
new file mode 100644
index 00000000..f7871a4c
--- /dev/null
+++ b/.github/workflows/trigger.yaml
@@ -0,0 +1,54 @@
+name: Manually refresh caches
+
+on:
+ workflow_dispatch:
+ inputs:
+ repository:
+ description: 'Repository URL'
+ required: false
+ type: string
+ delete-old:
+ default: false
+ description: 'Delete all caches'
+ required: false
+ type: boolean
+
+jobs:
+ rebuild-cache:
+ runs-on: ubuntu-latest
+ permissions:
+ actions: write
+ contents: read
+ steps:
+ - name: Check out code
+ uses: actions/checkout at v3
+
+ - name: Clean old caches
+ run: |
+ gh extension install actions/gh-actions-cache
+
+ REPO="${{ github.repository }}"
+ BRANCH="${{ github.ref }}"
+ HASH_KEY="texlive-0-${{ hashFiles('.github/tl_packages') }}-"
+ DATE="$(date -I)"
+
+ if ! ${{ inputs.delete-old }}
+ then
+ HASH_KEY="$HASH_KEY$DATE"
+ fi
+ set +e
+ gh actions-cache list -R "$REPO" -B "$BRANCH" --key "$HASH_KEY" | cut -f 1 | while read -r cacheKey
+ do
+ gh actions-cache delete "$cacheKey" -R "$REPO" -B "$BRANCH" --confirm
+ done
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Install TeX Live
+ id: texlive
+ uses: zauguin/install-texlive at v3
+ with:
+ # List the required TeX Live packages in a separate file to allow reuse in
+ # different workflows.
+ accept-stale: false
+ repository: ${{ inputs.repository }}
+ package_file: .github/tl_packages
More information about the latex3-commits
mailing list.