Skip to content

Commit 12705e8

Browse files
authored
Merge pull request #23 from 40ants/dynamic-space-size-and-steps
Added ability to specify dynamic-space-size for lisp jobs.
2 parents 6356abc + 8e4428a commit 12705e8

File tree

12 files changed

+207
-53
lines changed

12 files changed

+207
-53
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@
106106
"ubuntu-latest",
107107
"macos-latest"
108108
],
109+
"exclude": [
110+
{
111+
"os": "macos-latest",
112+
"lisp": "ccl-bin"
113+
}
114+
],
109115
"quicklisp": [
110116
"quicklisp",
111117
"ultralisp"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/.qlot
44
*.fasl
55
.DS_Store
6+
*.~undo-tree~

40ants-ci.asd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"40ants-ci/jobs/linter"
1212
"40ants-ci/jobs/critic"
1313
"40ants-ci/jobs/run-tests"
14-
"40ants-ci/jobs/autotag")
14+
"40ants-ci/jobs/autotag"
15+
"40ants-ci/workflow")
1516
:description "A tool simplify continuous deployment for Common Lisp projects."
1617
:homepage "https://40ants.com/ci/"
1718
:source-control (:git "https://github.com/40ants/ci")

docs/changelog.lisp

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,66 @@
77

88
(defchangelog (:ignore-words ("40ANTS-DOC"
99
"ASDF"
10+
"CI"
11+
"secrets.DEPLOY_TRIGGER_TOKEN"
1012
"DEPLOY_TRIGGER_TOKEN"
13+
"secrets.GITHUB_TOKEN"
1114
"GITHUB_TOKEN"
1215
"OSX")
1316
:external-docs ("https://40ants.com/40ants-asdf-system/"))
17+
(0.17.0 2025-02-06
18+
"
19+
Added
20+
=====
21+
22+
Functions for creation jobs now accept two new arguments:
23+
24+
- STEPS-BEFORE argument allows to specify a list of steps to be performed before the job. For example, this can be used to install some system packages required for loading ASDF systems during the job execution.
25+
- STEPS-AFTER argument is the same as previous one, but executes steps after the job.
26+
")
27+
(0.16.0 2024-12-14
28+
"
29+
Added
30+
=====
31+
32+
Now dynamic space size can be given for lisp steps.
33+
34+
There are two ways to set it:
35+
36+
```
37+
(build-docs
38+
:asdf-system \"cl-telegram-bot-docs\"
39+
:env ((\"DYNAMIC_SPACE_SIZE\" . \"4Gb\")))
40+
```
41+
42+
This way it will be applied only to the step of the documentation building,
43+
because [docs-builder script](https://github.com/40ants/docs-builder) allows to use
44+
such environment variable.
45+
46+
But if you CI process fails to compile the ASDF system because of the memory limit,
47+
then you need to set dynamic space size on the earlier state - during \"Setup Lisp\"
48+
step. For this case an argument DYNAMIC-SPACE-SIZE can be given:
49+
50+
```
51+
(build-docs
52+
:asdf-system \"cl-telegram-bot-docs\"
53+
:dynamic-space-size \"4gb\")
54+
```
55+
56+
")
1457
(0.15.0 2024-03-02
1558
"
1659
New
1760
===
1861
19-
* Now you can specify ENV argument to 40ANTS-CI:DEFWORKFLOW and any job. This should be an alist where keys are strings and values are evaluated during GitHub workflow generation phase. Read more in 40ANTS-CI-DOCS/INDEX::@ENV section.
20-
* 40ANTS-CI/JOBS/AUTOTAG:AUTOTAG function now ignores TOKEN-PATTERN argument if ENV argument was given and has GITHUB_TOKEN value for whole job.
62+
* Now you can specify ENV argument to 40ANTS-CI/WORKFLOW:DEFWORKFLOW and any job. This should be an alist where keys are strings and values are evaluated during GitHub workflow generation phase. Read more in 40ANTS-CI-DOCS/INDEX::@ENV section.
63+
* Also, 40ANTS-CI/JOBS/AUTOTAG:AUTOTAG function now ignores TOKEN-PATTERN argument if ENV argument was given and has `GITHUB_TOKEN` value for whole job.
2164
2265
Backward incompatible changes
2366
=============================
2467
2568
* When additional keyword arguments to 40ANTS-CI/STEPS/SH:SH function are given, they are transformed into env variables. Previously, their names were taken as is. Now they are uppercased and dash symbols are replaced with underscores.
2669
27-
2870
")
2971
(0.14.0 2024-02-25
3072
"
@@ -101,7 +143,7 @@ Class 40ANTS-CI/JOBS/CRITIC:CRITIC was fixed for case when there are multiple cr
101143
renames to the IGNORE-CRITIQUES argument.")
102144
(0.6.0 2022-02-21
103145
"- New job type \"critic\" was added. It advices how to make you Lisp code better.
104-
Learn more about this job type at 40ANTS-CI::@CRITIC section.")
146+
Learn more about this job type at 40ANTS-CI-DOCS/INDEX::@CRITIC section.")
105147
(0.5.0 2022-01-28
106148
"- Move the actions/checkout action from v1 to v2.")
107149
(0.4.0 2022-01-28

docs/index.lisp

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#:docs-config)
1010
(:import-from #:40ants-doc/autodoc
1111
#:defautodoc)
12-
(:import-from #:40ants-logging-docs/changelog
12+
(:import-from #:40ants-ci-docs/changelog
1313
#:@changelog)
1414
(:export #:@index
1515
#:@readme
@@ -35,6 +35,7 @@
3535
"JSON"
3636
"OS"
3737
"SBL"
38+
"SBCL"
3839
"BSD"
3940
"TODO"
4041
"ASD"
@@ -96,7 +97,9 @@ of the package inferred ASDF system `EXAMPLE/CI`. A file should have the followi
9697
```
9798
"
9899
(@job-types section)
99-
(@caching section))
100+
(@caching section)
101+
(@env section)
102+
(@running-custom-steps section))
100103

101104

102105
(defsection @job-types (:title "Job Types")
@@ -613,4 +616,27 @@ Note - environment variable names are always transformed to uppercase and dashes
613616
")
614617

615618

619+
(defsection @running-custom-steps (:title "Running custom steps")
620+
"
621+
Sometimes you might need to install custom system packages or do something before the job will finish. To accomplish
622+
these task you can provide custom steps using BEFORE-STEPS argument or AFTER-STEPS argument.
623+
624+
Here is an example where we are installing system package libunaq1-dev before running the testsuite:
625+
626+
627+
```lisp
628+
(defparameter *required-steps*
629+
(list (sh \"Install libunac\"
630+
\"sudo apt-get install -y libunac1-dev\")))
631+
632+
(defworkflow ci
633+
:on-pull-request t
634+
:cache t
635+
:jobs ((run-tests
636+
:steps-before *required-steps*
637+
:asdf-system \"my-asdf-system\")))
638+
```
639+
")
640+
641+
616642
(defautodoc @api (:system "40ants-ci"))

qlfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
("quicklisp" .
22
(:class qlot/source/dist:source-dist
3-
:initargs (:distribution "http://beta.quicklisp.org/dist/quicklisp.txt" :%version :latest)
4-
:version "2023-10-21"))
3+
:initargs (:distribution "https://beta.quicklisp.org/dist/quicklisp.txt" :%version :latest)
4+
:version "2024-10-12"))
55
("ultralisp" .
66
(:class qlot/source/dist:source-dist
7-
:initargs (:distribution "http://dist.ultralisp.org" :%version :latest)
8-
:version "20240303155001"))
7+
:initargs (:distribution "https://dist.ultralisp.org" :%version :latest)
8+
:version "20250206134000"))
99
("bordeaux-threads" .
1010
(:class qlot/source/github:source-github
1111
:initargs (:repos "svetlyak40wt/bordeaux-threads" :ref nil :branch "fix-apiv2-for-no-threads" :tag nil)

src/ci.lisp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
"ultralisp")
5050
:lisp ("sbcl-bin"
5151
"ccl-bin")
52+
;; CCL does not work on arm64 architecture yet
53+
:exclude ((:os "macos-latest" :lisp "ccl-bin"))
5254
:coverage t
5355
:qlfile "{% ifequal quicklisp_dist \"ultralisp\" %}
5456
dist ultralisp http://dist.ultralisp.org

src/jobs/docs.lisp

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defpackage #:40ants-ci/jobs/docs
1+
(uiop:define-package #:40ants-ci/jobs/docs
22
(:use #:cl)
33
(:import-from #:40ants-ci/jobs/lisp-job
44
#:asdf-system)
@@ -9,7 +9,7 @@
99
#:current-system-name)
1010
(:export #:build-docs
1111
#:error-on-warnings))
12-
(in-package 40ants-ci/jobs/docs)
12+
(in-package #:40ants-ci/jobs/docs)
1313

1414

1515
(defclass build-docs (40ants-ci/jobs/lisp-job:lisp-job)
@@ -19,16 +19,34 @@
1919
(:documentation "Builds documentation and uploads it to GitHub using [\"40ants/build-docs\" github action](https://40ants.com/build-docs/)."))
2020

2121

22-
(defun build-docs (&key asdf-system
23-
asdf-version
24-
(error-on-warnings t)
25-
env)
22+
(defun build-docs (&rest args
23+
&key
24+
(error-on-warnings t)
25+
;; Settings from base JOB class
26+
os
27+
permissions
28+
exclude
29+
env
30+
steps
31+
steps-before
32+
steps-after
33+
;; Settings from base LISP-JOB class
34+
roswell-version
35+
asdf-version
36+
qlot-version
37+
quicklisp
38+
lisp
39+
asdf-system
40+
qlfile
41+
dynamic-space-size)
2642
"Creates a job of class BUILD-DOCS."
27-
(make-instance 'build-docs
28-
:asdf-system asdf-system
29-
:error-on-warnings error-on-warnings
30-
:asdf-version asdf-version
31-
:env env))
43+
(declare (ignore asdf-system error-on-warnings
44+
os permissions exclude env steps
45+
steps-before steps-after
46+
roswell-version asdf-version qlot-version
47+
quicklisp lisp qlfile dynamic-space-size))
48+
(apply #'make-instance
49+
'build-docs args))
3250

3351

3452
(defmethod 40ants-ci/jobs/job:steps ((job build-docs))

src/jobs/job.lisp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
#:make-permissions
2323
#:explicit-steps
2424
#:exclude
25-
#:job-env))
25+
#:job-env
26+
#:steps-before
27+
#:steps-after))
2628
(in-package #:40ants-ci/jobs/job)
2729

2830

@@ -46,6 +48,14 @@
4648
:initarg :steps
4749
:documentation "This slot holds steps given as a STEPS argument to a job constructor. Depending on a job class, it might add additional steps around these explicit steps."
4850
:reader explicit-steps)
51+
(steps-before :initform nil
52+
:initarg :steps-before
53+
:documentation "This slot holds steps given as a STEPS-BEFORE argument to a job constructor. These steps will be prepended to steps returned by the JOB class."
54+
:reader steps-before)
55+
(steps-after :initform nil
56+
:initarg :steps-after
57+
:documentation "This slot holds steps given as a STEPS-AFTER argument to a job constructor. These steps will be appended to steps returned by the JOB class."
58+
:reader steps-after)
4959
(permissions :initform nil
5060
:initarg :permissions
5161
:documentation "A plist of permissions need for running the job.
@@ -92,8 +102,11 @@
92102
(explicit-steps job))
93103

94104
(:method :around ((job job))
95-
(uiop:ensure-list
96-
(call-next-method))))
105+
(append
106+
(steps-before job)
107+
(uiop:ensure-list
108+
(call-next-method))
109+
(steps-after job))))
97110

98111

99112
(defmethod exclude :around ((job job))

src/jobs/linter.lisp

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defpackage #:40ants-ci/jobs/linter
1+
(uiop:define-package #:40ants-ci/jobs/linter
22
(:use #:cl)
33
(:import-from #:40ants-ci/steps/sh
44
#:sh)
@@ -10,7 +10,7 @@
1010
(:export #:linter
1111
#:asdf-systems
1212
#:check-imports))
13-
(in-package 40ants-ci/jobs/linter)
13+
(in-package #:40ants-ci/jobs/linter)
1414

1515

1616
(defclass linter (40ants-ci/jobs/lisp-job:lisp-job)
@@ -32,17 +32,39 @@
3232
(current-system-name))))
3333

3434

35-
(defun linter (&key asdf-systems asdf-version check-imports env)
35+
(defun linter (&rest args
36+
&key
37+
asdf-systems
38+
check-imports
39+
;; Settings from base JOB class
40+
os
41+
permissions
42+
exclude
43+
env
44+
steps
45+
steps-before
46+
steps-after
47+
;; Settings from base LISP-JOB class
48+
roswell-version
49+
asdf-version
50+
qlot-version
51+
quicklisp
52+
lisp
53+
qlfile
54+
dynamic-space-size)
3655
"Creates a job which will run SBLint for given ASDF systems.
3756
3857
If no ASD files given, it will use all ASD files from
3958
the current ASDF system."
40-
(make-instance 'linter
41-
:asdf-system (first asdf-systems)
42-
:asdf-systems asdf-systems
43-
:asdf-version asdf-version
44-
:env env
45-
:check-imports check-imports))
59+
(declare (ignore check-imports os permissions exclude env
60+
steps steps-before steps-after permissions
61+
roswell-version asdf-version qlot-version
62+
quicklisp lisp qlfile dynamic-space-size))
63+
64+
(apply #'make-instance
65+
'linter
66+
:asdf-system (first asdf-systems)
67+
args))
4668

4769

4870
(defmethod 40ants-ci/jobs/job:steps ((job linter))

0 commit comments

Comments
 (0)