Skip to content

fixes #180 : Enable syntax highlight to all platform #352

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

Merged
merged 1 commit into from
Jan 15, 2018

Conversation

Geobert
Copy link
Contributor

@Geobert Geobert commented Jan 2, 2018

No description provided.

Cargo.toml Outdated
optional = true
default-features = false
default-features = true
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason you are enabling the default features of syntect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I admit it was kind of trials and errors here ^^' Not sure this one is needed.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks

Cargo.toml Outdated
dev = []
default = ["syntax-highlight"]
unstable = ["syntax-highlight"]
dev = ["syntax-highlight"]
Copy link
Member

Choose a reason for hiding this comment

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

Why specify it in dev and unstable? default should be sufficient

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't test with only default, I test now :)

Copy link
Member

Choose a reason for hiding this comment

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

Thanks

Cargo.toml Outdated
default = []
unstable = []
dev = []
default = ["syntax-highlight"]
Copy link
Member

Choose a reason for hiding this comment

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

The CI should do a test build with default features disabled.

Also, the CI should no longer explicitly call out syntax-highlight if its enabled by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I forgot to edit the CI scripts, going right now :)

Copy link
Member

Choose a reason for hiding this comment

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

Oh, missed the deploy script. Thanks for getting that. So just .travis.yml and appveyor.yml left?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

appveyor has no mention of the feature, I've changed travis :)

Copy link
Member

Choose a reason for hiding this comment

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

appveyor has no mention of the feature, I've changed travis :)

My concern is with us accidentally breaking the no-default build.

The CI should do a test build with default features disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hm, I don't know much about appveyor yet, what do you mean?

Copy link
Member

Choose a reason for hiding this comment

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

This is a Cargo feature and not an appveyor vs travis thing.

syntax-highlight is a default feature, meaning cargo will auto-add it to the build when calling cargo build. Users can disable this though, with --no-default-features. We should make sure we don't break the build when no features are enabled.

So its just a matter of adding to both CIs
cargo test --no-default-features.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see! :D I will add this after fixing appveyor :)

@epage
Copy link
Member

epage commented Jan 2, 2018

Thanks for owning this!

@Geobert
Copy link
Contributor Author

Geobert commented Jan 2, 2018

Shall we keep the gnu target in appveyor?

appveyor.yml Outdated
@@ -22,6 +22,7 @@ environment:
install:
- ps: >-
$Env:PATH += ';C:\msys64\usr\bin'
- if "%TARGET%" == "x86_64-pc-windows-msvc" call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64
Copy link
Member

Choose a reason for hiding this comment

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

You'll probably need to copy the rest of the setup for this from gutenberg
https://github.com/Keats/gutenberg/blob/master/appveyor.yml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, I'm trying to figure out what's wrong ^^ bear with me, it will be a git mess in the end x)

@Geobert
Copy link
Contributor Author

Geobert commented Jan 2, 2018

I don't get why appveyor is failing, cargo test runs perfectly fine on my computer :(

@epage
Copy link
Member

epage commented Jan 2, 2018

It seems like you made it the furthest when you had --target %TARGET passed to cargo.

@Geobert
Copy link
Contributor Author

Geobert commented Jan 2, 2018

with --target %TARGET it does not work on my computer :-/ I'm trying the os line which is present in gutenberg

@epage
Copy link
Member

epage commented Jan 2, 2018

with --target %TARGET it does not work on my computer :-/

How come --target x86_64-pc-windows-msvc fail on your computer?

@Geobert
Copy link
Contributor Author

Geobert commented Jan 2, 2018

Hm, it did failed but I think I forgot the call to the batch file… ^^' it works so I put back the --target

@Geobert
Copy link
Contributor Author

Geobert commented Jan 2, 2018

the cli tests are all failing, don't know why :(

@epage
Copy link
Member

epage commented Jan 2, 2018

My guess is that its something to do with the tempdir.

I'd recommend

  • Disabling travis within your branch (to be nicer to travis while you iterate)
  • Moving down to one appveyor target for now (to be nicer to appveyor while you iterate)
  • Try setting RUST_BACKTRACE to get more info.

@epage
Copy link
Member

epage commented Jan 2, 2018

Shall we keep the gnu target in appveyor?

Forgot to respond to this

This goes back to #99 for which I have no clue how important that target is within the rust ecosystem. Is there a reason you disabled it besides faster iteration?

@Geobert
Copy link
Contributor Author

Geobert commented Jan 2, 2018

how do we disable travis?

@epage
Copy link
Member

epage commented Jan 2, 2018

One option is to rename the file.

@Geobert
Copy link
Contributor Author

Geobert commented Jan 3, 2018

Ok I found what's going on: passing --target change the path of cobalt.exe from target/debug/cobalt to target/x86_64-pc-windows-msvc/debug/cobalt

I'm going to add an instruction in appveyor.yml to copy the exec file just under target and change the cli test to launch target/cobalt instead

@Geobert
Copy link
Contributor Author

Geobert commented Jan 3, 2018

Travis failed here because of https://travis-ci.org/cobalt-org/cobalt.rs/jobs/324590284#L578 (error while downloading rust)

It should work. How do we force a rebuild?

@epage
Copy link
Member

epage commented Jan 3, 2018

Ok I found what's going on: passing --target change the path of cobalt.exe from target/debug/cobalt to target/x86_64-pc-windows-msvc/debug/cobalt

Alternatively, we could use main_binary as long as we don't need extra features enabled (which these tests shouldn't need)

https://docs.rs/assert_cli/0.5.4/assert_cli/struct.Assert.html#method.main_binary

appveyor.yml Outdated
@@ -9,29 +11,39 @@ environment:

matrix:
# Stable channel
- TARGET: x86_64-pc-windows-gnu
#- TARGET: x86_64-pc-windows-gnu
Copy link
Member

Choose a reason for hiding this comment

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

Whats the status of re-enabling this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is does not compile, failing on miniz

@epage
Copy link
Member

epage commented Jan 3, 2018

Things remaining

  • Consider using main_binary
  • window-gnu?
  • running tests with default features disabled

And then once all looks good on that, cleaning up commits.

@Geobert
Copy link
Contributor Author

Geobert commented Jan 3, 2018

  • What is main_binary?
  • I'm for abandoning gnu target, what's the point if we support Windows through MSVC?
  • oh yeah forgot about this, I'll tackle this tomorrow :)

@epage
Copy link
Member

epage commented Jan 3, 2018

What is main_binary?

main_binary is feature in assert_cli that will find the binary for you.

I'm for abandoning gnu target, what's the point if we support Windows through MSVC?

grumble Ok.

@Geobert
Copy link
Contributor Author

Geobert commented Jan 3, 2018

replacing all command by main_binary and moving the parameters into with_args(&[…]) makes two tests to fail, only 2 >_< :

failures:

---- init_project_can_build stdout ----
        thread 'init_project_can_build' panicked at 'CLI assertion failed: (command `cargo run --bin cobalt -- init --trace` expected to succeed)
status=failed
stdout=``````
stderr=```error: could not find `Cargo.toml` in `C:\Users\Geob\AppData\Local\Temp\init.T2gAKVXg42pr` or any parent directory
```', C:\Users\Geob\.cargo\registry\src\github.com-1ecc6299db9ec823\assert_cli-0.5.4\src\assert.rs:368:12
stack backtrace:

---- log_levels_silent stdout ----
        thread 'log_levels_silent' panicked at 'CLI assertion failed: `cargo run -- build --silent -d C:\Users\Geob\AppData\Local\Temp\silent.AVccq2wIlRDv` StdErr mismatch: diff:

+Blocking waiting for file lock on build directory
    Finished dev [unoptimized + debuginfo] target(s) in 0.1 secs
     Running `I:\Dev\cobalt.rs\target\debug\cobalt.exe build --silent -d C:\Users\Geob\AppData\Local\Temp\silent.AVccq2wIlRDv`
', C:\Users\Geob\.cargo\registry\src\github.com-1ecc6299db9ec823\assert_cli-0.5.4\src\assert.rs:368:12
stack backtrace:
   0:     0x7ff6aefe95b1 - std::sys_common::backtrace::_print
                               at C:\projects\rust\src\libstd\sys_common\backtrace.rs:92
   1:     0x7ff6aeff5b2c - std::panicking::default_hook::{{closure}}
                               at C:\projects\rust\src\libstd\panicking.rs:380
   2:     0x7ff6aeff57a7 - std::panicking::default_hook
                               at C:\projects\rust\src\libstd\panicking.rs:391
   3:     0x7ff6aeff6195 - std::panicking::rust_panic_with_hook
                               at C:\projects\rust\src\libstd\panicking.rs:577
   4:     0x7ff6aeff6028 - std::panicking::begin_panic<alloc::string::String>
                               at C:\projects\rust\src\libstd\panicking.rs:538
   5:     0x7ff6aeff5f01 - std::panicking::begin_panic_fmt
                               at C:\projects\rust\src\libstd\panicking.rs:522
   6:     0x7ff6aef2db43 - assert_cli::assert::Assert::unwrap
                               at C:\Users\Geob\.cargo\registry\src\github.com-1ecc6299db9ec823\assert_cli-0.5.4\src\assert.rs:368
   7:     0x7ff6aef22f7a - cli::log_levels_silent
                               at I:\Dev\cobalt.rs\tests\cli.rs:138
   8:     0x7ff6aefa943d - test::{{impl}}::call_box<(),closure>
                               at C:\projects\rust\src\libtest\lib.rs:141
   9:     0x7ff6aeff74d1 - panic_unwind::__rust_maybe_catch_panic
                               at C:\projects\rust\src\libpanic_unwind\lib.rs:99
  10:     0x7ff6aef97342 - std::sys_common::backtrace::__rust_begin_short_backtrace<closure,()>
                               at C:\projects\rust\src\libstd\sys_common\backtrace.rs:134
  11:     0x7ff6aef98687 - std::panicking::try::do_call<std::panic::AssertUnwindSafe<closure>,()>
                               at C:\projects\rust\src\libstd\panicking.rs:476
  12:     0x7ff6aeff74d1 - panic_unwind::__rust_maybe_catch_panic
                               at C:\projects\rust\src\libpanic_unwind\lib.rs:99
  13:     0x7ff6aefa22d2 - alloc::boxed::{{impl}}::call_box<(),closure>
                               at C:\projects\rust\src\liballoc\boxed.rs:726
  14:     0x7ff6aeff4a5b - std::sys::imp::thread::{{impl}}::new::thread_start
                               at C:\projects\rust\src\libstd\sys\windows\thread.rs:54
  15:     0x7ffd978c8363 - BaseThreadInitThunk


