Add CI for Windows

Sergej Kostjucenko requested to merge cmichi-add-windows-build-ci-stage into master

Created by: cmichi

Closes https://github.com/paritytech/cargo-contract/issues/36.

Took inspiration from here.

The Windows run currently takes ~9 minutes.

While implementing this, I found the bug which caused some people asking in our channels why they got this error when building a contract under Windows:

[3/5] Optimizing wasm file
ERROR: The workspace root package should be a workspace member

It was due to a comparison of a non-canonicalized path with a canonicalized one.

workspace_root (non-canonicalized): "D:\\a\\cargo-contract\\cargo-contract\\foobar"
package_path (canonicalized):       "\\\\?\\D:\\a\\cargo-contract\\cargo-contract\\foobar"
comparison: Some("D:\\a\\cargo-contract\\cargo-contract\\foobar") == Some("\\\\?\\D:\\a\\cargo-contract\\cargo-contract\\foobar")

The \\\\? prefix appears only under Windows ‒ there a path with this prefix is the correct canonical path, this allows Windows-specific "long" paths (more info).

I'm not sure if there might be more places in our code which could cause issues with this path discrepancy, FWIW tests are green.

I can do a new release once we have merged this.

Merge request reports