[latex3-commits] [git/LaTeX3-latex3-latex3] main: Setup GitHub Actions (d303fc4ae)

Marcel Fabian Krüger tex at 2krueger.de
Thu Jul 29 20:00:30 CEST 2021


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/d303fc4ae567568bc4f56da9d1a3a83705f02ba1

>---------------------------------------------------------------

commit d303fc4ae567568bc4f56da9d1a3a83705f02ba1
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Thu Jul 29 20:00:30 2021 +0200

    Setup GitHub Actions


>---------------------------------------------------------------

d303fc4ae567568bc4f56da9d1a3a83705f02ba1
 .github/workflows/main.yaml | 188 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 188 insertions(+)

diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
new file mode 100644
index 000000000..0a4c15462
--- /dev/null
+++ b/.github/workflows/main.yaml
@@ -0,0 +1,188 @@
+name: Automated testing
+
+# Currently we run in two situations:
+on:
+  # Whenever someone pushes to a branch or tag in our repo
+  push:
+  # Whenever a pull request is opened, reopened or gets new commits.
+  pull_request:
+# This implies that for every push to a local branch in our repo for which a
+# pull request is open this runs twice. But it's important to ensure that pull
+# requests get tested even if their branch comes from a fork.
+
+jobs:
+  # The l3build job contains the actual work. We misuse the matrix mechanism to
+  # create three jobs which only differ in minimal elements.
+  l3build:
+    runs-on: ubuntu-20.04
+    strategy:
+      matrix:
+        # include indicates that we want to set explicitly these combinations
+        # and don't want full matrix testing.
+        # "name" is just to make the output more readable.
+        # "l3build_cmd" is the actual command to run
+        # "artifact_name" is which artifact might get generated by this step.
+        # IMPORTANT: artifact_name == "Documentation" is used as a trigger to
+        # generate the artifact from PDF files and not the build directory and
+        # to generate the artifact when the run is successful, not when it fails.
+        include:
+          - name: "Test suite"
+            l3build_cmd: l3build check -q -H --show-log-on-error
+            artifact_name: testfiles
+          - name: "Documentation"
+            l3build_cmd: l3build doc -q -H
+            artifact_name: Documentation
+    name: ${{matrix.name }}
+    steps:
+      # Boilerplate
+      - name: Checkout repository
+        uses: actions/checkout at v2
+      # GitHub Actions don't regenerate the test if the key doesn't change, so
+      # we integrate a random UUID into the key to keep them different.
+      # DO NOT CHANGE THIS
+      - name: Generate unique ID
+        id: get-id
+        run: |
+          echo -n ::set-output name=id::
+          cat /proc/sys/kernel/random/uuid
+      # Actually load the cache. Since we never reuse the key, we need restore-keys
+      # to indicate the prefix of our caches. This loads the newest cache with this
+      # prefix in the key.
+      #
+      # If we want to force regeneration of the cache, increase the number after
+      # *both* instances of "texlive-v"
+      - name: Load cache
+        uses: actions/cache at v2
+        with:
+          path: ~/texlive
+          key: texlive-v0-${{ steps.get-id.outputs.id }}
+          restore-keys: texlive-v0-
+      # We need Ghostscript for dvips and XeTeX tests.
+      - run: sudo apt-get install ghostscript
+      - name: Install TeX Live
+        uses: zauguin/install-texlive at v1
+        with:
+          # The following list can be altered to change which TeX Live packages to install.
+          # (Technically no YAML comments can appear in there but all lines starting with #
+          # get removed)
+          # There is no technical reason to list every package on a new line, this is only
+          # done for readablity and diff-friendliness.
+          packages: |
+            # The test framework itself
+            l3build
+            #
+            # Required to build plain and LaTeX formats including (u)pLaTeX
+            latex-bin
+            luahbtex
+            platex
+            uplatex
+            tex
+            xetex
+            #
+            # Then get the rest of required LaTeX
+            amsmath
+            tools
+            #
+            # Assuming a 'basic' font set up, metafont is required to avoid
+            # warnings with some packages and errors with others
+            metafont
+            mfware
+            #
+            # Dependencies for tests that are not auto-resolved
+            bibtex
+            lualatex-math
+            #
+            # For the doc target and testing l3doc
+            alphalph
+            amsfonts
+            bookmark
+            booktabs
+            catchfile
+            colortbl
+            csquotes
+            dvips
+            ec
+            enumitem
+            epstopdf
+            epstopdf-pkg
+            everysel
+            fancyvrb
+            hologo
+            hyperref
+            lipsum
+            listings
+            makeindex
+            mathpazo
+            metalogo
+            oberdiek
+            pgf
+            psnfss
+            ragged2e
+            siunitx
+            times
+            underscore
+            units
+      - name: Run l3build
+        run: ${{ matrix.l3build_cmd }}
+      # Now we create the artifacts: There are two cases where this happens.
+      # 1. If we failed running tests
+      - name: Archive failed test output
+        if: ${{ matrix.artifact_name != 'Documentation' && failure() }}
+        uses: actions/upload-artifact at v2
+        with:
+          name: ${{ matrix.artifact_name }}
+          path: build/test*/*.diff
+          # Decide how long to keep the test output artifact:
+          retention-days: 3
+      # 2. If we succeed building documentation
+      - name: Archive documentation
+        if: ${{ matrix.artifact_name == 'Documentation' && success() }}
+        uses: actions/upload-artifact at v2
+        with:
+          name: ${{ matrix.artifact_name }}
+          path: "**/*.pdf"
+          # Decide how long to keep the test output artifact:
+          retention-days: 21
+  # GitHub automatically informs the initiator of any action about the result, but
+  # we additionally want to keep the latex-commits mailing list informed about
+  # test failures.
+  notifiy:
+    name: Send notifications
+    runs-on: ubuntu-20.04
+    # Run after the `l3build` job in order to be able to react to it's output.
+    needs: l3build
+    # Only run if the tests failed, we don't want to get notifications for every run.
+    # We don't want information for pull requests since for pull requests from local
+    # branches we already send notifications when the branch test fails and pull requests
+    # from forks can't access the username and password secrets required to send mails.
+    if: ${{ failure() && github.event_name != 'pull_request' }}
+    steps:
+      - name: Send mail
+        # The explicit commit hash ensures that this can't be used by dawidd6 as a
+        # backdoor to execute arbitrary code during our runs.
+        uses: dawidd6/action-send-mail at ceb614a2c5737d913f2d2729e2bcc70ad933382b
+        with:
+          # Currently using my (Marcel's) mail server for sending mails.
+          server_address: typesetting.eu
+          server_port: 587
+          # These values can be changed in the repository settings.
+          username: ${{secrets.MAIL_USERNAME}}
+          password: ${{secrets.MAIL_PASSWORD}}
+          # If we want to send notifications to additional addresses, at them here as
+          # a comma separated list.
+          to: latex3-commits at tug.org
+          # The name is arbitrary, but if you want to change the address you need to
+          # coordinate it with the administrator of the mail server to allow the account
+          # to send from the mail address.
+          from: LaTeX CI <github at latex-project.org>
+          priority: high
+          # Determine the subject and body of the mail.
+          subject: "Test failed: ${{github.repository}} (${{github.ref}})"
+          body: |
+            Test failure for ${{github.repository}}
+            -------------------------------------------------------------
+
+            On branch:        ${{github.ref}} (${{github.sha}})
+            Initiated by:     ${{github.actor}}
+            Commit URL:       https://github.com/${{github.repository}}/commit/${{github.sha}}
+            More information: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}





More information about the latex3-commits mailing list.