failures:
    init_project_can_build
    log_levels_silent

test result: FAILED. 6 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--test cli'

I don't get it, it should do the exact same thing.

@Geobert
Copy link
Contributor Author

Geobert commented Jan 3, 2018

@epage
Copy link
Member

epage commented Jan 3, 2018

Huh, didn't realize cargo run will print out that text with --quiet.

See more info at the issue I created on assert_cli: assert-rs/assert_cli#79

@epage
Copy link
Member

epage commented Jan 3, 2018

Ok, so that assert_cli issue will probably not be resolved in time to unblock this issue.

The main care abouts: people can easily run the tests on their own (no extra steps) and the CI provides value.

main_binary fails the former because it requires knowing that you need to pass a flag to limit the number of threads

The original solution fails because it requires copying the binary first, even outside of the --target case (see .travis.yml).

Another idea I have is that instead of --target %TARGET%, would rustup run %CHANNEL%-%TARGET% cargo ... work and not modify the path the binary is written to?

@epage
Copy link
Member

epage commented Jan 3, 2018

Another idea I have is that instead of --target %TARGET%, would rustup run %CHANNEL%-%TARGET% cargo ... work and not modify the path the binary is written to?

I guess the shorthand would also work: cargo +%CHANNEL%-%TARGET% ...

appveyor.yml Outdated
@@ -1,6 +1,8 @@
# Based on the "trust" template v0.1.1
# https://github.com/japaric/trust/tree/v0.1.1

os: Visual Studio 2015

environment:
global:
RUST_VERSION: stable
Copy link
Member

Choose a reason for hiding this comment

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

This is dead code now, please remove it

@Geobert
Copy link
Contributor Author

Geobert commented Jan 5, 2018

:o everything passes! need to clean up commits now

@Geobert
Copy link
Contributor Author

Geobert commented Jan 5, 2018

SIGKILL on a compilation? https://travis-ci.org/cobalt-org/cobalt.rs/jobs/325410957#L796

I've put back check for travis, I think SIGKILL is a timeout isssue

Copy link
Member

@epage epage left a comment

Choose a reason for hiding this comment

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

Looks like the last of it!

appveyor.yml Outdated
- TARGET: i686-pc-windows-msvc
CHANNEL: stable
#- TARGET: x86_64-pc-windows-gnu
# CHANNEL: stable
Copy link
Member

Choose a reason for hiding this comment

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

If we're not supporting gnu, we should remove it (Rather than leave it commented out) and give a reason in the commit message.

appveyor.yml Outdated
#- TARGET: x86_64-pc-windows-msvc
# CHANNEL: beta
# TOOLCHAIN: msvc
# PLATFORM: x86_64
Copy link
Member

Choose a reason for hiding this comment

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

These targets are still commented out.

@Geobert
Copy link
Contributor Author

Geobert commented Jan 6, 2018

I don't get this error: https://ci.appveyor.com/project/johannhof/cobalt-rs/build/1.0.571/job/ptn77qeecg26q01i#L972

this happens time to time without apparent reason :-/

@epage
Copy link
Member

epage commented Jan 7, 2018

Whats weird is this doesn't fail as often on other builds.

@Geobert
Copy link
Contributor Author

Geobert commented Jan 7, 2018

@Geobert
Copy link
Contributor Author

Geobert commented Jan 7, 2018

and now it on x86_64 instead on i686… (╯°□°)╯︵ ┻━┻

@Geobert
Copy link
Contributor Author

Geobert commented Jan 7, 2018

