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

Test Windows CI #657

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Test Windows CI #657

wants to merge 6 commits into from

Conversation

mamantoha
Copy link
Contributor

This was just a test for Windows CI

Finished in 49.14 seconds
121 examples, 13 failures, 16 errors, 0 pending

@mamantoha
Copy link
Contributor Author

mamantoha commented Apr 18, 2023

to fix the check_ameba workflow go to Setting -> Actions -> General and check "Read and write permissions"

image

@sdogruyol
Copy link
Member

Thanks a lot @mamantoha 👍 Could you please tell me why do we need the permissions for ameba

@mamantoha
Copy link
Contributor Author

@sdogruyol I don't know why https://github.com/crystal-ameba/github-action requires write permissions

@sdogruyol
Copy link
Member

@mamantoha that's already enabled, do I need to do anything else?

@mamantoha
Copy link
Contributor Author

@sdogruyol I don't understand why check_ameba fails. It works fine on my fork.

@sdogruyol
Copy link
Member

Just reran the workflow and it failed with the same error. Not sure what's wrong with permissions 🤷

Copy link
Contributor

@straight-shoota straight-shoota left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to get Windows support merged.
On the code side the only relevant change is Process.on_interrupt - and that is direly needed. Maybe this could be merged on its own if CI needs more time?

Comment on lines 41 to 42
- name: Check formatting
run: crystal tool format --check
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails on Windows, not sure why. It works fine locally.
I would suggest to disable this spec on windows. Actually, it only needs to execute once - the expected result is the same on any runner (if: matrix.os == 'ubuntu-latest' && matrix.crystal == 'nightly')

Comment on lines +44 to +55
check_ameba:
runs-on: ubuntu-latest
steps:
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
- name: Check out repository code
uses: actions/checkout@v3
- name: Crystal Ameba Linter
id: crystal-ameba
uses: crystal-ameba/github-action@v0.7.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The action seems to be broken (ref https://github.com/kemalcr/kemal/actions/runs/5443532334/jobs/9900164974?pr=657). So better exclude that from this PR. It's not necesary for Windows support.

@HertzDevil
Copy link

The Kemal::StaticFileHandler specs are failing because of this part:

expanded_path = File.expand_path(request_path, "/")
is_dir_path = if original_path.ends_with?('/') && !expanded_path.ends_with? '/'
expanded_path = expanded_path + '/'
true
else
expanded_path.ends_with? '/'
end
file_path = File.join(@public_dir, expanded_path)

Both @public_dir and expanded_path contain the drive name, so file_path becomes something like C:\...\C:\.... Replacing the first line with just expanded_path = request_path makes all specs pass. I have not dug far enough to understand if the File.expand_path call has any significance on other platforms.

@straight-shoota
Copy link
Contributor

StaticFileHandler probably just needs to be aligned with stdlib's implementation.

@HertzDevil
Copy link

That part in stdlib is:

    request_path = Path.posix(request_path)
    expanded_path = request_path.expand("/")

    file_path = @public_dir.join(expanded_path.to_kind(Path::Kind.native))

@mamantoha
Copy link
Contributor Author

Hi @HertzDevil @straight-shoota I don't have a Windows environment to test this build locally. Can someone else take over and continue working on this pull request? Thank you.


development_dependencies:
ameba:
github: crystal-ameba/ameba
version: ~> 1.4.0
branch: master
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be reverted, I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants