Skip to content

Fail Travis builds if Jekyll outputs empty files #538

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

Merged
merged 2 commits into from
Nov 22, 2016

Conversation

ashawley
Copy link
Member

While reading #516, it seemed to me that checking for empty files might be useful.

Turns out it is.

@ashawley
Copy link
Member Author

Failed with the following empty files:

$ find ./_site -empty ! -name error.log
./_site/training/2015/02/24/essential-scala-online.html
./_site/training/2015/03/19/essential-scalaz.html
./_site/training/2015/03/20/shapeless.html
./_site/training/2015/03/28/essential-essential-scala.html
./_site/training/2015/03/30/advanced-scala.html

The command "find ./_site -empty ! -name error.log" exited with 0.

$ find ./_site -empty ! -name error.log | read && false
The command "find ./_site -empty ! -name error.log | read && false" exited with 1.

@jarrodu
Copy link
Member

jarrodu commented Nov 17, 2016

I like this idea. 👍

@@ -17,3 +17,5 @@ install:

script:
- bundle exec jekyll build
- find ./_site -empty ! -name error.log
- find ./_site -empty ! -name error.log | read && false
Copy link
Member

Choose a reason for hiding this comment

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

Similar to #537. Does the last line ever return true?

true && false == false

and

false && false == false

Again I may be missing something here.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, I've changed it to ! read

@jarrodu
Copy link
Member

jarrodu commented Nov 17, 2016

check out your travis logs https://travis-ci.org/scala/scala-lang/builds/176708368

@ashawley ashawley force-pushed the jekyll-empty-files branch 2 times, most recently from 5286c78 to f36251a Compare November 18, 2016 13:56
@ashawley
Copy link
Member Author

It turns out these empty files output by Jekyll are empty purposefully. There should be even more caught by the find command, since there are many markdown files that contain only YAML front matter. Some of those files have an extra line after the front matter, so they aren't seen as empty. The find command could surface those with -size 1c, in addition to the -empty.

Paths that contain these purposeful empty files could be ignored. Currently, those paths are

  • events
  • training

The find command to ignore two paths is so unwieldily it's probably not worth mucking up the build process with it.

So, I'm not sure how useful it is now. We should probably just see how #537 goes.

@SethTisue
Copy link
Member

It turns out these empty files output by Jekyll are empty purposefully

why?

@ashawley
Copy link
Member Author

@SethTisue
Copy link
Member

The find command to ignore two paths is so unwieldily

would adding -name events -prune -o -name training -prune -o work?

@ashawley
Copy link
Member Author

ashawley commented Nov 18, 2016

Yes, but doesn't it require a lot of parens?

This is what I had

find ./_site \( -type d \( -name events -o -name training \) -prune -false \) -o \( -type f ! -name error.log -empty \)

@jarrodu
Copy link
Member

jarrodu commented Nov 20, 2016

I am starting to think that some of these Travis checks should be pulled out into a Scala script. I am not a fan of using Bash and Unix commands if it is not immediately obvious what is going on.

@ashawley
Copy link
Member Author

I agree, the shell code is ugly.

Looks like a script was written in Ruby in the past

https://github.com/scala/scala-lang/tree/master/_tools/validation

Not sure if it's used or not, still.

@jarrodu
Copy link
Member

jarrodu commented Nov 20, 2016

I don't think it is. I am actually working on a spring-cleaning branch locally where I removed the _tools directory.

@SethTisue
Copy link
Member

I am starting to think that some of these Travis checks should be pulled out into a Scala script

SGTM. I see no problem in taking on a Scala dependency.

@SethTisue
Copy link
Member

regardless, shall we merge? (I suggest we do.)

@jarrodu
Copy link
Member

jarrodu commented Nov 22, 2016

Sure. 👍

@jarrodu jarrodu merged commit eee87f1 into scala:master Nov 22, 2016
@ashawley ashawley deleted the jekyll-empty-files branch June 8, 2017 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants