Skip to content

Use Travis CI to test the book build and then deploy it to the site, take 2 #316

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 3 commits into from
Sep 24, 2018

Conversation

berquist
Copy link
Member

@berquist berquist commented Jul 29, 2018

Continuation of #284.

Don't merge this yet, because things need to be added.

The last PR failed in three ways:

  1. The site went down because the CNAME for custom domain redirection was not present. After checking the log (which I saved), if you're curious, I noticed that there are several other files present in algorithm-archivists.github.io that do not come from either the main repo or building the book. These can persist because update_site.sh only copies files over, rather than wipe and move. This is personal preference, but I think the website repo should be entirely reproducible from the main repo via this script. You can see the difference by comparing your website repo with mine. Let me know which path you'd rather take, and I'll either need to add those files to the main repo and have them copy over during deploy, or have the deploy copy the build rather than wipe the book repo.

  2. The guard for when the book should be deployed was wrong. Once the initial PR was merged, every Travis pull_request build (see below) was going to try deploy. This is before the merge actually happens. I don't think Travis would continue to this step if the build failed earlier, but it's still wrong.

  3. A bunch of files got deleted. I still don't know how this happened, because I think they should have been present in the book build. I don't think they were extra files left over from before the flattening, either.


For reference, and because I didn't understand it for a while, there are two kinds of Travis builds:

  1. push:

    • Under the status dialog, this is called Travis CI - Branch and continuous-integration/travis-ci/push.
    • "This is a normal build for the branch. You should be able to reproduce it by checking out the branch locally."
    • What it does is test the branch as-is. By default, this will run for everyone who has a fork of the main repo every time they push to their own fork.
  2. pull_request:

    • Under the status dialog, this is called Travis CI - Pull Request and continuous-integration/travis-ci/pr.
    • "This is a pull request build. It is running a build against the merge commit, after merging . Any changes that have been made to the master branch before the build ran are also included."
    • What is does is it simulates merge specified by the PR, then runs the Travis config. This only runs after creating a pull request.

The reason each type of CI run appears twice is that the former leads to the pretty GitHub summary, and the latter leads to the actual Travis log.

The config is now set up so that only push commits to master will deploy to algorithm-archivists.github.io. I checked, and this works in all cases: when there's a merge commit, a rebase and FF merge, a squash and merge, or a regular commit. Any time the history of master is updated, the book will be built and deployed.


Note that I changed the names of some environment variables you must set in Travis to be more explicit. Hopefully things are clearer now.

@berquist
Copy link
Member Author

Now that Travis has been activated, you can see that the pr/pull_request build didn't deploy to the book, which would have broken the site...again...

@leios
Copy link
Member

leios commented Aug 5, 2018

Ok. I think we are ready to give this another go, but I would like for @berquist to be available when we merge this PR just in case... So maybe we should set up a time to give this a shot on discord?

@berquist
Copy link
Member Author

berquist commented Aug 5, 2018

Sure. I won't be around Monday EST, but any time from Tuesday EST on is fine.

In the meantime, read the first paragraph again. This PR needs to be updated before merging, otherwise the site will break.

@leios
Copy link
Member

leios commented Aug 5, 2018

Mind if I add a WIP to the title to reflect this?

@berquist
Copy link
Member Author

berquist commented Aug 5, 2018 via email

@leios leios changed the title Use Travis CI to test the book build and then deploy it to the site, take 2 WIP Use Travis CI to test the book build and then deploy it to the site, take 2 Aug 5, 2018
@leios
Copy link
Member

leios commented Aug 5, 2018

So to be clear: you are arguing there are a lot of extra files because...

update_site.sh only copies files over, rather than wipe and move. This is personal preference, but I think the website repo should be entirely reproducible from the main repo via this script.

I'm up for updating the update_site command. What do we need to do with the CNAME stuff?

@berquist
Copy link
Member Author

berquist commented Aug 5, 2018

Uncommenting this line will take care of CNAME. I still need time to check the rest of the files.

However, there is a new problem: https://travis-ci.org/algorithm-archivists/algorithm-archive/builds/409608474#L427. If you go to https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions:

Travis CI makes encrypted variables and data available only to pull requests coming from the same repository. These are considered trustworthy, as only members with write access to the repository can send them.

Pull requests sent from forked repositories do not have access to encrypted variables or data.

If your build relies on encrypted variables to run, for instance to run Selenium tests with BrowserStack or Sauce Labs, your build needs to take this into account. You won’t be able to run these tests for pull requests from external contributors.

To work around this, restrict these tests only to situations where the environment variables are available, or disable them for pull requests entirely, as shown in the following example:

I need to figure out if the AAA will be affected by this. I think so, because I am on another org's repo, but for some reason this PR ran fine? It will take some investigation. Maybe later this week is best.

@leios
Copy link
Member

leios commented Aug 5, 2018

Oh man, this is getting super messy. Take your time. We really appreciate it!

@leios
Copy link
Member

leios commented Sep 21, 2018

Hey @berquist, quick question on the state of this PR. Obviously, no pressure to finish, but I just wanted to make sure it was still on the table.

@berquist
Copy link
Member Author

I started work recently so have been busy. I'll take a look at it tomorrow and let you know when it's ready to merge.

@leios
Copy link
Member

leios commented Sep 22, 2018

Of course no rush, just checking in

@berquist
Copy link
Member Author

Can you do me a favor and try restarting Travis? I don't understand the sudden failure. https://travis-ci.org/algorithm-archivists/algorithm-archive/builds/432252148

@leios
Copy link
Member

leios commented Sep 23, 2018

I'll be honest, I have no idea how to do that.

@berquist
Copy link
Member Author

Is there a button labeled "Restart job" or something similar in the area where I have whitespace on the right?

screen shot 2018-09-23 at 7 47 07 pm

@leios
Copy link
Member

leios commented Sep 23, 2018

No, I see what you see

@june128
Copy link
Member

june128 commented Sep 23, 2018

@leios are you signed in to Travis?

@leios
Copy link
Member

leios commented Sep 23, 2018

Yeah, alright. That was it. I logged in and could restart it. Sorry.

Copy link
Member

@leios leios left a comment

Choose a reason for hiding this comment

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

This is black magic to me. Let's see if it works.

@berquist berquist changed the title WIP Use Travis CI to test the book build and then deploy it to the site, take 2 Use Travis CI to test the book build and then deploy it to the site, take 2 Sep 24, 2018
@leios leios merged commit a1a6dfa into algorithm-archivists:master Sep 24, 2018
@berquist berquist deleted the travis-ci branch September 24, 2018 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants