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

Set up travis-ci #15

Merged
merged 2 commits into from Jan 10, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions .travis.yml
@@ -0,0 +1,12 @@
language: elixir
sudo: false
script:
- if [ -z "$SKIP_FORMAT_CHECK" ]; then mix format --check-formatted; fi
Copy link
Member

@wojtekmach wojtekmach Jan 7, 2019

Choose a reason for hiding this comment

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

Recently on MyXQL I added another check, to fail the build if there are warnings mix compile --warnings-as-errors, so consider adding that too. I also did it a bit differently but I've probably overcomplicated it a bit (ci.sh).

Instead of by default running formatter and skipping it sometimes, consider skipping formatter by default and running it sometimes. In case we'd ever run against different Elixir versions, I think we'd prefer to run the formatter against the latest only.

Btw, comparing approaches, I just thought about something. I'll probably do the following to MyXQL :)

language: elixir
sudo: false
matrix:
  include:
    - elixir: 1.5.3
      otp_release: 18.3
    - elixir: 1.7.4
      otp_release: 21.2
      before_script:
        - mix format --check-formatted           

All that being said, keeping this as is sounds great 👌

Copy link
Member

@josevalim josevalim Jan 7, 2019

Choose a reason for hiding this comment

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

Instead of by default running formatter and skipping it sometimes, consider skipping formatter by default and running it sometimes. In case we'd ever run against different Elixir versions, I think we'd prefer to run the formatter against the latest only.

Agreed. We should run the formatter just once and always on latest.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems like before_script doesn't work at this level:

in matrix.include section: unexpected key before_script, dropping

I think I'll have to stick with env, however I could change it to CHECK_FORMAT=true so I could set it only on the latest.

Copy link
Member

Choose a reason for hiding this comment

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

Oops! I ended up using script: in that matrix step in MyXQL (which means it's gonna run just checks instead of tests which I'm fine with). Yup, using simply env is fine, it has the nice benefit that ENV shows up in Travis job description so it's easier to spot.

Copy link
Member

Choose a reason for hiding this comment

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

Let's keep the ENV but let's reverse it. Let's run the formatter ONLY IF the environment variable is set. I think that's a better behaviour because the formatter may behave different between Elixir version. So we want to indeed run in only one of them.

- mix test
matrix:
include:
- elixir: 1.5.3
otp_release: 18.3
env: SKIP_FORMAT_CHECK=true
- elixir: 1.7.4
otp_release: 21.2
2 changes: 1 addition & 1 deletion mix.exs
Expand Up @@ -5,7 +5,7 @@ defmodule Broadway.MixProject do
[
app: :broadway,
version: "0.1.0",
elixir: "~> 1.7",
elixir: "~> 1.5",
start_permanent: Mix.env() == :prod,
deps: deps()
]
Expand Down