Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows support MVP #690

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.cr text eol=lf
*.ecr text eol=lf
47 changes: 41 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,66 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
crystal: [latest, nightly]
runs-on: ${{ matrix.os }}

steps:
- name: Install Crystal
uses: oprypin/install-crystal@v1
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal }}

- name: Download source
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install dependencies
run: shards install
env:
SHARDS_OPTS: --ignore-crystal-version

- name: Run specs
run: |
crystal spec
crystal spec --release --no-debug

format:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
crystal: [latest, nightly]
runs-on: ${{ matrix.os }}

steps:
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal }}

- name: Download source
uses: actions/checkout@v4

- name: Check formatting
run: crystal tool format --check

ameba:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
crystal: [latest]
runs-on: ${{ matrix.os }}

steps:
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal }}

- name: Download source
uses: actions/checkout@v4

- name: Install dependencies
run: shards install

- name: Run ameba linter
run: bin/ameba

1 change: 1 addition & 0 deletions spec/helpers_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ describe "Macros" do
request = HTTP::Request.new("GET", "/")
response = call_request_on_app(request)
response.status_code.should eq(200)

response.headers["Content-Type"].should eq("application/octet-stream")
response.headers["Content-Length"].should eq("18")
end
Expand Down
9 changes: 7 additions & 2 deletions spec/run_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@ describe "Run" do
Kemal.config.env = "test"
Kemal.run do |config|
server = config.server.not_nil!
server.bind_tcp "127.0.0.1", 3000, reuse_port: true
server.bind_tcp "0.0.0.0", 3001, reuse_port: true

{% if flag?(:windows) %}
server.bind_tcp "127.0.0.1", 3000
{% else %}
server.bind_tcp "127.0.0.1", 3000, reuse_port: true
server.bind_tcp "0.0.0.0", 3001, reuse_port: true
{% end %}
end
CR
end
Expand Down
2 changes: 1 addition & 1 deletion src/kemal/config.cr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Kemal
VERSION = {{ `shards version #{__DIR__}`.chomp.stringify }}
VERSION = {{ `shards version "#{__DIR__}"`.chomp.stringify }}

# Stores all the configuration options for a Kemal application.
# It's a singleton and you can access it like.
Expand Down
2 changes: 1 addition & 1 deletion src/kemal/static_file_handler.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module Kemal
return
end

expanded_path = File.expand_path(request_path, "/")
expanded_path = request_path
sdogruyol marked this conversation as resolved.
Show resolved Hide resolved
is_dir_path = if original_path.ends_with?('/') && !expanded_path.ends_with? '/'
expanded_path = expanded_path + '/'
true
Expand Down