-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlfe-github-actions.html
More file actions
264 lines (227 loc) · 7.99 KB
/
lfe-github-actions.html
File metadata and controls
264 lines (227 loc) · 7.99 KB
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2026-04-21 Tue 15:25 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Github actions (CI/CD) for LFE.</title>
<meta name="generator" content="Org Mode" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<meta http-equiv="Content-Security-Policy" content="style-src-elem 'self' https://wmealing.github.io;">
<link rel="stylesheet" href="index.css">
<meta name="author" content="Wade Mealing" />
<meta name="description" content="Lisp Flavored Erlang CI/CD." />
</head>
<body>
<div id="content" class="content">
<h1 class="title">Github actions (CI/CD) for LFE.</h1>
<nav class="navbar-custom">
<div class="navbar-container">
<div class="navbar-brand">
<a href="index.html">Wade Mealing</a>
</div>
<div class="navbar-grid">
<div class="navbar-section">
<a href="systems.html"><h3>Systems</h3></a>
<div class="navbar-tags">
<a href="systems-erlang.html"><span class="navbar-tag">Erlang/OTP</span></a>
<a href="systems-clojure.html"><span class="navbar-tag">Clojure</span></a>
<a href="systems-lfe.html"><span class="navbar-tag">Lisp Flavored Erlang</span></a>
<a href="systems-cellium.html"><span class="navbar-tag">Cellium (TUI Framework)</span></a>
</div>
</div>
<div class="navbar-section">
<a href="security.html"><h3>Security</h3></a>
<div class="navbar-tags">
<a href="security-kernel.html"><span class="navbar-tag">Linux Kernel Analysis</span></a>
<a href="security-ebpf.html"><span class="navbar-tag">eBPF</span></a>
<a href="security-malware.html"><span class="navbar-tag">Malware Reversing</span></a>
<a href="security-rust.html"><span class="navbar-tag">Rust</span></a>
</div>
</div>
<div class="navbar-section">
<a href="tooling.html"><h3>Tooling</h3></a>
<div class="navbar-tags">
<a href="tooling-emacs.html"><span class="navbar-tag">Emacs / Elisp</span></a>
<a href="tooling-cicd.html"><span class="navbar-tag">CI/CD Pipelines</span></a>
<a href="tooling-openscad.html"><span class="navbar-tag">OpenSCAD</span></a>
</div>
</div>
</div>
<div class="navbar-utility">
<a href="rss.xml" class="rss-link">RSS</a>
<div class="navbar-avatar">
<a href="index.html"><img src="apple-touch-icon.png" alt="Avatar"></a>
</div>
</div>
</div>
</nav>
<div id="outline-container-org384bf92" class="outline-2">
<h2 id="org384bf92">What is CD/CD ?</h2>
<div class="outline-text-2" id="text-org384bf92">
<p>
If you want to take the headache and room for human error out of delivering software, the current trend is to
use "Continious Integration" and "Continious Delivery" which is a fancy word for automated testing of Merge requests
and automated delivery (whatever that means for your project).
</p>
<p>
There are many companies in this space, the one that I'm focusing on is githubs CI/CD platform which they have
branded as 'GitHub Actions'.
</p>
<p>
In their words:
</p>
<pre class="example" id="org99042ab">
GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that
allows you to automate your build, test, and deployment pipeline. You can create workflows
that build and test every pull request to your repository, or deploy merged pull requests
to production.
</pre>
</div>
</div>
<div id="outline-container-org6b9d442" class="outline-2">
<h2 id="org6b9d442">Why do I need it ?</h2>
<div class="outline-text-2" id="text-org6b9d442">
<p>
Github have a high level overview of their offerings, along with how they expect it to be
used <a href="https://resources.github.com/ci-cd/">on their github resources page</a>. With minimal effort, you can find many well thought out sites that
extoll the reasoning and logic of using CI/CD, repeating it here would be pointless.
</p>
<p>
I'm going to talk about it specifically in the context of automating
your LFE testing and container image generation.
</p>
<p>
Unlike the GitHub docs, I'm not giving you the shiny version, only how I see it.
</p>
</div>
</div>
<div id="outline-container-org47377ef" class="outline-2">
<h2 id="org47377ef">How it works.</h2>
<div class="outline-text-2" id="text-org47377ef">
<ol class="org-ol">
<li>An event occurs on your repository (push, pull, mr ).</li>
<li>GitHub searches the .github/workflows directory in your repository for "yml" workflow files that are present.</li>
<li><p>
A workflow run is triggered for any workflows that have on: values that match the triggering event.
Each workflow run will use the version of the workflow that is present in the associated branch at that time.
</p>
<p>
(To put it bluntly, it runs with the version that of the '.github/workflow/*.yaml' at the time).
</p></li>
</ol>
<p>
So, how to get this up and running quickly, create a .github/config/ci-cd.yaml file.
</p>
<p>
Here is an example that I used.
</p>
<div class="org-src-container">
<pre class="src src-yaml.">name: ci/cd
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: Build and run on OTP-26 and latest LFE.
runs-on: ubuntu-latest
container:
image: erlang:26
steps:
- uses: actions/checkout@v4
- name: Check rebar3 Version
run: DEBUG=1 rebar3 --version
- name: Compile
run: rebar3 lfe compile
- name: Run Tests
run: rebar3 as test lfe ltest
</pre>
</div>
<p>
This spins up a basic ubuntu image, with erlang 26 installed, your specific app may require
another newer (or older) version of the erlang VM (BEAM) please adjust the above as necessary.
</p>
<p>
Rebar is also installed on the image, and when configured to use lfe, will also fetch the libraries
configured in the rebar.config file during the build process.
</p>
<p>
This example compiles and runs the tests.
</p>
<p>
Listed below is the rebar.config that
worked for me.
</p>
<div class="org-src-container">
<pre class="src src-erlang">{erl_opts, [debug_info]}.
{deps, [
{lfe, "2.1.2"}
]}.
{plugins, [
{rebar3_lfe, "0.4.8"}
]}.
{provider_hooks, [
{pre, [{compile, {lfe, compile}}]}
]}.
{xref_checks,[
undefined_function_calls,undefined_functions,locals_not_used,
deprecated_function_calls,deprecated_functions
]}.
{profiles, [
{prod, [
{relx, [
{dev_mode, false},
{include_erts, true}
]}
]},
{test, [
{deps, [
{proper, "1.4.0"}
]},
{plugins, [
{rebar3_proper, "0.12.1"}
]},
{eunit_opts, [verbose]},
{erl_opts, [{src_dirs, ["src", "test"]}]}
]}
]}.
{alias, [
{coverage, [
{proper, "-c"},
{cover, "-v --min_coverage=0"}
]},
{check, [
compile,
xref,
%%dialyzer,
eunit,
coverage
]}
]}.
</pre>
</div>
<p>
Now when you do a 'git push' you should see this 'action' being run under the action tab of your project.
</p>
<p>
This is a very simple GitHub Action, that will allow you to see the basics of how CI/CD works. The "Delivery"
part of this , I will probably expand on in another post.
</p>
</div>
</div>
<div id="outline-container-org12b0c62" class="outline-2">
<h2 id="org12b0c62">Resources:</h2>
<div class="outline-text-2" id="text-org12b0c62">
<p>
<a href="https://github.com/wmealing/CI-CD-TEST/tree/main">https://github.com/wmealing/CI-CD-TEST/tree/main</a>
</p>
</div>
</div>
</div>
</body>
</html>