madsflensted / elm-brunch

Brunch plugin to compile Elm code
MIT License
74 stars 31 forks source link

brunch build --production does not have a non-zero exit code on error #38

Closed anagrius closed 6 years ago

anagrius commented 6 years ago

Problem

brunch build --production does not have a non-zero status code when there is an error in Elm code. If you on the other hand introduce an error in, say a JavaScript, it will return exit code 1.

This means our build server does not notice errors in Elm code. Which is bad :(

Information

chazsconi commented 6 years ago

@anagrius I believe this has been introduced by #30. I can reproduce your problem (both with and without the --production flag) with version 0.9.0 (which contains #30) but not with 0.7.0 (which does not contain #30).

I therefore suggest trying version 0.7.0.

anagrius commented 6 years ago

@chazsconi Great Catch. @madsflensted this is a major deal. For us it means that even if you have compile errors while developing Brunch Succeeds and presents a working site (You don't get a compile error notification) and thus you don't notice the issue. For the CI, you don't get any build error. :.(

madsflensted commented 6 years ago

Published v 0.10.0 wich reverts PR30. Can you check if this resolves this issue?

anagrius commented 6 years ago

I can confirm that that did it. Both notifications and Error code is back to normal! 🎉

anagrius commented 6 years ago

@madsflensted It seems 0.10.0 introduces race condition in dependency resolution. It seems to try to compile the code before the dependencies have finished downloading. This leads to situations where you have to delete elm-stuff/. If you on the other hand say elm package install before running brunch, everything works.

chazsconi commented 6 years ago

@anagrius I cannot reproduce this problem with 0.10.0. When I delete my elm-stuff folder and then run brunch build it pauses at the compile step of each Elm file while it downloads the dependencies.

Can you reproduce it with 0.7.0? When the problem happens and the compilation fails, does it return a non-zero exit code? Does it only happen with the --production flag?

anagrius commented 6 years ago

@chazsconi I have all kinds of problems now. Our project is about 50k lines of Elm, that might be what is causing the race condition. I don't only experience problems with dependencies, also random compile errors that go away after a restart of brunch. I will try out 0.7.0

madsflensted commented 6 years ago

@anagrius I am going to close this issue as your current problem seems to be a different type. If you find that it is caused by a problem in elm-brunch please raise a new issue.

In your CI setup you could try to run the elm make separate from brunch. Also check if you have any kind of parallelization enabled.

anagrius commented 6 years ago

@madsflensted I am not sure what you mean about my current problem? After the update to 0.10.0 elm-brunch is very broken. Have you rolled back? If not you should do so.

chazsconi commented 6 years ago

@anagrius For me 0.9.0 was broken and 0.10.0 is working fine. Did you try on 0.7.0 yet?

As @madsflensted says it would be better to open a new issue for the problem you are experiencing.

madsflensted commented 6 years ago

@anagrius I just did a test using src from [https://github.com/rtfeldman/elm-spa-example] and this brunch-config.js:

module.exports = {
  files: {
    javascripts: {joinTo: 'app.js'},
    stylesheets: {joinTo: 'app.css'},
  },
  paths: {
      watched: ["src"]
  },
  plugins: {
    elmBrunch: { mainModules: ['src/Main.elm'],
                 outputFile: 'elm.js',
                 makeParameters: ['--warn']
    }
  }
};

Using 0.10.0 brunch build --production works fine. If you can pin point it closer then feel free to open a new issue.

anagrius commented 6 years ago

--production works fine now. But watch is broken for us. I have opened a new issue #39. Sorry about the delay... too busy writing Elm code. :)