33# Erlang/OTP + LFE project
44
55name : CI
6+
67on :
78 push :
8- branches : [main, develop, claude/*]
9+ branches : [ main, develop, claude/* ]
910 pull_request :
10- branches : [main, develop]
11+ branches : [ main, develop ]
1112 schedule :
1213 # Run tests daily at 2 AM UTC
1314 - cron : ' 0 2 * * *'
15+
1416env :
1517 OTP_VERSION : ' 26.2'
1618 REBAR3_VERSION : ' 3.22.1'
19+
1720permissions : read-all
21+
1822jobs :
1923 # ##########################################################################
2024 # Build Job
2125 # ##########################################################################
2226 build :
2327 name : Build
2428 runs-on : ubuntu-latest
25- timeout-minutes : 15
29+
2630 steps :
2731 - name : Checkout code
2832 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
33+
2934 - name : Setup Erlang/OTP
30- uses : erlef/setup-beam@ee09b1e59bb240681c382eb1f0abc6a04af72764 # v1
35+ uses : erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1
3136 with :
3237 otp-version : ${{ env.OTP_VERSION }}
3338 rebar3-version : ${{ env.REBAR3_VERSION }}
39+
3440 - name : Cache build artifacts
3541 uses : actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v4
3642 with :
@@ -40,122 +46,144 @@ jobs:
4046 key : ${{ runner.os }}-build-${{ hashFiles('rebar.config') }}-${{ hashFiles('rebar.lock') }}
4147 restore-keys : |
4248 ${{ runner.os }}-build-
49+
4350 - name : Get dependencies
4451 run : rebar3 get-deps
52+
4553 - name : Compile
4654 run : rebar3 compile
55+
4756 - name : Upload build artifacts
48- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
57+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
4958 with :
5059 name : build-artifacts
5160 path : _build/
5261 retention-days : 1
62+
5363 # ##########################################################################
5464 # Test Jobs
5565 # ##########################################################################
5666 test :
5767 name : Test (OTP ${{ matrix.otp }})
5868 runs-on : ubuntu-latest
59- timeout-minutes : 15
6069 needs : build
70+
6171 strategy :
6272 matrix :
6373 otp : ['26', '27']
6474 fail-fast : false
75+
6576 steps :
6677 - name : Checkout code
6778 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
79+
6880 - name : Setup Erlang/OTP
69- uses : erlef/setup-beam@ee09b1e59bb240681c382eb1f0abc6a04af72764 # v1
81+ uses : erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1
7082 with :
7183 otp-version : ${{ matrix.otp }}
7284 rebar3-version : ${{ env.REBAR3_VERSION }}
85+
7386 - name : Download build artifacts
7487 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
7588 with :
7689 name : build-artifacts
7790 path : _build/
91+
7892 - name : Run tests
7993 run : rebar3 lfe test
94+
8095 - name : Upload test results
8196 if : always()
82- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
97+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
8398 with :
8499 name : test-results-otp${{ matrix.otp }}
85100 path : _build/test/logs/
86101 retention-days : 7
102+
87103 # ##########################################################################
88104 # Coverage Job
89105 # ##########################################################################
90106 coverage :
91107 name : Test Coverage
92108 runs-on : ubuntu-latest
93- timeout-minutes : 15
94109 needs : build
110+
95111 steps :
96112 - name : Checkout code
97113 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
114+
98115 - name : Setup Erlang/OTP
99- uses : erlef/setup-beam@ee09b1e59bb240681c382eb1f0abc6a04af72764 # v1
116+ uses : erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1
100117 with :
101118 otp-version : ${{ env.OTP_VERSION }}
102119 rebar3-version : ${{ env.REBAR3_VERSION }}
120+
103121 - name : Download build artifacts
104122 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
105123 with :
106124 name : build-artifacts
107125 path : _build/
126+
108127 - name : Run tests with coverage
109128 run : rebar3 lfe test --cover
129+
110130 - name : Generate coverage report
111131 run : rebar3 cover --verbose
132+
112133 - name : Upload coverage to Codecov
113134 uses : codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6
114135 with :
115136 files : _build/test/cover/cobertura.xml
116137 fail_ci_if_error : false
117138 verbose : true
139+
118140 # ##########################################################################
119141 # Static Analysis
120142 # ##########################################################################
121143 dialyzer :
122144 name : Dialyzer Static Analysis
123145 runs-on : ubuntu-latest
124- timeout-minutes : 15
125146 needs : build
147+
126148 steps :
127149 - name : Checkout code
128150 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
151+
129152 - name : Setup Erlang/OTP
130- uses : erlef/setup-beam@ee09b1e59bb240681c382eb1f0abc6a04af72764 # v1
153+ uses : erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1
131154 with :
132155 otp-version : ${{ env.OTP_VERSION }}
133156 rebar3-version : ${{ env.REBAR3_VERSION }}
157+
134158 - name : Cache PLT
135159 uses : actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v4
136160 with :
137161 path : _build/default/*_plt
138162 key : ${{ runner.os }}-plt-${{ hashFiles('rebar.config') }}
139163 restore-keys : |
140164 ${{ runner.os }}-plt-
165+
141166 - name : Download build artifacts
142167 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
143168 with :
144169 name : build-artifacts
145170 path : _build/
171+
146172 - name : Run Dialyzer
147173 run : rebar3 dialyzer
148174 continue-on-error : true
175+
149176 # ##########################################################################
150177 # Security Checks
151178 # ##########################################################################
152179 security :
153180 name : Security Checks
154181 runs-on : ubuntu-latest
155- timeout-minutes : 15
182+
156183 steps :
157184 - name : Checkout code
158185 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
186+
159187 - name : Check for hardcoded secrets
160188 run : |
161189 echo "Checking for hardcoded passwords..."
@@ -165,6 +193,7 @@ jobs:
165193 echo "Checking for API keys..."
166194 ! grep -r "api_key\s*=" src/ || (echo "❌ Found hardcoded API keys" && exit 1)
167195 echo "✓ No hardcoded API keys found"
196+
168197 - name : Verify safety mechanisms
169198 run : |
170199 echo "Checking for pause mechanism..."
@@ -174,75 +203,126 @@ jobs:
174203 echo "Checking for rate limiting..."
175204 grep -r "rate_limit" src/ || (echo "❌ Rate limiting missing!" && exit 1)
176205 echo "✓ Rate limiting verified"
206+
177207 # ##########################################################################
178208 # RSR Compliance Check
179209 # ##########################################################################
180210 rsr-compliance :
181211 name : RSR Framework Compliance
182212 runs-on : ubuntu-latest
183- timeout-minutes : 15
213+
184214 steps :
185215 - name : Checkout code
186216 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
217+
187218 - name : Check required files
188- run: "echo \"Checking RSR Bronze Level compliance...\"\n\necho \"✓ Checking core documentation...\"\ntest -f README.md || (echo \"❌ README.md missing\" && exit 1)\ntest -f LICENSE || (echo \"❌ LICENSE missing\" && exit 1)\ntest -f CHANGELOG.md || (echo \"❌ CHANGELOG.md missing\" && exit 1)\ntest -f CODE_OF_CONDUCT.md || (echo \"❌ CODE_OF_CONDUCT.md missing\" && exit 1)\ntest -f MAINTAINERS.md || (echo \"❌ MAINTAINERS.md missing\" && exit 1)\n\necho \"✓ Checking documentation directory...\"\ntest -f docs/CONTRIBUTING.md || (echo \"❌ CONTRIBUTING.md missing\" && exit 1)\ntest -f docs/SECURITY.md || (echo \"❌ SECURITY.md missing\" && exit 1)\ntest -f docs/USAGE.md || (echo \"❌ USAGE.md missing\" && exit 1)\ntest -f docs/API_REFERENCE.md || (echo \"❌ API_REFERENCE.md missing\" && exit 1)\ntest -f docs/QUICKSTART.md || (echo \"❌ QUICKSTART.md missing\" && exit 1)\n\necho \"✓ Checking .well-known directory...\"\ntest -f .well-known/security.txt || (echo \"❌ security.txt missing\" && exit 1)\ntest -f .well-known/ai.txt || (echo \"❌ ai.txt missing\" && exit 1)\ntest -f .well-known/humans.txt || (echo \"❌ humans.txt missing\" && exit 1)\n\necho \"✓ Checking build system...\"\ntest -f rebar.config || (echo \"❌ rebar.config missing\" && exit 1)\ntest -f Makefile || (echo \"❌ Makefile missing\" && exit 1)\n\necho \"\"\necho \"\U0001F389 RSR Bronze Level Compliance: VERIFIED\"\necho \"\"\necho \"RSR Compliance Checklist:\"\necho \"✓ Documentation complete\"\necho \"✓ .well-known/ directory present\"\necho \"✓ Build system configured\"\necho \"✓ Code of Conduct adopted\"\necho \"✓ Security policy defined\"\necho \"✓ License specified (MIT)\"\necho \"✓ Contribution guidelines available\"\necho \"✓ Maintainers documented\"\necho \"\"\necho \"TPCF Perimeter: 3 (Community Sandbox)\"\n"
219+ run : |
220+ echo "Checking RSR Bronze Level compliance..."
221+
222+ echo "✓ Checking core documentation..."
223+ test -f README.md || (echo "❌ README.md missing" && exit 1)
224+ test -f LICENSE || (echo "❌ LICENSE missing" && exit 1)
225+ test -f CHANGELOG.md || (echo "❌ CHANGELOG.md missing" && exit 1)
226+ test -f CODE_OF_CONDUCT.md || (echo "❌ CODE_OF_CONDUCT.md missing" && exit 1)
227+ test -f MAINTAINERS.md || (echo "❌ MAINTAINERS.md missing" && exit 1)
228+
229+ echo "✓ Checking documentation directory..."
230+ test -f docs/CONTRIBUTING.md || (echo "❌ CONTRIBUTING.md missing" && exit 1)
231+ test -f docs/SECURITY.md || (echo "❌ SECURITY.md missing" && exit 1)
232+ test -f docs/USAGE.md || (echo "❌ USAGE.md missing" && exit 1)
233+ test -f docs/API_REFERENCE.md || (echo "❌ API_REFERENCE.md missing" && exit 1)
234+ test -f docs/QUICKSTART.md || (echo "❌ QUICKSTART.md missing" && exit 1)
235+
236+ echo "✓ Checking .well-known directory..."
237+ test -f .well-known/security.txt || (echo "❌ security.txt missing" && exit 1)
238+ test -f .well-known/ai.txt || (echo "❌ ai.txt missing" && exit 1)
239+ test -f .well-known/humans.txt || (echo "❌ humans.txt missing" && exit 1)
240+
241+ echo "✓ Checking build system..."
242+ test -f rebar.config || (echo "❌ rebar.config missing" && exit 1)
243+ test -f Makefile || (echo "❌ Makefile missing" && exit 1)
244+
245+ echo ""
246+ echo "🎉 RSR Bronze Level Compliance: VERIFIED"
247+ echo ""
248+ echo "RSR Compliance Checklist:"
249+ echo "✓ Documentation complete"
250+ echo "✓ .well-known/ directory present"
251+ echo "✓ Build system configured"
252+ echo "✓ Code of Conduct adopted"
253+ echo "✓ Security policy defined"
254+ echo "✓ License specified (MIT)"
255+ echo "✓ Contribution guidelines available"
256+ echo "✓ Maintainers documented"
257+ echo ""
258+ echo "TPCF Perimeter: 3 (Community Sandbox)"
259+
189260 - name : Validate security.txt (RFC 9116)
190261 run : |
191262 echo "Validating security.txt format..."
192263 grep -q "Contact:" .well-known/security.txt || (echo "❌ Missing Contact field" && exit 1)
193264 grep -q "Expires:" .well-known/security.txt || (echo "❌ Missing Expires field" && exit 1)
194265 echo "✓ security.txt format valid"
266+
195267 # ##########################################################################
196268 # Documentation
197269 # ##########################################################################
198270 docs :
199271 name : Build Documentation
200272 runs-on : ubuntu-latest
201- timeout-minutes : 15
202273 needs : build
274+
203275 steps :
204276 - name : Checkout code
205277 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
278+
206279 - name : Setup Erlang/OTP
207- uses : erlef/setup-beam@ee09b1e59bb240681c382eb1f0abc6a04af72764 # v1
280+ uses : erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1
208281 with :
209282 otp-version : ${{ env.OTP_VERSION }}
210283 rebar3-version : ${{ env.REBAR3_VERSION }}
284+
211285 - name : Download build artifacts
212286 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
213287 with :
214288 name : build-artifacts
215289 path : _build/
290+
216291 - name : Build EDoc
217292 run : rebar3 edoc
218293 continue-on-error : true
294+
219295 - name : Upload documentation
220- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
296+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
221297 with :
222298 name : documentation
223299 path : doc/
224300 retention-days : 30
301+
225302 # ##########################################################################
226303 # Release (on tags)
227304 # ##########################################################################
228305 release :
229306 name : Create Release
230307 runs-on : ubuntu-latest
231- timeout-minutes : 15
232308 needs : [test, coverage, security, rsr-compliance]
233309 if : startsWith(github.ref, 'refs/tags/v')
310+
234311 steps :
235312 - name : Checkout code
236313 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
314+
237315 - name : Setup Erlang/OTP
238- uses : erlef/setup-beam@ee09b1e59bb240681c382eb1f0abc6a04af72764 # v1
316+ uses : erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1
239317 with :
240318 otp-version : ${{ env.OTP_VERSION }}
241319 rebar3-version : ${{ env.REBAR3_VERSION }}
320+
242321 - name : Build release
243322 run : |
244323 rebar3 as prod release
245324 rebar3 as prod tar
325+
246326 - name : Create GitHub Release
247327 uses : softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3
248328 with :
@@ -252,15 +332,16 @@ jobs:
252332 prerelease : false
253333 env :
254334 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
335+
255336 # ##########################################################################
256337 # Notify
257338 # ##########################################################################
258339 notify :
259340 name : Notify on Failure
260341 runs-on : ubuntu-latest
261- timeout-minutes : 15
262342 needs : [test, coverage, security, rsr-compliance]
263343 if : failure()
344+
264345 steps :
265346 - name : Notify failure
266347 run : |
0 commit comments