Lines 84-89
sub new {
Link Here
|
84 |
}; |
84 |
}; |
85 |
|
85 |
|
86 |
if ( $self->{incremental_run} ) { |
86 |
if ( $self->{incremental_run} ) { |
|
|
87 |
|
88 |
my $codename = qx{lsb_release -s -c 2> /dev/null}; |
89 |
die "Cannot use increment runs if codename is not set (lsb_release not available?)" unless $codename; |
90 |
|
91 |
chomp $codename; |
92 |
|
87 |
unless ( $self->{test_name} ) { |
93 |
unless ( $self->{test_name} ) { |
88 |
my @caller_info = caller(); |
94 |
my @caller_info = caller(); |
89 |
my $script_filename = $caller_info[1]; |
95 |
my $script_filename = $caller_info[1]; |
Lines 92-104
sub new {
Link Here
|
92 |
$self->{test_name} =~ s|\..*$||g; |
98 |
$self->{test_name} =~ s|\..*$||g; |
93 |
} |
99 |
} |
94 |
|
100 |
|
|
|
101 |
$self->{test_dir} = sprintf "%s/%s", $self->{test_name}, $codename; |
102 |
|
95 |
if ( $self->{git_repo_dir} && $self->{repo_url} ) { |
103 |
if ( $self->{git_repo_dir} && $self->{repo_url} ) { |
96 |
unless ( -d $self->{git_repo_dir} ) { |
104 |
unless ( -d $self->{git_repo_dir} ) { |
97 |
qx{git clone $self->{repo_url} $self->{git_repo_dir}}; |
105 |
qx{git clone $self->{repo_url} $self->{git_repo_dir}}; |
98 |
} |
106 |
} |
99 |
qx{git -C $self->{git_repo_dir} fetch origin}; |
107 |
qx{git -C $self->{git_repo_dir} fetch origin}; |
100 |
|
108 |
|
101 |
make_path("$self->{git_repo_dir}/$self->{test_name}"); |
109 |
make_path("$self->{git_repo_dir}/$self->{test_dir}"); |
102 |
} |
110 |
} |
103 |
} |
111 |
} |
104 |
|
112 |
|
Lines 122-128
sub get_files_to_test {
Link Here
|
122 |
my $no_history; |
130 |
my $no_history; |
123 |
if ( $self->{incremental_run} ) { |
131 |
if ( $self->{incremental_run} ) { |
124 |
my @koha_commit_history = qx{git log --pretty=format:"%h"}; |
132 |
my @koha_commit_history = qx{git log --pretty=format:"%h"}; |
125 |
my @tested_commit_history = qx{ls $self->{git_repo_dir}/$self->{test_name}}; |
133 |
my @tested_commit_history = qx{ls $self->{git_repo_dir}/$self->{test_dir}}; |
126 |
chomp for @koha_commit_history, @tested_commit_history; |
134 |
chomp for @koha_commit_history, @tested_commit_history; |
127 |
if (@tested_commit_history) { |
135 |
if (@tested_commit_history) { |
128 |
my $last_build_commit = firstval { |
136 |
my $last_build_commit = firstval { |
Lines 131-137
sub get_files_to_test {
Link Here
|
131 |
} |
139 |
} |
132 |
@koha_commit_history; |
140 |
@koha_commit_history; |
133 |
if ($last_build_commit) { |
141 |
if ($last_build_commit) { |
134 |
@files = @{ from_json( read_file("$self->{git_repo_dir}/$self->{test_name}/$last_build_commit") ) }; |
142 |
@files = @{ from_json( read_file("$self->{git_repo_dir}/$self->{test_dir}/$last_build_commit") ) }; |
135 |
push @files, $dev_files->ls_files( $filetype, "$last_build_commit HEAD" ); |
143 |
push @files, $dev_files->ls_files( $filetype, "$last_build_commit HEAD" ); |
136 |
} else { |
144 |
} else { |
137 |
|
145 |
|
Lines 164-170
sub report_results {
Link Here
|
164 |
my $commit_id = qx{git rev-parse --short HEAD}; |
172 |
my $commit_id = qx{git rev-parse --short HEAD}; |
165 |
chomp $commit_id; |
173 |
chomp $commit_id; |
166 |
|
174 |
|
167 |
my $failure_file = "$self->{git_repo_dir}/$self->{test_name}/$commit_id"; |
175 |
my $failure_file = "$self->{git_repo_dir}/$self->{test_dir}/$commit_id"; |
168 |
my $failures = [ |
176 |
my $failures = [ |
169 |
sort map { |
177 |
sort map { |
170 |
my ( $file, $exit_code ) = ( $_, $results->{$_} ); |
178 |
my ( $file, $exit_code ) = ( $_, $results->{$_} ); |
Lines 175-181
sub report_results {
Link Here
|
175 |
write_file( $failure_file, to_json($failures) ); |
183 |
write_file( $failure_file, to_json($failures) ); |
176 |
|
184 |
|
177 |
qx{git -C $self->{git_repo_dir} add $failure_file}; |
185 |
qx{git -C $self->{git_repo_dir} add $failure_file}; |
178 |
qx{git -C $self->{git_repo_dir} commit -m "$commit_id - $self->{test_name}"}; |
186 |
qx{git -C $self->{git_repo_dir} commit -m "$commit_id - $self->{test_dir}"}; |
179 |
( my $push_domain = $self->{repo_url} ) =~ s{^https://}{}; |
187 |
( my $push_domain = $self->{repo_url} ) =~ s{^https://}{}; |
180 |
my $push_url = "https://gitlab-ci-token:$self->{token}\@$push_domain"; |
188 |
my $push_url = "https://gitlab-ci-token:$self->{token}\@$push_domain"; |
181 |
qx{git -C $self->{git_repo_dir} push $push_url main}; |
189 |
qx{git -C $self->{git_repo_dir} push $push_url main}; |