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

Only use -Werror in CI #428

Merged
merged 18 commits into from
Jan 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
- name: Install dependencies
run: |
cabal v2-update
cabal v2-configure --disable-optimization --enable-benchmarks --enable-tests --write-ghc-environment-files=always -j2
cabal v2-build all --only-dependencies
cabal v2-configure --project-file=cabal.project.ci --disable-optimization --enable-benchmarks --enable-tests --write-ghc-environment-files=always -j2
cabal v2-build --project-file=cabal.project.ci all --only-dependencies

- name: hlint
run: |
Expand All @@ -52,9 +52,9 @@ jobs:

- name: Build & test
run: |
cabal v2-build
cabal v2-run semantic:test
cabal v2-run semantic-core:test
cabal v2-run semantic-python:test
cd semantic-source; cabal v2-run semantic-source:test; cd ..
cd semantic-source; cabal v2-run semantic-source:doctest -- src; cd ..
cabal v2-build --project-file=cabal.project.ci
cabal v2-run --project-file=cabal.project.ci semantic:test
cabal v2-run --project-file=cabal.project.ci semantic-core:test
cabal v2-run --project-file=cabal.project.ci semantic-python:test
cd semantic-source; cabal v2-run --project-file=cabal.project.ci semantic-source:test; cd ..
cd semantic-source; cabal v2-run --project-file=cabal.project.ci semantic-source:doctest -- src; cd ..
37 changes: 5 additions & 32 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
-- ATTENTION: care must be taken to keep this file in sync with cabal.project.ci. If you add a package here, add it there (and add a package stanza with ghc-options to enable errors in CI at the bottom of that file).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These notices are important, and a rather unfortunate necessity: We can’t just pass --ghc-option=-Werror to cabal in CI, because a long-standing bug in cabal causes it to apply ghc-options specified on the CLI to all packages instead of only the local ones.

We could perhaps have added cabal.project.local files specifying -Wwarn for all local packages, but we’d have had to keep those in sync too, and as that file is the target of cabal configure, it would potentially introduce a bunch of work to keep spurious changes to those files out of PRs.

On the balance, this seemed a better solution, albeit unfortunately duplicative; hopefully the ATTENTION notices in these files will remind us to keep things synced up. (And if not, maybe we can add a CI check that cabal.project is a prefix of cabal.project.ci.)


-- Local packages
packages: .
semantic-analysis
semantic-ast
Expand All @@ -11,38 +14,8 @@ packages: .
semantic-typescript
semantic-tags

jobs: $ncpus

package semantic
ghc-options: -Werror

package semantic-analysis
ghc-options: -Werror

package semantic-core
ghc-options: -Werror

package semantic-go
ghc-options: -Werror

package semantic-java
ghc-options: -Werror

package semantic-json
ghc-options: -Werror

package semantic-python
ghc-options: -Werror

package semantic-ruby
ghc-options: -Werror

package semantic-tags
ghc-options: -Werror

package semantic-ast
ghc-options: -Werror

-- Packages brought in from other repos instead of hackage
-- ATTENTION: remember to update cabal.project.ci when bumping SHAs here!
source-repository-package
type: git
location: https://github.com/tclem/proto-lens-jsonpb
Expand Down
70 changes: 70 additions & 0 deletions cabal.project.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
-- ATTENTION: care must be taken to keep this file in sync with cabal.project. If you add a package here, add it there (and add a package stanza with ghc-options to enable errors in CI at the bottom of this file).

-- Local packages
packages: .
semantic-analysis
semantic-ast
semantic-core
semantic-go
semantic-java
semantic-json
semantic-python
semantic-ruby
semantic-tsx
semantic-typescript
semantic-tags

-- Packages brought in from other repos instead of hackage
-- ATTENTION: remember to update cabal.project when bumping SHAs here!
source-repository-package
type: git
location: https://github.com/tclem/proto-lens-jsonpb
tag: 5d40444be689bef1e12cbe38da0261283775ec64

source-repository-package
type: git
location: https://github.com/antitypical/fused-syntax.git
tag: d11e14581217590a5c67f79cbaeee35ac8acee6a

source-repository-package
type: git
location: https://github.com/fused-effects/fused-effects-readline.git
tag: 7a96949c77c73c6e5975c8d6171ffb63eb76b467


-- Treat warnings as errors for CI builds
package semantic
ghc-options: -Werror

package semantic-analysis
ghc-options: -Werror

package semantic-ast
ghc-options: -Werror

package semantic-core
ghc-options: -Werror

package semantic-go
ghc-options: -Werror

package semantic-java
ghc-options: -Werror

package semantic-json
ghc-options: -Werror

package semantic-python
ghc-options: -Werror

package semantic-ruby
ghc-options: -Werror

package semantic-tags
ghc-options: -Werror

package semantic-tsx
ghc-options: -Werror

package semantic-typescript
ghc-options: -Werror
Comment on lines +66 to +70
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We were actually already running into trouble keeping these things synced up correctly, as neither of these packages had -Werror in CI until now.

6 changes: 3 additions & 3 deletions semantic-source/cabal.project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
packages: .
-- ATTENTION: care must be taken to keep this file in sync with cabal.project.ci. If you add a package here, add it there (and add a package stanza with ghc-options to enable errors in CI at the bottom of that file).

package semantic-source
ghc-options: -Werror
-- Local packages
packages: .
9 changes: 9 additions & 0 deletions semantic-source/cabal.project.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- ATTENTION: care must be taken to keep this file in sync with cabal.project. If you add a package here, add it there (and add a package stanza with ghc-options to enable errors in CI at the bottom of this file).

-- Local packages
packages: .


-- Treat warnings as errors for CI builds
package semantic-source
ghc-options: -Werror