rust-lang/cargo#4655
rust-lang/cargo#3161

seems that we can't do anything about it? Maybe adding syntax-highlight makes the build consume more RAM?

appveyor.yml Outdated
@@ -29,6 +29,7 @@ install:
- if "%TOOLCHAIN%" == "msvc" if "%PLATFORM%" == "x86_64" "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
- if "%TOOLCHAIN%" == "msvc" if "%PLATFORM%" == "x86_64" call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64
- if "%TOOLCHAIN%" == "msys" set PATH=C:\msys64\mingw%MSYS_BITS%\bin;C:\msys64\usr\bin;%PATH%
- set MSBUILD_NODE_CONNECTION_TIMEOUT=0
Copy link
Member

Choose a reason for hiding this comment

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

Should this instead be under environment: global:?

@epage
Copy link
Member

epage commented Jan 8, 2018

Now I'm trying to weigh out dropping 32-bit support.

The main use case of keeping it afaik is MS's new x86 on ARM stuff which is 32-bit only. Unsure if we'd be able to cross compile to it at some point.

@Geobert
Copy link
Contributor Author

Geobert commented Jan 9, 2018

I agree to get rid of 32bits build, I'll try that asap, holidays are finished…

@epage
Copy link
Member

epage commented Jan 9, 2018

i686-pc-windows-msvc builds are already broken for release builds due to issues with GetLastError?

@epage
Copy link
Member

epage commented Jan 9, 2018

If the build succeeds, feel free to squash the commits, documenting in them why you removed what you did, and let me know so I can merge this.

@Geobert
Copy link
Contributor Author

Geobert commented Jan 9, 2018

@epage
Copy link
Member

epage commented Jan 9, 2018

We're still getting sporadic failures?

This is not fun.

@Geobert
Copy link
Contributor Author

Geobert commented Jan 9, 2018

I've asked reddit for help.

Copy link
Member

@epage epage left a comment

Choose a reason for hiding this comment

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

Looking great! Good job on seeing this through to getting it to work!

I left some comments in the appeyvor file. I'm unsure how much of these things are vestiges of previous attempts vs things we need

- if [%APPVEYOR_REPO_TAG%]==[false] ( cargo test --verbose )
- if [%APPVEYOR_REPO_TAG%]==[false] ( cargo +%CHANNEL%-%TARGET% build )
- if [%APPVEYOR_REPO_TAG%]==[false] ( cargo +%CHANNEL%-%TARGET% test )
- if [%APPVEYOR_REPO_TAG%]==[false] ( cargo +%CHANNEL%-%TARGET% build --no-default-features )
Copy link
Member

Choose a reason for hiding this comment

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

Do these still need to be build instead of check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As said on gitter: because of natives C/C++ libs we need the build as check doesn't support them yet.

Copy link
Member

Choose a reason for hiding this comment

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

The annoying thing is that this doesn't seem to be a problem on Linux :(

appveyor.yml Outdated
# Beta channel
- TARGET: x86_64-pc-windows-msvc
CHANNEL: beta
TOOLCHAIN: msvc
PLATFORM: x86_64
Copy link
Member

Choose a reason for hiding this comment

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

What is PLATFORM?

Should we set it globally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, it was used in the install part to call the correct config .bat file according to i686 vs x86_64. To be deleted :)

appveyor.yml Outdated
CRATE_NAME: cobalt
APPVEYOR_CACHE_SKIP_RESTORE: true
MSBUILD_NODE_CONNECTION_TIMEOUT: 0
Copy link
Member

Choose a reason for hiding this comment

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

What value does this give us?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was one of the workaround for the PDB issue, I'll try without it :)

- cargo check --no-default-features --verbose
- cargo test --no-default-features --verbose
- cargo check --verbose --features "sass"
- cargo test --verbose --features "sass"
Copy link
Member

Choose a reason for hiding this comment

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

At some point we should make it so different feature combinations run as different jobs so they can run in parallel rather than series.

Granted that can get messy, particularly when we already have problems with our rustfmt and clippy jobs (see #305)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this possible with travis?

Copy link
Member

Choose a reason for hiding this comment

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

Yup, we just define more jobs in the matrix with a different variable set to control what happens in the job, maybe a FEATURE variable that is --feature "sass" vs --no-default-features.

Not something to include in this because it'd require a lot more experimenting and we shouldn't hold this up :)

@epage
Copy link
Member

epage commented Jan 11, 2018

Sweet! Squash the commits and I'll get this merged!

Thanks for all your effort on this one. Its been long and frustrating. I'm glad this didn't burn you out. Side projects should reinvigorate us and not tear us down.

- Remove windows-gnu target, support of Windows only through MSVC
- Remove 32 bits support
- Switch to Visual Studio 2017 to avoid PBD error
Remove uneeded variables
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.

2 participants