Skip to content

Commit

Permalink
Update CI for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
sdogruyol committed Sep 30, 2024
1 parent b820a1d commit 28c1b02
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 23 deletions.
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

14 changes: 2 additions & 12 deletions spec/helpers_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,7 @@ describe "Macros" do
response.status_code.should eq(200)

response.headers["Content-Type"].should eq("application/octet-stream")

{% if flag?(:windows) %}
response.headers["Content-Length"].should eq("19")
{% else %}
response.headers["Content-Length"].should eq("18")
{% end %}
response.headers["Content-Length"].should eq("18")
end

it "sends file with given path and given mime-type" do
Expand All @@ -125,12 +120,7 @@ describe "Macros" do
response = call_request_on_app(request)
response.status_code.should eq(200)
response.headers["Content-Type"].should eq("image/jpeg")

{% if flag?(:windows) %}
response.headers["Content-Length"].should eq("19")
{% else %}
response.headers["Content-Length"].should eq("18")
{% end %}
response.headers["Content-Length"].should eq("18")
end

it "sends file with binary stream" do
Expand Down
6 changes: 1 addition & 5 deletions spec/view_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ describe "Views" do
end
request = HTTP::Request.new("GET", "/view/world")
client_response = call_request_on_app(request)
{% if flag?(:windows) %}
client_response.body.strip.should eq("<html>Hello world\r\n</html>")
{% else %}
client_response.body.strip.should eq("<html>Hello world\n</html>")
{% end %}
client_response.body.strip.should eq("<html>Hello world\n</html>")
end

it "renders layout" do
Expand Down

0 comments on commit 28c1b02

Please sign in to comment.