-
-
Notifications
You must be signed in to change notification settings - Fork 266
216 lines (213 loc) · 8.62 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: Automated testing
# Currently we run in two situations:
on:
# Whenever someone pushes to a branch in our repo
push:
branches:
- "*"
# 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:
# 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@v3
- name: Install TeX Live
id: texlive
uses: zauguin/install-texlive@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.
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:
- module: base
config: build
engine: pdftex
- module: base
config: build
engine: xetex
- module: base
config: build
engine: luatex
extra_command: kpsewhich -mktex=tfm -must-exist ecssdc10.tfm
- module: base
config: config-1run
- module: base
config: config-TU
- module: base
config: config-legacy
- module: base
config: config-lthooks
- module: base
config: config-lthooks2
- module: base
config: config-ltcmd
- module: base
config: config-doc
- module: base
config: config-ltmarks
- module: required/amsmath
- module: required/cyrillic
- module: required/firstaid
- module: required/graphics
- module: required/latex-lab
config: build
- module: required/latex-lab
config: config-OR
- module: required/latex-lab
config: config-math
- module: required/latex-lab
config: config-OR-luatex
- module: required/latex-lab
config: config-sec
- module: required/latex-lab
config: config-toc
- module: required/latex-lab
config: config-block
- module: required/latex-lab
config: config-LM-tagging
- module: required/latex-lab
config: config-graphic
- module: required/latex-lab
config: config-minipage
- module: required/latex-lab
config: config-float
- module: required/latex-lab
config: config-bib
- module: required/tools
name: "Tests: ${{ matrix.module }}${{ matrix.config && format(' - {0}', matrix.config) || ''}}${{ matrix.engine && format(' - {0}', matrix.engine) || ''}}"
needs: texlive-cache
steps:
# Boilerplate
- name: Checkout repository
uses: actions/checkout@v3
# We need Ghostscript for dvips and XeTeX tests.
- run: sudo apt-get update && sudo apt-get install ghostscript
- name: Restore TeX Live from cache
uses: actions/cache/restore@v3
with:
path: ~/texlive
key: ${{ needs.texlive-cache.outputs.cache_key }}
fail-on-cache-miss: true
- run: echo $HOME/texlive/bin/x86_64-linux >> $GITHUB_PATH
- if: ${{ matrix.extra_command }}
run: ${{ matrix.extra_command }}
- name: Run l3build
working-directory: ${{ matrix.module }}
run: "l3build check -q --show-log-on-error${{ matrix.config && format(' -c {0}', matrix.config) || ''}}${{ matrix.engine && format(' -e {0}', matrix.engine) || ''}}"
# Now we create the artifacts for the logs of failed tests
- name: Archive failed test output
if: ${{ always() }}
uses: zauguin/l3build-failure-artifacts@v1
with:
name: testfiles
# Decide how long to keep the test output artifact:
retention-days: 3
docs:
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- module: base
environment: LTX_DOC_COMPONENT=1
- module: base
environment: LTX_DOC_COMPONENT=2
- module: base
environment: LTX_DOC_COMPONENT=3
- module: required
name: "Documentation: ${{ matrix.module }}"
needs: texlive-cache
steps:
# Boilerplate
- name: Checkout repository
uses: actions/checkout@v3
# We need Ghostscript for dvips and XeTeX tests.
- run: sudo apt-get update && sudo apt-get install ghostscript
- name: Restore TeX Live from cache
uses: actions/cache/restore@v3
with:
path: ~/texlive
key: ${{ needs.texlive-cache.outputs.cache_key }}
fail-on-cache-miss: true
- run: echo $HOME/texlive/bin/x86_64-linux >> $GITHUB_PATH
- if: ${{ matrix.environment }}
run: echo "${{ matrix.environment }}" >> $GITHUB_ENV
- name: Run l3build
working-directory: ${{ matrix.module }}
run: l3build doc -q -H --show-log-on-error
# Now we create the artifacts for the generated documentation
- name: Archive documentation
uses: actions/upload-artifact@v3
with:
name: Documentation
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
- docs
# 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@6063705cefe50cb915fc53bb06d4049cae2953b2
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@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@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}}