- Add a `make test-spectron` target
- Install `spectron` and `mocha` (since we don't need to run the tests
inside an Electron instance like in the case of `electron-mocha`)
- Add some example tests
Fixes: https://github.com/resin-io/etcher/issues/1870
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
We do this by using Appveyor's `platform` configuration variable instead
of always running on x64 and cross-compiling to x86.
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
This commit includes several changes to adapt the CI configuration files
and Bintray publish script to perform development deployments.
- Move our Bintray details to the Makefile
- Deploy to a new Bintray component if `RELEASE_TYPE` is `snapshot`
- Call `publish-bintray-debian` and `publish-bintray-redhat` in the CI
deployment script
- Call the Bintray deployment scripts for RPMs
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Looks like pkg downloads node binaries from GitHub Releases, and GitHub
may impose a rate limiting if we download too many things from them in a
short period of time (likely to happen when there are many concurrent
PRs).
In order to mitigate this issue, this commit adds `$HOME/.pkg-cache`,
the directory where pkg stores node binaries, to the CI services cache.
See: https://github.com/resin-io/etcher/pull/1594
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
These directories contain files downloaded by electron-builder (like
electron itself), that we can cache in Travis CI and Appveyor CI to
speed up builds.
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
We've been hitting some weird npm-shrinkwrap.json issues in our
shrinkwrap staged sanity checks, where Appveyor would complain that the
shrinkwrap is not up to date, while that wasn't the case either locally
or in Travis CI.
The issue is related to caching. If a commit changes a `from` entry of a
npm-shrinkwrap.json dependency, but the CI servers kept the cached
node_modules, then there will be a discrepancy between the `_from` field
from the `package.json` of a dependency in `node_modules` and what the
npm-shrinkwrap.json says. npm will obey `node_modules` over
`npm-shrinkwrap`, causing the invalid diff.
The fix is to make the Appveyor node_modules cached directory dependent
on any change to the npm-shrinkwrap.json file.
Change-Type: patch
See: https://github.com/resin-io/etcher/pull/1547
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Currently we have almost equal CI scripts implemented in bash (for
Travis), and batch (for Appveyor). This commit takes advantage of MinGW
bash to unify all the scripts as bash scripts.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This allows us to catch changes that break our installer builds before
merging the problematic changes.
As a way to simplify the CI configuration files, this commit introduces
an `installers-all` Makefile target that builds all installers.
This commit also replaces all the `cp -rf` calls with `cp -RLf` in
Makefile to avoid some weird hard link Appveyor issues.
See: https://github.com/resin-io/etcher/pull/1078
See: https://github.com/resin-io/etcher/pull/1354
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
We forgot to do so on the PR that introduces this script.
This commit also moves all the CI code to separate scripts.
See: https://github.com/resin-io/etcher/pull/1371
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
Sentry error reports showcase that elevation errors on Windows are one
of the most frequent Windows errors.
In order to perform Windows elevation, we ship compiled EXEs of a third
party CLI elevation application (http://code.kliu.org/misc/elevate/)
that has several limitations:
- We have the scan the output of the script to determine if a user
cancelled the elevation request, which causes all sorts of issues on
computers where English is not the main language
- The application displays a `cmd.exe` window for some milliseconds,
which is bad UX, that we have to workaround by distributing a patched
version of the tool
- The CLI application has to be spawned, which seems to be problematic
if users have anti-virus software, leading to hard to debug issues
- We don't have any control if something goes wrong
For these reasons, we decided to implement our own elevation mechanism
in C++ as a Node.js add-on, based on the `elevate.exe` code we where
previously using.
Misc changes:
- Introduce a `lib/shared/bindings.js` module to easily require local native
add-ons
- Install `cpplint` and configure it to lint C++ files
Note that for practical reasons, the C++ code lives in this repository
rather than in a separate module. We will release this functionality in
a more accessible way in the future as part of the Etcher SDK project.
Change-Type: patch
Changelog-Entry: Fix uncaught errors when cancelling elevation requests on Windows when the system's language is not English.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
To prevent any potential version incompatibility caused by simply installing
the latest version of the packages in the CI services.
See: https://github.com/resin-io/etcher/pull/1326
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
`mountutils` is a native C++ NodeJS addon the Etcher team has been
working on to solve several issues we've been having with third party
unmount programs.
We'll see how this little module behaves after some real world usage.
I'm confident that it will fix the issues linked in this commit.
This commit also upgrades `npm` to 4.4.4 in Appveyor, given there is a
known building issue on Windows that is solved in a recent version.
Change-Type: minor
Changelog-Entry: Fix several unmount related issues in all platforms.
See: https://github.com/resin-io-modules/mountutils
Fixes: https://github.com/resin-io/etcher/issues/1177
Fixes: https://github.com/resin-io/etcher/issues/985
Fixes: https://github.com/resin-io/etcher/issues/750
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
We're passing a shell conditional to `deploy.script`, however Travis CI
seems to get confused about this in the deploy section, causing
GNU/Linux to run `make publish-aws-s3` directly on the Travis CI build
instead of in the Docker container, which causes the deployment to
eventually fail because of missing dependencies.
According to Travis CI:
> `deploy.script` must be a scalar pointing to an executable file or
> command.
See https://travis-ci.org/resin-io/etcher/jobs/214723725 for a failure
example.
We also move the Appveyor deploy script to a separate file for symmetry
purposes.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This commit addresses some issues with snapshot builds that we didn't
caught given we never ran the deployment step in a "real" deployment
scenario.
- On Travis CI, the service reverts all changes in the source tree
before starting the `deploy` section, which seems to trigger some
issues when deleting `node_modules`. The solution is to set the
`skip_cleanup` option
See
https://s3.amazonaws.com/archive.travis-ci.org/jobs/213614487/log.txt
```
...
warning: failed to remove node_modules/helper-date/node_modules/moment/locale/es.js
warning: failed to remove node_modules/helper-date/node_modules/moment/locale/ky.js
warning: failed to remove node_modules/helper-date/node_modules/moment/locale/pt-br.js
warning: failed to remove node_modules/helper-date/node_modules/moment/locale/hu.js
warning: failed to remove node_modules/helper-date/node_modules/moment/locale/en-nz.js
...
```
- On Appveyor CI, `curl` is not installed
See
https://ci.appveyor.com/project/resin-io/etcher/build/job/54i0erd9tsa1cg5p
as an example.
See: https://github.com/resin-io/etcher/pull/1078
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This commit makes Appveyor and Travis CI publish snapshot builds to S3
when a pull request is merged, by making use of the `publish-aws-s3`
Makefile target.
The changes required for such type of deployment are the followings:
- Set `S3_BUCKET` to `resin-nightly-downloads` when doing snapshot
builds
- Add deploy sections to `.travis.yml` and `appveyor.yml` that run `make
publish-aws-s3`
- Don't change `PRODUCT_NAME` when doing snapshot builds (given we'll be
publishing to a different S3 bucket)
- Install `awscli` in Appveyor CI and Travis CI
- Make GNU/Linux Docker containers inherit `AWS_ACCESS_KEY_ID` and
`AWS_SECRET_ACCESS_KEY` from the environment (so `awscli` is
configured correctly inside them)
- Add a prefix option to `aws-s3.sh` publish script to prepend a string
to the S3 path, so we can add a timestamp to more easily distinguish
files inside the `resin-nightly-downloads` bucket
- Print the published URL from `aws-s3.sh` for convenience purposes, so
we can click it when skimming through CI builds logs
- Add the `-R` and `-L` options when recursively copying `node_modules`
during a snapshot build to prevent weird Appveyor errors related to
hard links. The options listed before make sure that we recursively
resolve every link while copying
- Move from `wget` to `curl` to avoid certificate check failures
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
upx allows to reduce the package size by some mega bytes, but also
considerably slows down the application start time.
This commit ditches upx, since we can re-gain those benefits (and even
increase them) by other means (e.g: minifying JavaScript).
See: https://github.com/resin-io/etcher/issues/1138
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
* chore: get the CI tests working again
* an updated eslint-plugin-lodash was creating extra linter errors where we
were using built-in String methods instead of the lodash equivalents
* an updated codespell package now installs with a different executable-name
(no .py extension), and now supports multiple dictionaries
* while I was at it I replaced the messy double-quoting-string logic with the
command-join module
Changelog-type: patch
* chore: downgrade codespell to 1.9.2 because the latest version has issues running on Windows
(we'll hopefully be able to revert this commit when codespell works again properly!)
We've recently had an incident were the `angular-mocks` version we were
running was incompatible with the `angular` version.
Each AngularJS core module is versioned equally, therefore we can write
a small script that automatically tests that they match, so we're
guarded against forgetting to similarly upgrade different dependencies.
See: https://github.com/resin-io/etcher/pull/1168
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
https://github.com/brigade/scss-lint now says "NOTICE: Consider other tools
before adopting SCSS-Lint", and recommends sass-lint as an alternative.
sass-lint has the additional advantage of being written in NodeJS, which means
it slots nicely into our existing infrastructure, and we can completely
remove our build-time dependency on Ruby.
We recently encountered a UI regression caused by forgetting to commit
the generated CSS files.
The solution is to make the CI servers run `npm run sass` and check if
there are unstaged files afterwards. If so, the tests halt.
In order to avoid duplication between Travis CI and Appveyor CI, this
logic has been encoded into a bash script at `scripts/ci`.
See: https://github.com/resin-io/etcher/pull/1120
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
Running `npm install -g npm` causes npm to be upgraded to v4, which
seems to have the following bug when running `npm install`:
```
npm ERR! Callback called more than once.
```
Not upgrading npm on our Appveyor builds causes npm to stay at v3, and
the problem dissapears.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This will allow us to later publish development builds for both
architectures from Appveyor. In order to easily do so, the Makefile is
used instead of the current `./scripts/build/windows.bat`.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This version was not working the last time we checked, but it looks like
there were some advancements in node-gyp in the previous months, and all
dependencies have upgraded to it already.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
Using MinGW allows us to re-use the build scripts we've been developing
for GNU/Linux and OS X, which are much more robust than their `*.bat`
counterparts (due to Batch limitations).
This commit does the following changes:
- Documents MinGW as a requirement in `RUNNING-LOCALLY.md`
- It setups MinGW in Appveyor CI
- Transforms `windows/sign.bat` into `windows/electron-sign-exe.sh`
- Re-uses `dependencies-npm.sh` and `dependencies-bower.sh` in
`build/windows.bat`
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
We tried to save the Chocolatey cache in a previous PR, but it looks
like its not working properly. This PR implements the "correct" way to
cache Chocolatey installs, as recommended in Appveyor forums.
The arrows mean that the cache is invalidated if the file in the right
side (`appveyor.yml`) in this case, is changed.
See: http://help.appveyor.com/discussions/suggestions/592-speeding-up-chocolatey-downloads-and-installs
See: e603cb0838
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
Setting a Chocolatey cache and Making sure it gets persisted means that
future builds don't have to download every Chocolatey package from the
internet every time.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This PR zips the package that is built by running:
```sh
.\scripts\build\windows.bat package <arch>
```
And puts it in `etcher-release/installers`.
Fixes: https://github.com/resin-io/etcher/issues/760
Change-Type: minor
Changelog-Entry: Publish standalone Windows builds.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
`scss_lint` suddenly requires Ruby 2, which is breaking all our Travis
CI and Appveyor builds, which ship older versions.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This PR integrates SCSS Lint, a tool that will help us keep SCSS tidier.
I've included a sensible configuration at `.scss-lint.yml`, and
documentation on how to install it on `CONTRIBUTING.md`.
The tool will run automatically as part of `npm run lint`.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
Currently build scripts install dependencies and package everything on
every run. In order to allow more customisation, the build scripts now
accept the following commands:
- `install`: Only install dependencies.
- `package`: Only package the application.
- `all`: Install dependencies and package the application.
The above differentiation allows us to improve the documentation and CI
configuration files to point to the `install` commands instead of having
to explain how to configure NPM correctly, since that's done by the
build scripts by default.
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
* Upgrade etcher-image-write to v5.0.1
The new version contains an important fix to prevent `EPERM` errors on
Windows with certain drives.
Fixes: https://github.com/resin-io/etcher/issues/334
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
* Upgrade NPM to fix newer package versions not available in Appveyor
See: https://github.com/npm/npm/issues/4984
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
This PR introduces `etcher-image-stream`:
https://github.com/resin-io-modules/etcher-image-stream
a module that will handle support for decompression, URL streaming, and
any other way to get a source of data to write in Etcher.
Most of the changes in this PR are because XZ decompression includes a
native dependency (no pure JS implementations out there for now), so we
had to tweak various things for the dependency to work correctly on
Etcher/Electron.
See: https://github.com/resin-io/etcher/issues/325
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>