Skip to content
This repository has been archived by the owner on Sep 19, 2021. It is now read-only.

[RFC] auto update homebrew formula resources #52

Closed
wants to merge 1 commit into from
Closed

[RFC] auto update homebrew formula resources #52

wants to merge 1 commit into from

Conversation

xu-cheng
Copy link

@xu-cheng xu-cheng commented Mar 6, 2015

Per neovim/homebrew-neovim#31 Ping @jszakmeister

I don't know how to add it into .travis.yml. It should be run under OS X.

@xu-cheng
Copy link
Author

xu-cheng commented Mar 6, 2015

In fact, I found it isn't too hard to let bot update formula directly. Use regex like below, I can easily update resource block.

/(^ {2}resource "\w+" do(.|\n)+?^ {2}end\n+)+/m

However, in order to implement this, I need some help:

@fwalch
Copy link
Member

fwalch commented Mar 6, 2015

For the Travis config, adding a new matrix.include entry like the OSX deps64 one should be sufficient.

Instead of sending a PR, you could just update the formula directly. The steps would be similar to ci/doc_index.sh, I think (clone homebrew, clone neovim, modify formula, commit homebrew). If you want to create a PR, have a look at the Github API docu and ci/nightly.sh for how an existing script calls the API (in this case to create a release).

@xu-cheng xu-cheng changed the title [WIP] homebrew formula resources checker [WIP] auto update homebrew formula resources Mar 6, 2015
@xu-cheng
Copy link
Author

xu-cheng commented Mar 6, 2015

OK I will look it up tomorrow. (It's late in my timezone.)

Instead of sending a PR, you could just update the formula directly.

I think it's best to send a PR. So ci on neovim/homebrew-neovim can verify it. Also it's best to let a human to do the real merge in case of any unexpected problem.

@xu-cheng
Copy link
Author

xu-cheng commented Mar 9, 2015

I have finished implement it and tested each part. How shall we proceed?

@xu-cheng
Copy link
Author

xu-cheng commented Mar 9, 2015

I'm trying to test it as whole but fail to let travis-ci run it under OS X. https://travis-ci.org/xu-cheng/bot-ci/builds/53667196

@xu-cheng xu-cheng changed the title [WIP] auto update homebrew formula resources [RFC] auto update homebrew formula resources Mar 9, 2015
@fwalch
Copy link
Member

fwalch commented Mar 9, 2015

@xu-cheng Regarding OSX and Travis: that feature is still in beta and had to be unlocked for the neovim repos by Travis support, so you can't use it in your fork unfortunately.

@xu-cheng
Copy link
Author

xu-cheng commented Mar 9, 2015

OK, I will test it as whole locally. There seems to be a small bug somewhere.

@xu-cheng
Copy link
Author

xu-cheng commented Mar 9, 2015

Local Result:

$ ./ci/homebrew-resources.sh
Using addressable 2.3.7
Using json 1.8.2
Using mime-types 1.25.1
Using rdoc 4.2.0
Using rest-client 1.6.8
Using unirest 1.1.2
Using bundler 1.8.4
Bundle complete! 1 Gemfile dependency, 7 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
==> Tap neovim/neovim
Cloning into '/usr/local/Library/Taps/neovim/homebrew-neovim'...
remote: Counting objects: 188, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 188 (delta 1), reused 0 (delta 0), pack-reused 183
Receiving objects: 100% (188/188), 28.76 KiB | 0 bytes/s, done.
Resolving deltas: 100% (65/65), done.
Checking connectivity... done.
Tapped 1 formula
Pruned 0 dead formulae
Tapped 498 formulae
Already up-to-date.
==> Extract resources info from formula
==> Download neovim/third-party/CMakeLists.txt
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   147    0   147    0     0    111      0 --:--:--  0:00:01 --:--:--   111
100 12142  100 12142    0     0   6728      0  0:00:01  0:00:01 --:--:-- 25670
==> Extract resources info from CMakeLists.txt
==> Compare resources between formula and CMakeLists.txt
Resources are consistent

@xu-cheng
Copy link
Author

xu-cheng commented Mar 9, 2015

Local Result which pointed to my tap (which is one commit behind neovim tap).

$ ./ci/homebrew-resources.sh
Using addressable 2.3.7
Using json 1.8.2
Using mime-types 1.25.1
Using rdoc 4.2.0
Using rest-client 1.6.8
Using unirest 1.1.2
Using bundler 1.8.4
Bundle complete! 1 Gemfile dependency, 7 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
==> Tap neovim/neovim
Cloning into '/usr/local/Library/Taps/xu-cheng/homebrew-neovim'...
remote: Counting objects: 183, done.
remote: Total 183 (delta 0), reused 0 (delta 0), pack-reused 183
Receiving objects: 100% (183/183), 27.07 KiB | 0 bytes/s, done.
Resolving deltas: 100% (64/64), done.
Checking connectivity... done.
Tapped 1 formula
Pruned 0 dead formulae
Tapped 498 formulae
Already up-to-date.
==> Extract resources info from formula
==> Download neovim/third-party/CMakeLists.txt
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   147    0   147    0     0    117      0 --:--:--  0:00:01 --:--:--   117
100 12142  100 12142    0     0   8352      0  0:00:01  0:00:01 --:--:--  8352
==> Extract resources info from CMakeLists.txt
==> Compare resources between formula and CMakeLists.txt
==> Create new formula
==> Upload formula

PR created by bot: https://github.com/xu-cheng/homebrew-neovim/pull/2

@xu-cheng
Copy link
Author

Updated a bit to let bot generate nicer commit message. See https://github.com/xu-cheng/homebrew-neovim/pull/3 for example.

@xu-cheng
Copy link
Author

Ask for comments.

@fwalch
Copy link
Member

fwalch commented Mar 13, 2015

I'm a bit torn whether it would be better to use a GH API gem.. I thought you were going to create a shell script, that's why I linked the nightly.sh script above.
Apart from that, I think this would create new PRs on every bot-ci run if the resources are not up-to-date (i.e. the initial PR has not yet been merged). Would it be possible to fix that?

@xu-cheng
Copy link
Author

Updated. It now sends PR using fixed branch. If such branch exists, it will skip updating.

@xu-cheng
Copy link
Author

Ping

@justinmk
Copy link
Member

As @fwalch alluded to, what is the reason for not using github-api.sh? The less code we have the better--build issues already take up more time than I would prefer...

@xu-cheng
Copy link
Author

what is the reason for not using github-api.sh?

Mainly, because I'm more familiar to ruby than shell. And the API I needed is a little more complex than what have already implemented in github-api.sh.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants