Skip to content

Commit

Permalink
Enable windows in github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
imdrasil committed Jul 1, 2024
1 parent 26dfe3d commit 8abb7a3
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .ameba.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Performance/MinMaxAfterMap:
Enabled: false
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
lint: true
- os: windows-latest

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

env:
TERM: xterm-256color
Expand All @@ -23,12 +28,14 @@ jobs:
uses: actions/checkout@v2

- name: Check formatting
if: ${{ matrix.lint }}
run: crystal tool format --check

- name: Install dependencies
run: shards install

- name: Run linter
if: ${{ matrix.lint }}
run: ./bin/ameba

- name: Setup environment
Expand Down
16 changes: 8 additions & 8 deletions examples/sam.cr
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,16 @@ end
namespace "db" do
namespace "schema" do
desc "just test"
task "load" do |t, args|
task "load" do |task, args|
puts args["f1"]
t.invoke("1")
t.invoke("schema:1")
t.invoke("db:migrate")
t.invoke("db:db:migrate")
t.invoke("db:ping")
t.invoke("din:dong")
task.invoke("1")
task.invoke("schema:1")
task.invoke("db:migrate")
task.invoke("db:db:migrate")
task.invoke("db:ping")
task.invoke("din:dong")
puts "------"
t.invoke("2", {"f2" => 1})
task.invoke("2", {"f2" => 1})
end

desc "1"
Expand Down
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ license: MIT
development_dependencies:
ameba:
github: crystal-ameba/ameba
version: "= 1.4.3"
version: "= 1.6.1"

scripts:
postinstall: "false | [ -f ../../sam.cr ] && true || cp -i examples/sam.template ../../sam.cr 2>/dev/null"
29 changes: 17 additions & 12 deletions spec/spec_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ end
def execute(command, options)
io = IO::Memory.new

status = Process.run("#{command} \"${@}\"", options, shell: true, output: io, error: io).exit_status
status =
{% if flag?(:win32) %}
Process.run("#{command} \"${@}\"", options, output: io, error: io)
{% else %}
Process.run("#{command} \"${@}\"", options, shell: true, output: io, error: io)
{% end %}.exit_status
{status, io.to_s}
end

Expand All @@ -40,16 +45,16 @@ end

namespace "db" do
namespace "schema" do
task "load" do |t, args|
task "load" do |task, args|
puts args["f1"]
t.invoke("1")
t.invoke("schema:1")
t.invoke("db:migrate")
t.invoke("db:db:migrate")
t.invoke("db:ping")
t.invoke("din:dong")
t.invoke("schema")
Container.add(t.path)
task.invoke("1")
task.invoke("schema:1")
task.invoke("db:migrate")
task.invoke("db:db:migrate")
task.invoke("db:ping")
task.invoke("din:dong")
task.invoke("schema")
Container.add(task.path)
end

task "1" do
Expand All @@ -58,9 +63,9 @@ namespace "db" do
end
end

task "with_argument" do |t, args|
task "with_argument" do |task, args|
puts args["f1"]
Container.add(t.path)
Container.add(task.path)
end

task "schema" do
Expand Down
4 changes: 2 additions & 2 deletions spec/task_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe Sam::Task do
it "accepts arg object" do
count = 0
namespace.task("t1") { |_, args| count += args["count"].as(Int32) }
namespace.task("t2") { |t, args| t.invoke("t1", args) }.call(Sam::Args.new({"count" => 2}))
namespace.task("t2") { |task, args| task.invoke("t1", args) }.call(Sam::Args.new({"count" => 2}))
count.should eq(2)
end

Expand Down Expand Up @@ -160,7 +160,7 @@ describe Sam::Task do
it "accepts arg object" do
count = 0
namespace.task("t1") { |_, args| count += args["count"].as(Int32) }
namespace.task("t2") { |t, args| t.execute("t1", args) }.call(Sam::Args.new({"count" => 2}))
namespace.task("t2") { |task, args| task.execute("t1", args) }.call(Sam::Args.new({"count" => 2}))
count.should eq(2)
end

Expand Down

0 comments on commit 8abb7a3

Please sign in to comment.