ci.cr @ trunk
process
scale = 0.75 fontscale = 1.500 box wid 1.625 ht 0.340 with .nw at (0.035, -0.035) fill 0xCBD5E1 color 0xCBD5E1 box wid 1.625 ht 0.340 with .nw at (0.000, 0.000) fill 0x7C83E6 color 0x7C83E6 box wid 0.300 ht 0.065 rad 0.018 at (0.370, -0.022) fill 0xffffff color 0xffffff line from (0.140, 0.000) to (0.140, -0.340) color white line from (1.485, 0.000) to (1.485, -0.340) color white text "require 'process'" color white at (0.813, -0.170)→ /pikchrshow
crystal source
require "process"
json block
{
"kind": "require",
"name": "process",
"doc": null,
"children": []
}
yaml
scale = 0.75 fontscale = 1.500 box wid 1.379 ht 0.340 with .nw at (0.035, -0.455) fill 0xCBD5E1 color 0xCBD5E1 box wid 1.379 ht 0.340 with .nw at (0.000, -0.420) fill 0x7C83E6 color 0x7C83E6 box wid 0.300 ht 0.065 rad 0.018 at (0.370, -0.443) fill 0xffffff color 0xffffff line from (0.140, -0.420) to (0.140, -0.760) color white line from (1.239, -0.420) to (1.239, -0.760) color white text "require 'yaml'" color white at (0.690, -0.590)→ /pikchrshow
crystal source
require "yaml"
json block
{
"kind": "require",
"name": "yaml",
"doc": null,
"children": []
}
def run_step(name : String, command : String, args : Array(String)) : Nil
puts "==> #{name}"
status = Process.run(command, args: args, output: Process::Redirect::Inherit, error: Process::Redirect::Inherit)
exit(status.exit_code) unless status.success?
end
def shard_dependencies?(path : String) : Bool
deps = YAML.parse(File.read(path))["dependencies"]?
return false if deps.nil?
raw = deps.raw
raw.is_a?(Hash) ? !raw.empty? : true
end
if File.exists?("shard.yml")
if !shard_dependencies?("shard.yml")
puts "==> shards install --frozen (skipped: shard.yml declares no dependencies)"
elsif File.exists?("shard.lock")
run_step("shards install --frozen", "shards", ["install", "--frozen"])
else
puts "==> shards install --frozen (skipped: shard.yml declares dependencies but shard.lock is missing)"
end
end
run_step("crystal tool format --check", "crystal", ["tool", "format", "--check", "src", "spec", "ci.cr"])
run_step("crystal spec", "crystal", ["spec"])