@@ -1152,6 +1152,58 @@ are available:
1152
1152
ptest `` has not been run yet.
1153
1153
1154
1154
1155
+ Testing GitHub Actions locally
1156
+ ==============================
1157
+
1158
+ `act <https://github.com/nektos/act >`_ is a tool, written in Go, and using Docker,
1159
+ to run GitHub Actions locally; in particular, it speeds up developing Actions.
1160
+ We recommend using ``gh extension `` facility to install ``act ``. ::
1161
+
1162
+ [alice@localhost sage]$ gh extension install https://github.com/nektos/gh-act
1163
+
1164
+ Extra steps needed for configuration of Docker to run Actions locally can be found on
1165
+ `act's GitHub <https://github.com/nektos/act >`_
1166
+
1167
+ Here we give a very short sampling of ``act ``'s capabilities. If you installed standalone
1168
+ ``act ``, it should be invoked as ``act ``, not as ``gh act ``.
1169
+ After the set up, one can e.g. list all the available linting actions::
1170
+
1171
+ [alice@localhost sage]$ gh act -l | grep lint
1172
+ 0 lint-pycodestyle Code style check with pycodestyle Lint lint.yml push,pull_request
1173
+ 0 lint-relint Code style check with relint Lint lint.yml push,pull_request
1174
+ 0 lint-rst Validate docstring markup as RST Lint lint.yml push,pull_request
1175
+ [alice@localhost sage]$
1176
+
1177
+ run a particular action ``lint-rst `` ::
1178
+
1179
+ [alice@localhost sage]$ gh act -j lint-rst
1180
+ ...
1181
+
1182
+ and so on.
1183
+
1184
+ By default, ``act `` pulls all the data needed from the next, but it can also cache it,
1185
+ speeding up repeated runs quite a lot. The following repeats running of ``lint-rst `` using cached data::
1186
+
1187
+ [alice@localhost sage]$ gh act -p false -r -j lint-rst
1188
+ [Lint/Validate docstring markup as RST] Start image=catthehacker/ubuntu:act-latest
1189
+ ...
1190
+ | rst: commands[0] /home/alice/work/software/sage/src> flake8 --select=RST
1191
+ | rst: OK (472.60=setup[0.09]+cmd[472.51] seconds)
1192
+ | congratulations :) (474.10 seconds)
1193
+ ...
1194
+ [Lint/Validate docstring markup as RST] Success - Main Lint using tox -e rst
1195
+ [Lint/Validate docstring markup as RST] Run Post Set up Python
1196
+ [Lint/Validate docstring markup as RST] docker exec cmd=[node /var/run/act/actions/actions-setup-python@v4/dist/cache-save/index.js] user= workdir=
1197
+ [Lint/Validate docstring markup as RST] Success - Post Set up Python
1198
+ [Lint/Validate docstring markup as RST] Job succeeded
1199
+
1200
+ Here ``-p false `` means using already pulled Docker images, and ``-r `` means do not remove Docker images
1201
+ after a successful run which used them. This, and many more details, can be found by running ``gh act -h ``, as well
1202
+ as reading ``act ``'s documentation.
1203
+
1204
+ .. This sectuion is a stub.
1205
+ More Sage-specfic details for using ``act`` should be added. PRs welcome!
1206
+
1155
1207
Using our pre-built Docker images for development in VS Code
1156
1208
============================================================
1157
1209
0 commit comments