-
Image of different coloured pipelines
-
Single-user continuous integration and continuous deployment. Integrates (merges changed repositories from combinations of changes), builds repositories that depend on these repositories and tests predicates implicated, where tests are in comments before each predicate.
-
Bottom-up Version: Lucian CI/CD can now check sets of repositories bottom-up, which means there are up to seven possible changes to a set of current predicates to find a working combination. Current predicates are each in depth-first, post-order, or sets of clauses or predicates involved in loops.
-
Other programming languages apart from Prolog aren't fully supported yet (even though the non-bottom-up version does).
Please read the following instructions on installing the project on your computer for automatic testing.
- Please download and install SWI-Prolog for your machine at
https://www.swi-prolog.org/build/
.
- Download:
- this repository and its dependencies
- List Prolog to Prolog Converter
- Download the LPPM Repository:
mkdir GitHub
cd GitHub/
git clone https://github.com/luciangreen/List-Prolog-Package-Manager.git
cd List-Prolog-Package-Manager
swipl
['lppm'].
lppm_install("luciangreen","luciancicd").
halt
-
In Shell:
cd luciancicd
swipl
-
To load the algorithm, enter:
['luciancicd.pl'].
-
To correct failures, it's important to run Lucian CI/CD on algorithms all at once or one predicate at a time with dependencies, and then perform necessary changes and run it again.
-
Lucian CI/CD is a necessary way to refactor, debug and point to debugging. Lucian CI/CD builds the algorithm with only parts supported by the tests. This method requires checking the code before is as complete as possible, the tests, the code afterwards and the algorithm's result.
-
In the folder
GitHub2
(specified insettings.pl
, not to be confused withGitHub
or the folder's name housing your GitHub repositories), store your repositories, e.g.b
. These folders contain Prolog (*.pl
) and other files. -
Learn Prolog with family.pl and search for Prolog tutorials. Examine the examples in luciancicdverify.pl and write examples to help test and debug algorithms. The following instructions will guide you to use Lucian CI/CD more easily.
-
Change the LPPM user (your GitHub username), the repositories, any omitted folders, the output folder,
fail_if_greater_than_n_changes1
(used to find more combinations of lines to test) and the time limit for running algorithms insettings.pl
. -
If necessary, modify tests in the Prolog files in the repositories, for example:
% remove_and_find_item_number([a,b,c],2,c,N2).
% N2 = 2.
% remove_and_find_item_number([a,b,b,c],2,c,N3).
% N3 = 3.
- Write a
main_file.txt
in the main folder of each repository, e.g.:
[
["c.pl",
[[c,2],[d,3]]
],
["c1.pl",
[[c1,2],[d1,3]]
]
]
-
contains the current main file in the repository and its possible main predicate names and arities (the number of arguments). Suppose a repository contains no main files to test; enter
[]
. -
Note: Dependencies are in
List-Prolog-Package-Manager/lppm_registry.txt
(LPPM) in the form[[User,Repository,Description,Dependencies], etc]
, e.g.
["luciangreen","Daily-Regimen","Scripts for daily meditation, bot prep, uni and breasoning.",
[
["luciangreen","listprologinterpreter"],
["luciangreen","Languages"],
["luciangreen","culturaltranslationtool"],
["luciangreen","Algorithm-Writer-with-Lists"],
["luciangreen","Text-to-Breasonings"],
["luciangreen","mindreader"]
]]
-
Lucian CI/CD only returns an overall successful result if all dependencies connected to a repository, their main files and predicates and each level in the bottom-up order successfully pass all tests for each predicate.
-
Lucian CI/CD works with:
- Prolog files
- Text data files
-
Check if
main_file.txt
contains all main files (files with main predicates) and main predicates. -
Please ensure that each repository set loads the necessary files.
-
set_up_luciancicd.
- Records time modified of repositories inrepositories_paths1//1
(fromsettings.pl
). I.e. it saves the files without testing them. -
luciancicd.
- Tests repositories with changed modification dates. Run before committing changes. -
For more info, see a Dev.to article about Lucian CI/CD.
-
Note: Once all tests are successful, the files in the temporary folder
../private2/luciancicd-testing/
are moved into the repository. To undo this, entermove_to_repository_or_back.
. -
Once the files are in the repository, you can commit the changes.
-
Note: A notification such as
"Cannot find "../private2/luciancicd-cicd-tests/tests_a.txt"
means the repository"a"
is connected with a changed file through dependencies, but Lucian CI/CD can't install it.
- To list available logs and diff files, enter
luciancicd_server(8000).
, then go tohttp://localhost:8000/luciancicd
.
-
Causes of the "1 or more tests failed." error include the first entered algorithm after deleting
Github_lc/tests_*x*.txt
not passing all tests. Programs with uninstantiated variables, etc, also cause the error. -
Writeln and commands that don't produce checkable output are not kept unless they are in
keep1/1
in thekeep.pl
register. -
Generated code currently loses (newline, etc.) formatting. Lucian CI/CD will pretty print the code later.
-
Increase N to a higher number in
fail_if_greater_than_n_changes1(N).
insettings.pl
(or thefail_if_greater_than_n_changes1 overrider
value inluciancicdverify.pl
to N in[Increase Max to,N]
in the log in tests) to improve performance. -
Before testing, Lucian CI/CD backs up
GitHub2o
andGithub_lc
ingh2_tmp2
andGitHub2
ingh2_tmp
(at the same level asGitHub
, seesettings.pl
). -
If there are problems with testing, remove the contents from
GitHub2
,GitHub_lc
andGitHub2o
.
-
Enter the command, e.g.
luciancicd
aftermain:-
inmain.pl
. -
In bash, compile Lucian CI/CD with
swipl --goal=main --stand_alone=true -o luciancicd -c luciancicd.pl
. -
In bash, run with
./luciancicd
.
- Running the tests
To run all tests, enter:
lc_test(NTotal,Score).
To run a specific test:
lc_test1(TestNumber,Passed).
where TestNumber is the test number from luciancicdverify.pl.
Lucian Green - Initial programmer - Lucian Academy
I licensed this project under the BSD3 License - see the LICENSE.md file for details