Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
322 commits
Select commit Hold shift + click to select a range
b028426
support package
Nfsaavedra Aug 14, 2024
873cbba
support all package states
Nfsaavedra Aug 15, 2024
d737382
support services
Nfsaavedra Aug 15, 2024
cfd79a4
change filesystem state
Nfsaavedra Aug 16, 2024
cbe2ef3
remove unused attributes from package, service and user
Nfsaavedra Aug 19, 2024
43c57a0
rename filesystem state to system state
Nfsaavedra Aug 19, 2024
3a1fbc8
fix tests
Nfsaavedra Aug 19, 2024
a9fca63
simplify delta p by adding PAttr construct
Nfsaavedra Aug 19, 2024
95f06f2
fix tests
Nfsaavedra Aug 20, 2024
a7c2c5b
wip: support enable services
Nfsaavedra Aug 23, 2024
6f8ef0d
normalization visitor
Nfsaavedra Aug 23, 2024
102698b
refactor apply patch
Nfsaavedra Aug 23, 2024
953387d
fix enable service in Chef. refactor normalization of attributes
Nfsaavedra Aug 23, 2024
649bb6c
allow fix of undefined variables
Nfsaavedra Aug 26, 2024
8800017
add tests for link
Nfsaavedra Aug 26, 2024
6d98773
remove default values. fix delta p tests
Nfsaavedra Aug 28, 2024
5c383ce
small fix
Nfsaavedra Aug 28, 2024
c28fa7d
fix timeout
Nfsaavedra Aug 29, 2024
84da501
fix bug
Nfsaavedra Aug 29, 2024
5f75a85
small hack
Nfsaavedra Aug 29, 2024
9ec8e01
fix disable alarm
Nfsaavedra Sep 2, 2024
df50f0e
support duplicate atomic units
Nfsaavedra Sep 2, 2024
602f3c1
fix error when there are no attributes
Nfsaavedra Sep 3, 2024
a6b5df2
fix problem with multilines
Nfsaavedra Sep 3, 2024
d00997d
hack
Nfsaavedra Sep 3, 2024
9f397e7
fix issue repairing unsupported exprs
Nfsaavedra Sep 3, 2024
f50a622
remove print
Nfsaavedra Sep 3, 2024
9a75007
fix timeout for the millionth time
Nfsaavedra Sep 4, 2024
c9e2222
support partial system states
Nfsaavedra Sep 4, 2024
024cd18
fix problem with bools
Nfsaavedra Sep 5, 2024
52f2228
fix problems in intermediate representation
Nfsaavedra Sep 5, 2024
68b46b0
allow to fix booleans
Nfsaavedra Sep 6, 2024
074d635
allow unsupported attributes in repair
Nfsaavedra Sep 6, 2024
ec292d8
Revert "allow unsupported attributes in repair"
Nfsaavedra Sep 6, 2024
5219473
support yum, apt in Ansible and link in Chef
Nfsaavedra Sep 11, 2024
6614b61
small fix
Nfsaavedra Oct 24, 2024
2dc8b63
WIP: refactor Terraform parser
Nfsaavedra Oct 25, 2024
dd34f29
WIP: refactor Terraform parser, fix some more tests
Nfsaavedra Oct 30, 2024
d2a7d77
WIP: refactor Terraform parser, fix some more tests
Nfsaavedra Nov 5, 2024
6b7ae0a
refactor Terraform parser, fix all tests, support interpolation
Nfsaavedra Nov 6, 2024
6344ee3
change version of python-hcl2
Nfsaavedra Nov 6, 2024
9ad79df
terraform: support operations
Nfsaavedra Nov 7, 2024
a2b85c1
Small fixes to interactive repair loop
Nfsaavedra Nov 11, 2024
73a6e05
terraform: support conditional
Nfsaavedra Nov 14, 2024
0894a21
terraform: support function call
Nfsaavedra Nov 14, 2024
8c80e1c
add typing_extensions to poetry. fix test
Nfsaavedra Nov 15, 2024
91c847e
terraform: support function calls without arguments
Nfsaavedra Nov 15, 2024
01d5cfb
terraform: fix problem with string interpolation parsing
Nfsaavedra Nov 15, 2024
f2a0a85
terraform: fix problem when content is the name of an attribute
Nfsaavedra Nov 15, 2024
db61d90
terraform: fix issue in object_elem
Nfsaavedra Nov 15, 2024
2aac772
terraform: support for locals
Nfsaavedra Nov 15, 2024
7a1d7dc
update poetry lock
Nfsaavedra Nov 15, 2024
8b6d424
Refactor Delta P compiler. terraform: support aws_s3_bucket, aws_inst…
Nfsaavedra Nov 18, 2024
72ad13b
Refactor sketched info. ansible: support s3 bucked
Nfsaavedra Nov 18, 2024
0939cc5
ansible: support iam role
Nfsaavedra Nov 18, 2024
4a9aba4
terraform,ansible: add acl attribute to aws bucket
Nfsaavedra Nov 19, 2024
af949c1
dejavu: fix handling of unsupported expressions
Nfsaavedra Nov 20, 2024
dcecb49
add memory limit to solver
Nfsaavedra Nov 21, 2024
6e65114
dejavu: refactor to use Z3 through the command-line
Nfsaavedra Nov 22, 2024
eb7e164
dejavu: add memory limit and timeout using timeout and ulimit
Nfsaavedra Nov 22, 2024
cf3bcf7
WIP: fixing terraform smells
Nfsaavedra Jan 20, 2025
e911991
WIP: fixing terraform smells
Nfsaavedra Jan 22, 2025
742b97b
remove tests and fix hierarchical vars puppet
Nfsaavedra Jan 31, 2025
9aa0971
black
Nfsaavedra Jan 31, 2025
596d610
small fix
Nfsaavedra Mar 20, 2025
d251a0f
small fix
Nfsaavedra Mar 20, 2025
a08797f
rename repair framework
Nfsaavedra Mar 21, 2025
2a038ac
fix on terraform.py
sfondev Mar 21, 2025
5b86584
Merge pull request #61 from sfondev/small_terraform_parser_fix
Nfsaavedra Mar 26, 2025
8c14d6c
fix: handling of AddArgs in Chef
Nfsaavedra Nov 4, 2025
e9154d8
fix: strings without quotes in Puppet
Nfsaavedra Nov 4, 2025
80a35c0
fix: missing statements in conditionals
Nfsaavedra Nov 6, 2025
59d05ec
fix: temporary handling of Chaining in Puppet
Nfsaavedra Nov 7, 2025
3c71bfa
fix: line of conditions in case statements
Nfsaavedra Nov 10, 2025
cfac8b4
fix: do blockes inside atomic units in Chef
Nfsaavedra Nov 10, 2025
dda0a77
fix: handling of method_add_block in Chef
Nfsaavedra Nov 11, 2025
7cc5ca2
fix: handling of brace_block in Chef
Nfsaavedra Nov 11, 2025
cb20612
fix: add handling of Pow in Jinja2 for YAML
Nfsaavedra Nov 11, 2025
9c2e030
feat: add is_top to ConditionalStatements
Nfsaavedra Nov 11, 2025
a91ef14
fix: allow statements inside atomic units
Nfsaavedra Nov 13, 2025
f322c20
fix: issue with filters in Jinja expressions
Nfsaavedra Dec 2, 2025
8a54a1a
fix: issue with jinja expressions without quotes
Nfsaavedra Dec 2, 2025
2b64200
fix: boolean parsing
Nfsaavedra Dec 2, 2025
d2e2bf0
feat: add Undef
Nfsaavedra Dec 2, 2025
f3d437f
design(tests): Corrected classes anmes and called lint
DanielMatiasCarvalho Nov 25, 2025
8a7544a
rego(engine): Improved error handling in case there is nothing to run
DanielMatiasCarvalho Nov 25, 2025
e323ee3
rego(engine): Added BlockExpr and better assert messages
DanielMatiasCarvalho Nov 25, 2025
2eed683
chore: Moved AddArgs to inter.py
DanielMatiasCarvalho Nov 25, 2025
2c5d317
rego(engine): Added AddArgs construction
DanielMatiasCarvalho Nov 25, 2025
37e3bdf
fix: Commented susp_comm in visitor
DanielMatiasCarvalho Nov 26, 2025
5e25a07
rego(sec_hard_pass): Removed empty string from being hardcoded passwords
DanielMatiasCarvalho Nov 26, 2025
cba826e
tests(def_admin): Removed double smell for hard_secr
DanielMatiasCarvalho Nov 26, 2025
c8167c0
tests(missing_default): Changed code line to coincide with case keyword
DanielMatiasCarvalho Nov 26, 2025
6c545a5
tests(hard_secr): Removed double smells and corrected test file for a…
DanielMatiasCarvalho Nov 26, 2025
2dab02f
tests(missing_default): Corrected puppet lines
DanielMatiasCarvalho Nov 26, 2025
e58952a
glitchlib: Added VariableReference to traverse
DanielMatiasCarvalho Nov 26, 2025
c705dc4
tests(empty pass): Corrected line in ansible empty password test
DanielMatiasCarvalho Nov 26, 2025
7fdfdc0
refactor: changed __repr__ of atomic unit
DanielMatiasCarvalho Nov 26, 2025
101a3a9
rego(invalid_bind): Changed invalid_bind query to use more specific t…
DanielMatiasCarvalho Nov 27, 2025
39b1bfb
fix(rego): Corrected path used in queries
DanielMatiasCarvalho Nov 27, 2025
48f4d72
fix(rego): Limited types for possible values in admin by default query
DanielMatiasCarvalho Nov 27, 2025
a245b0f
fix(rego): Normalized urls when in Sum and have breakage
DanielMatiasCarvalho Nov 27, 2025
f6ff47b
fix(tests): Corrected lines in tests
DanielMatiasCarvalho Nov 27, 2025
3e062b7
rego(library): Added traversal to function call
DanielMatiasCarvalho Nov 28, 2025
5d36f0d
rego(Weak_crypt): Added alternative paths to find the error
DanielMatiasCarvalho Nov 28, 2025
ee690b4
rego(hard_secr): Lowered strings so regex can work
DanielMatiasCarvalho Nov 28, 2025
496eb8e
fix(rego): Added to possible null code values
DanielMatiasCarvalho Dec 2, 2025
30b12b0
chore(rego): Cleaned up redudant code in hard_secr
DanielMatiasCarvalho Dec 2, 2025
3a825d2
feat: added CLI flags for rego integration
racoelhosilva Aug 26, 2025
ae82d0b
fix: added new flags to lint function parameters
DanielMatiasCarvalho Aug 26, 2025
cfedabc
rego: Implemented control flow if rego_engine=True to call rego engin…
DanielMatiasCarvalho Aug 26, 2025
b7fdff6
feat: implemented simple rego engine structure
racoelhosilva Aug 27, 2025
36fa455
rego: Added default config in json, some security rego queries and re…
DanielMatiasCarvalho Aug 27, 2025
025ef4d
feat: added rego library in go
racoelhosilva Aug 27, 2025
b739334
feat: implemented initial version of engine and wrapper for library
racoelhosilva Aug 27, 2025
e23adf4
CodeElement and Error: Implemented serialization from JSON string to …
DanielMatiasCarvalho Aug 28, 2025
c8aa84a
config: Changed way to acess config files for Rego to not break when …
DanielMatiasCarvalho Sep 3, 2025
9976dac
fix: Changed the way rego library acesses UnitBlocks
DanielMatiasCarvalho Sep 3, 2025
1757a68
feat(engine): Added logic for loading separately design and security …
racoelhosilva Sep 10, 2025
3a8f164
feat(engine): Improved extensiblity and error checking
racoelhosilva Sep 10, 2025
32c249f
fix: Removed hardcoded config in future execution, and added a flow t…
DanielMatiasCarvalho Sep 12, 2025
09a2517
rego_lib: Updated regex to be case insensitive
DanielMatiasCarvalho Sep 21, 2025
4d7a64e
python package: Changed directory structure and code so rego wrapper …
DanielMatiasCarvalho Sep 28, 2025
5f169ec
fix: Changed directory structure for the library
DanielMatiasCarvalho Sep 30, 2025
fe5ac7b
workflow: Create binaries
DanielMatiasCarvalho Sep 30, 2025
b3ed4b8
fix: Changed library and workflow
DanielMatiasCarvalho Sep 30, 2025
c3021d1
fix: changed upload-artifact version
DanielMatiasCarvalho Sep 30, 2025
b18086a
fix: Changed go version to the latest stable version
DanielMatiasCarvalho Oct 1, 2025
8936d5e
fix: removed cache warning
DanielMatiasCarvalho Oct 1, 2025
eaece0a
workflow: Added capability of building and uploading rego-python pack…
DanielMatiasCarvalho Oct 1, 2025
4f8e671
pyproject: changed configurations
DanielMatiasCarvalho Oct 1, 2025
0e3b656
fix: Added merge_mutiple, to avoid artifacts creating extra folders
DanielMatiasCarvalho Oct 1, 2025
e668792
release: Created release package workflow
DanielMatiasCarvalho Oct 1, 2025
614ece2
fix: Write acess credentials to create tags
DanielMatiasCarvalho Oct 1, 2025
0ddf735
fix: Avoid creating .zip and .tar files of GLITCH code
DanielMatiasCarvalho Oct 1, 2025
9b215be
fix: Corrected file path
DanielMatiasCarvalho Oct 1, 2025
8de40a0
queries: Updated rego library and added new queries
DanielMatiasCarvalho Oct 10, 2025
1c29749
fix: Changed rego output processing to consider a list and list of lists
DanielMatiasCarvalho Oct 10, 2025
3030808
query: added http without tls (simple version) and empty password (ch…
racoelhosilva Oct 16, 2025
1c1ae0d
fix: removed print
DanielMatiasCarvalho Oct 17, 2025
d1c83af
query: Updated Admin by default to consider Hashes
DanielMatiasCarvalho Nov 4, 2025
1bba512
engine: Changed rego engine to create a KeyValue for a key value hash…
DanielMatiasCarvalho Nov 4, 2025
d426aa1
fix: Fixed FunctionCall in rego engine to consider anonymous function…
DanielMatiasCarvalho Nov 5, 2025
bc05efb
fix: Added capability to add ElementInfo to a constructed Comment of IR
DanielMatiasCarvalho Nov 5, 2025
e14b165
fix: Updated http_without_tls query
DanielMatiasCarvalho Nov 6, 2025
9343f03
fix(security query): Fixed admin_by_default so it works for multiple …
DanielMatiasCarvalho Nov 6, 2025
b732de8
fix: Updated empty password to consider Null nodes
DanielMatiasCarvalho Nov 6, 2025
5250aae
fix: changed chef parser to create null node for nil case
DanielMatiasCarvalho Nov 7, 2025
f6aa53d
fix: Added null_values to security data
DanielMatiasCarvalho Nov 7, 2025
1db4edb
feat: added info to constructor of ConditionalStatement
racoelhosilva Nov 7, 2025
5589a66
repr: Implemented as_dict for Function Call and Unary Operations
DanielMatiasCarvalho Nov 7, 2025
6a7a57c
fix: Updated rego engine and integrity check query
DanielMatiasCarvalho Nov 7, 2025
03bcdfe
fix: Chnaged name detection in weak crypt to consider just strings
DanielMatiasCarvalho Nov 10, 2025
95d9b33
fix: Changed hardcoded queries to consider nested hashes
DanielMatiasCarvalho Nov 10, 2025
e72165e
fix: Added misc_secr and sensitive data to hardcoded secret and hardc…
DanielMatiasCarvalho Nov 10, 2025
3fa33b4
fix: Removed emitted errors without path and implemented misc_secrets…
DanielMatiasCarvalho Nov 11, 2025
13dba90
chore: removed unecessary flag
DanielMatiasCarvalho Nov 11, 2025
8b85b83
fix: Changed constructor of ConditionStatement in rego engine
DanielMatiasCarvalho Nov 11, 2025
f18bfd3
fix: Handled BlockExpr cases in rego
DanielMatiasCarvalho Nov 12, 2025
8976d36
fix: Added null check in hard_secr rego query
DanielMatiasCarvalho Nov 13, 2025
e56f63d
feat: completed missing default queries
racoelhosilva Nov 13, 2025
594f19a
fix(rego): Added certain types of values to be checked by hardcoded q…
DanielMatiasCarvalho Nov 13, 2025
a0623a1
feat: updated rego file names to match error keys
racoelhosilva Nov 19, 2025
5d44748
feat: updated config passing to load ini and json config
racoelhosilva Nov 19, 2025
672e666
feat: improved analyse separation (still not complete)
racoelhosilva Nov 19, 2025
f77868e
fix: Fixed type warnings in Rego engine
DanielMatiasCarvalho Nov 19, 2025
719feb9
Design: Created a map between SmellCheckers and its errors.
DanielMatiasCarvalho Nov 19, 2025
6474580
Security: Added a dict to map between smell checkers and errors for s…
DanielMatiasCarvalho Nov 19, 2025
4dbc4e3
Analyses: Completed complementary analyses
DanielMatiasCarvalho Nov 19, 2025
ce4179a
chore: Cleaned up unecessary code
DanielMatiasCarvalho Nov 19, 2025
0e4e8f9
refactor(tests): Rewrote security tests to have a common parent class
DanielMatiasCarvalho Nov 21, 2025
edf5a82
refactor: Rewrote design tests to have a common parent class
DanielMatiasCarvalho Nov 21, 2025
e213f58
chore: Moved tests to root and have a not working version of security…
DanielMatiasCarvalho Nov 25, 2025
e50c11e
chore: changed imports
DanielMatiasCarvalho Nov 25, 2025
1237032
chore: Changed imports
DanielMatiasCarvalho Nov 25, 2025
7f41c65
csv: Added header to the csv written
DanielMatiasCarvalho Nov 25, 2025
7b43087
fix: Changed writing csv header to only write once
DanielMatiasCarvalho Nov 25, 2025
08cba1c
security(test): Tests are running, however they are not passing since…
DanielMatiasCarvalho Nov 25, 2025
4dcf2ca
chore: Removed extra test csv
DanielMatiasCarvalho Nov 25, 2025
efef3ad
chore: Removed Parser_class from security tests
DanielMatiasCarvalho Nov 25, 2025
ab4fb15
fix(rego): Changed empty password query to use undef
DanielMatiasCarvalho Dec 2, 2025
3db99ca
docs(readme): Added explanation on how to build or use the binaries
DanielMatiasCarvalho Dec 2, 2025
b5afb5d
docs(fix): Annotated go language
DanielMatiasCarvalho Dec 2, 2025
660e80f
chore: cleaned up the code
DanielMatiasCarvalho Dec 3, 2025
83681a0
tests: Added a base test for security and design
DanielMatiasCarvalho Dec 3, 2025
0a6bc4e
fix(visitor): Changed imports and maps to inside the function
DanielMatiasCarvalho Dec 3, 2025
652330c
chore(config_rego): Removed config rego flag by doing conversion from…
DanielMatiasCarvalho Dec 3, 2025
09a70cd
fix(comment): Remove unecessary comment
DanielMatiasCarvalho Dec 4, 2025
edcf0d6
Merge pull request #67 from infragov-project/rego_integration
Nfsaavedra Dec 4, 2025
06df6f5
fix: mixed tests
Nfsaavedra Dec 4, 2025
229f168
fix: full permission and obsolete command
Nfsaavedra Dec 4, 2025
73d2859
chore: deprecate docker
Nfsaavedra Dec 4, 2025
0f5054e
feat: implemented design_avoid_comments query in Rego
racoelhosilva Jan 14, 2026
2d92745
feat: implemented design_imperative_abstraction
racoelhosilva Jan 14, 2026
4ffcca8
feat: implemented design_imperative_abstraction with Rego
racoelhosilva Jan 14, 2026
e91d420
feat: implementeed design_misplaced_attribute in Rego
racoelhosilva Jan 14, 2026
972f74b
feat: implemented design_multifaceted_abstraction in Rego
racoelhosilva Jan 14, 2026
bbe3a94
chore: added comment about replacement of imperative abstraction
racoelhosilva Jan 14, 2026
4df6ee9
feat: adapted IR to add number of lines in file for each unit block
racoelhosilva Jan 14, 2026
02241e1
feat: implemented implementation_too_many_variables in Rego
racoelhosilva Jan 14, 2026
58c2e43
feat: refactor function to glitch_lib
racoelhosilva Jan 14, 2026
aec0076
feat: enforce memory freeing after Rego calls
racoelhosilva Jan 27, 2026
660dacc
chore: update OPA dependency and bump rego_python version
racoelhosilva Jan 27, 2026
d585edf
hotfix: changed csv column order to put repr at the end, since it doe…
carlosfelgueiras Jan 28, 2026
b429baa
fix: minor changes in queries before merge
racoelhosilva Jan 29, 2026
0deaaa0
Implementation of Design Queries in Rego (#68)
Nfsaavedra Jan 29, 2026
7cd4cc6
chore: cleanup old security query files
racoelhosilva Jan 29, 2026
29d6f03
fix: update csv dump columns
racoelhosilva Jan 29, 2026
64e1143
Merge pull request #70 from infragov-project/security_cleanup
Nfsaavedra Jan 29, 2026
763e95f
chore: improve Rego instructions and force users to install Rego
Nfsaavedra Feb 3, 2026
ce5f5c4
chore: remove pyright errors from terraform analyses
Nfsaavedra Feb 3, 2026
6046f0b
fix: weak password key policy
Nfsaavedra Feb 3, 2026
8e45c66
fix: versioning
Nfsaavedra Feb 3, 2026
cce9b16
fix: dns without dnssec
Nfsaavedra Feb 3, 2026
19f4ae6
fix: replication
Nfsaavedra Feb 3, 2026
8ef5074
fix: public ip
Nfsaavedra Feb 3, 2026
0c06e6c
fix: integrity policy
Nfsaavedra Feb 3, 2026
4c91a6d
fix: https
Nfsaavedra Feb 4, 2026
492ac8c
fix: ssl tls
Nfsaavedra Feb 4, 2026
39674f4
fix: permission iam policies
Nfsaavedra Feb 4, 2026
b0154ae
fix: sensitive iam action
Nfsaavedra Feb 4, 2026
cdba988
fix: network policy
Nfsaavedra Feb 4, 2026
cd43028
fix: naming smell
Nfsaavedra Feb 4, 2026
23a4551
fix: missing encryptioN
Nfsaavedra Feb 4, 2026
d094b52
test: fixed cli test broken by #69
carlosfelgueiras Feb 4, 2026
dfb7234
Merge pull request #72 from carlosfelgueiras/cli-test-fix
Nfsaavedra Feb 4, 2026
94523c2
fix: logging
Nfsaavedra Feb 4, 2026
51f8c32
fix: access control
Nfsaavedra Feb 4, 2026
0cf05fa
fix: threats detection
Nfsaavedra Feb 4, 2026
7853da0
fix: key management
Nfsaavedra Feb 4, 2026
afe4c20
fix: firewall misconfig and refactor
Nfsaavedra Feb 5, 2026
d6e314c
fix: disabled authentication
Nfsaavedra Feb 5, 2026
75c6e11
fix: attached resource
Nfsaavedra Feb 5, 2026
f90b3c4
fix: hard secret terraform
Nfsaavedra Feb 5, 2026
be20d38
fix: invalid bind
Nfsaavedra Feb 5, 2026
cfea8b7
fix: invalid bind
Nfsaavedra Feb 5, 2026
1ef3395
fix: update vscode extension
Nfsaavedra Feb 5, 2026
ad31689
fix: pyright issues in main
Nfsaavedra Feb 5, 2026
aec3901
fix: rego python workflow
Nfsaavedra Feb 5, 2026
f8cae80
chore: bump vscode version and add workflow
Nfsaavedra Feb 5, 2026
159abd3
fix: vscode workflow
Nfsaavedra Feb 5, 2026
feadcb4
chore: bump glitch version to 2.0.0
Nfsaavedra Feb 5, 2026
ebb64f1
chore: black
Nfsaavedra Feb 5, 2026
5f294f8
chore: fix pyright issues
Nfsaavedra Feb 5, 2026
552e266
Merge branch 'main' into interactive_repair
Nfsaavedra Feb 5, 2026
29c037a
chore: fix black
Nfsaavedra Feb 5, 2026
0ea19ea
fix: tests workflow
Nfsaavedra Feb 5, 2026
0579604
fix: remove useless file
Nfsaavedra Feb 5, 2026
0a73bed
fix: tests workflow
Nfsaavedra Feb 5, 2026
2efd4dd
fix: issue with test in CI requiring TTY
Nfsaavedra Feb 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
python -m pip install -e .

- name: Run pyright
run: pyright
run: pyright glitch
188 changes: 188 additions & 0 deletions .github/workflows/rego_python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
name: rego-python

on:
push:
paths:
- ".github/workflows/rego-python.yml"
- "glitch/rego/rego_python/**"
workflow_dispatch:

permissions:
contents: write

jobs:
build-binaries:
name: Build Rego Python binaries
runs-on: ${{ matrix.os_runner }}
strategy:
matrix:
include:
# Linux
- os: linux
arch: amd64
os_runner: ubuntu-latest
- os: linux
arch: arm64
os_runner: ubuntu-24.04-arm

# macOS
- os: darwin
arch: amd64
os_runner: macos-15-intel
- os: darwin
arch: arm64
os_runner: macos-latest

# Windows
- os: windows
arch: amd64
os_runner: windows-latest
#- os: windows
# arch: arm64
# os_runner: windows-11-arm
# This fails the build because the runner is still limited
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 'stable'
cache-dependency-path: glitch/rego/rego_python/src/rego_python/go/go.sum

- name: Build binary
shell: bash
run: |
OS=${{ matrix.os }}
ARCH=${{ matrix.arch }}

# Determine file extension
if [ "$OS" = "windows" ]; then
EXT="dll"
elif [ "$OS" = "darwin" ]; then
EXT="dylib"
else
EXT="so"
fi

OUTPUT="../bin/librego-$OS-$ARCH.$EXT"
echo "Building $OUTPUT ..."

cd glitch/rego/rego_python/src/rego_python/go
GOOS=$OS GOARCH=$ARCH go build -o "$OUTPUT" -buildmode=c-shared regolib.go
rm -f ../bin/librego-*.h

- name: List bin folder
run: ls -l glitch/rego/rego_python/src/rego_python/bin/

- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: librego-${{ matrix.os }}-${{ matrix.arch }}
path: glitch/rego/rego_python/src/rego_python/bin/librego-${{ matrix.os }}-${{ matrix.arch }}.*
retention-days: 1

build-package:
name: Build Python package
runs-on: ubuntu-latest
needs: build-binaries

steps:
- uses: actions/checkout@v4

# Download all binary artifacts into bin/
- uses: actions/download-artifact@v4
with:
path: glitch/rego/rego_python/src/rego_python/bin
merge-multiple: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install build tools
run: |
python -m pip install --upgrade build twine

- name: Build wheel and sdist
working-directory: glitch/rego/rego_python
run: python -m build

- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: python-package
path: glitch/rego/rego_python/dist/*
retention-days: 1

release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: build-package

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Extract version and check if tag exists
id: get_version
run: |
VERSION=$(grep '^version = ' glitch/rego/rego_python/pyproject.toml | sed -E 's/version = "(.*)"/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version extracted: $VERSION"

TAG=rego_python-v$VERSION
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists, skipping release"
echo "tag_exists=true" >> $GITHUB_OUTPUT
else
echo "Tag $TAG does not exist, will create release"
echo "tag_exists=false" >> $GITHUB_OUTPUT
fi

- name: Create tag for release
if: steps.get_version.outputs.tag_exists == 'false'
run: |
git config user.name "rego_python-release-bot"
git config user.email "rego_python@users.noreply.github.com"
TAG=rego_python-v${{ steps.get_version.outputs.version }}
git tag $TAG
git push origin $TAG
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Download built package and binaries
if: steps.get_version.outputs.tag_exists == 'false'
uses: actions/download-artifact@v4
with:
path: release_assets
merge-multiple: true

- name: List downloaded assets
if: steps.get_version.outputs.tag_exists == 'false'
run: |
echo "Listing contents of release_assets directory:"
ls -lR release_assets

- name: Create GitHub Release
if: steps.get_version.outputs.tag_exists == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: "rego_python-v${{ steps.get_version.outputs.version }}"
name: "Rego Python v${{ steps.get_version.outputs.version }}"
files: |
release_assets/*.whl
release_assets/*.tar.gz
release_assets/*.so
release_assets/*.dylib
release_assets/*.dll
generate_release_notes: false
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

15 changes: 12 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ jobs:
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.4'
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 'stable'
cache-dependency-path: glitch/rego/rego_python/src/rego_python/go/go.sum
- name: Build Rego library
run: |
cd glitch/rego/rego_python/src/rego_python/go
GOOS=linux GOARCH=amd64 go build -o "../bin/librego-linux-amd64.so" -buildmode=c-shared regolib.go
rm -f ../bin/librego-*.h
- name: Install Python 3
uses: actions/setup-python@v4
with:
Expand All @@ -23,7 +33,6 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install -e .
python -m pip install pytest
- name: Run tests with pytest
run: |
cd glitch
python -m unittest discover tests
run: python -m pytest tests
59 changes: 59 additions & 0 deletions .github/workflows/vscode-extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Publish VSCode Extension

on:
push:
branches:
- main
- nuno/test/workflow
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
defaults:
run:
working-directory: vscode-extension/glitch
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Check if version changed
id: version-check
run: |
npm install -g @vscode/vsce

LOCAL_VERSION=$(node -p "require('./package.json').version")
PUBLISHER=$(node -p "require('./package.json').publisher")
NAME=$(node -p "require('./package.json').name")

MARKETPLACE_VERSION=$(vsce show "${PUBLISHER}.${NAME}" --json 2>/dev/null | node -p "JSON.parse(require('fs').readFileSync(0, 'utf8')).versions[0].version" 2>/dev/null || echo "0.0.0")

echo "local=$LOCAL_VERSION" >> $GITHUB_OUTPUT
echo "marketplace=$MARKETPLACE_VERSION" >> $GITHUB_OUTPUT

if [ "$LOCAL_VERSION" != "$MARKETPLACE_VERSION" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Local version ($LOCAL_VERSION) differs from marketplace ($MARKETPLACE_VERSION)"
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "Version unchanged ($LOCAL_VERSION)"
fi

- name: Install dependencies
if: steps.version-check.outputs.changed == 'true'
run: npm ci

- name: Compile extension
if: steps.version-check.outputs.changed == 'true'
run: npm run compile

- name: Publish to Visual Studio Marketplace
if: steps.version-check.outputs.changed == 'true'
run: npx vsce publish -p ${{ secrets.VSCE_PAT }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ __pycache__/

# C extensions
*.so
glitch/rego/go/library/librego.h
glitch/rego/rego_python/src/rego_python/bin/*

# Distribution / packaging
.Python
Expand Down Expand Up @@ -130,3 +132,4 @@ dmypy.json

out
errors
.vscode
Loading