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

Create dart.yml #82

Closed
wants to merge 3 commits into from
Closed

Create dart.yml #82

wants to merge 3 commits into from

Conversation

domesticmouse
Copy link
Member

@domesticmouse domesticmouse commented Jan 8, 2021

Created per @kevmoo's request in #81 (comment)

Hey @RedBrogdon and @johnpryan,

I started porting the travis test set to Github Actions and I hit something of a head scratcher. I realised that our Travis tests purport to run tests on windows... using a shell script runner. Which makes almost no sense. Unless the Travis windows machines have cygwin or similar installed.

Note, the windows tests appear to pass, even though some of the tests are specifically written for linux only (and test for the presence of a generated .so file ... as opposed to the .dll or .dylib that should be created on Windows and macOS respectively.

@domesticmouse domesticmouse mentioned this pull request Jan 8, 2021
@mit-mit
Copy link
Member

mit-mit commented Jan 8, 2021

Thanks @domesticmouse! Can you please start by aligning with https://github.com/dart-lang/.github/blob/master/workflow-templates/test-package.yaml (there are some key differences, e.g. which setup task to use). @athomas fyi that Brett is looking at this repo.

@domesticmouse
Copy link
Member Author

@mit-mit I'm unsure how I can align this script with another package when the intent was to port the current test suite from Travis to Github Actions.

@athomas if you want to own this and move it forward, please do so. At this point I don't understand how the current Travis test suite actually worked.

@mit-mit
Copy link
Member

mit-mit commented Jan 10, 2021

My comment was to align on steps that are actually similar, e.g. use uses: dart-lang/setup-dart@v0.1 not uses: cedx/setup-dart@v2


steps:
- uses: actions/checkout@v2
- uses: cedx/setup-dart@v2
Copy link
Member

Choose a reason for hiding this comment

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

Prefer dart-lang/setup-dart@v0.1

Note that that will use channel instead of release-channel for the parameter.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

with:
release-channel: ${{ matrix.sdk }}

- name: Print Dart SDK version
Copy link
Member

Choose a reason for hiding this comment

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

Remove this step if you use dart-lang/setup-dart it will print the version it selects already in setup-dart.

Copy link
Member Author

Choose a reason for hiding this comment

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

and done.

- name: Print Dart SDK version
run: dart --version

- name: "PKGS: command_line, extension_methods, ffi/hello_world, ffi/primitives, ffi/structs, ffi/system-command, native_app; TASKS: `dartanalyzer --fatal-infos --fatal-warnings .`"
Copy link
Member

Choose a reason for hiding this comment

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

You may want to move analysis and formatting to their own job (it doesn't need to run on all OS'es and can run before all other jobs). See https://github.com/dart-lang/.github/blob/master/workflow-templates/test-package.yaml#L15

- name: Print Dart SDK version
run: dart --version

- name: "PKGS: command_line, extension_methods, ffi/hello_world, ffi/primitives, ffi/structs, ffi/system-command, native_app; TASKS: `dartanalyzer --fatal-infos --fatal-warnings .`"
Copy link
Member

Choose a reason for hiding this comment

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

Consider switching to dart analyze --fatal-infos, which should do the same as the legacy command you're currently using (--fatal-warnings is enabled by default in dart analyze).

PKGS: "command_line extension_methods ffi/hello_world ffi/primitives ffi/structs ffi/system-command native_app"
run: ./tool/travis.sh dartanalyzer

- name: "PKGS: command_line, extension_methods, ffi/hello_world, ffi/primitives, ffi/structs, ffi/system-command, native_app; TASKS: `dartfmt -n --set-exit-if-changed .`"
Copy link
Member

Choose a reason for hiding this comment

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

Consider switching to dart format --output=none --set-exit-if-changed ., which should do the same as the legacy command you're currently using.

PKGS: "command_line extension_methods ffi/hello_world ffi/primitives ffi/structs ffi/system-command native_app"
run: ./tool/travis.sh dartanalyzer

- name: "PKGS: command_line, extension_methods, ffi/hello_world, ffi/primitives, ffi/structs, ffi/system-command, native_app; TASKS: `dartfmt -n --set-exit-if-changed .`"
Copy link
Member

Choose a reason for hiding this comment

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

Consider running this even if analysis fails, because it's annoying to fix all your analysis errors only to discover that there is also a formatting error, see:
https://github.com/dart-lang/.github/blob/master/workflow-templates/test-package.yaml#L34

PKGS: "command_line extension_methods ffi/hello_world ffi/primitives ffi/structs ffi/system-command native_app"
run: ./tool/travis.sh dartfmt

- name: "PKG: command_line, extension_methods, ffi/hello_world, ffi/primitives; TASKS: `pub run test`"
Copy link
Member

Choose a reason for hiding this comment

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

Consider switching to dart test.

@athomas
Copy link
Member

athomas commented Jan 11, 2021

I started porting the travis test set to Github Actions and I hit something of a head scratcher. I realised that our Travis tests purport to run tests on windows... using a shell script runner. Which makes almost no sense. Unless the Travis windows machines have cygwin or similar installed.

Not sure about travis, but GitHub Actions uses the bash shell coming with the Git installer for Windows. Most CI systems will install git that way and add it to the path, therefore having a bash executable even on Windows.

@domesticmouse
Copy link
Member Author

I started porting the travis test set to Github Actions and I hit something of a head scratcher. I realised that our Travis tests purport to run tests on windows... using a shell script runner. Which makes almost no sense. Unless the Travis windows machines have cygwin or similar installed.

Not sure about travis, but GitHub Actions uses the bash shell coming with the Git installer for Windows. Most CI systems will install git that way and add it to the path, therefore having a bash executable even on Windows.

Screen Shot 2021-01-12 at 9 19 56 am

That doesn't look like bash. And it should fail.

@domesticmouse
Copy link
Member Author

Hey @johnpryan, I suspect I'm doing this backwards. Do you have some input on how we should do this?

@kevmoo does mono_repo support github actions?

@johnpryan
Copy link
Collaborator

Yeahmono_repo supports actions - I have an branch here, but it might be out of date.

@domesticmouse
Copy link
Member Author

@johnpryan given you have a mono_repo based update that should handle this, I'm guessing I can close out this PR and let you land your change?

@athomas
Copy link
Member

athomas commented Jan 12, 2021

I started porting the travis test set to Github Actions and I hit something of a head scratcher. I realised that our Travis tests purport to run tests on windows... using a shell script runner. Which makes almost no sense. Unless the Travis windows machines have cygwin or similar installed.

Not sure about travis, but GitHub Actions uses the bash shell coming with the Git installer for Windows. Most CI systems will install git that way and add it to the path, therefore having a bash executable even on Windows.

Screen Shot 2021-01-12 at 9 19 56 am

That doesn't look like bash. And it should fail.

Yes, powershell is the default shell on windows for GitHub Actions, but bash is available: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell

That it works from powershell indicates the .sh extension is associated with some shell (probably sh). Though I haven't found any documentation that says it is. Requesting bash for the travis.sh steps is probably the best option.

@johnpryan
Copy link
Collaborator

Opening #83

@kevmoo kevmoo deleted the domesticmouse-patch-1 branch February 10, 2021 04:56
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

4 participants