Skip to content
Snippets Groups Projects
Commit 74c3397f authored by Z.J. van de Weg's avatar Z.J. van de Weg
Browse files

Improve fail message for test

parent c7d95f72
No related branches found
No related tags found
1 merge request!63WIP: Flatten further
Pipeline #
Loading
Loading
@@ -6,7 +6,13 @@ uri = URI.parse 'https://gitlab.com/api/v3/ci/lint'
Dir.glob("#{File.dirname(__FILE__)}/**/*.yml").each do |file|
response = Net::HTTP.post_form(uri, content: File.read(file))
 
file = file.match(/((\w|\+|#)+)\.gitlab-ci/)[1]
match = file.match(/(?<file>(\w|\+|#)+)\.gitlab-ci.yml/)
template_name = match ? match[:file] : nil
unless template_name
puts "Invalid file format for #{file}"
exit(1)
end
 
if JSON.parse(response.body)['status'] == 'valid'
puts "\e[32mvalid\e[0m: #{file}" # Color 'valid' green
Loading
Loading
@@ -17,5 +23,6 @@ Dir.glob("#{File.dirname(__FILE__)}/**/*.yml").each do |file|
end
 
# Given we test all the templates, the coverage is 100%, always. To showcase
# how this is done, we print it here.
puts "Coverage: 100%"
\ No newline at end of file
# how this is done, we print it here. The regex to parse this would be:
# /Coverage:\s(d+)%/
puts "Coverage: 100%"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment