Development cycle » History » Version 14
Tom Clegg, 03/17/2016 10:24 PM
1 | 1 | Tom Clegg | h1. Development cycle |
---|---|---|---|
2 | |||
3 | 4 | Tom Clegg | h2. Getting the code base |
4 | |||
5 | 13 | Tom Clegg | git clone git://git.curoverse.com/tapestry.git |
6 | cd tapestry |
||
7 | git submodule init |
||
8 | git submodule update |
||
9 | |||
10 | h2. Running tests |
||
11 | |||
12 | Add these configs to your /etc/mysql/my.cnf, otherwise each "create table" will take ~0.5 seconds, and you'll wait ~3 minutes each time you run @rake test@ before the tests start running. |
||
13 | * <pre> |
||
14 | innodb_file_per_table = 0 |
||
15 | innodb_stats_persistent = 0 |
||
16 | </pre> |
||
17 | |||
18 | You can run tests in a docker container. |
||
19 | * Make sure @/etc/mysql/my.cnf@ has @bind-address = 0.0.0.0@ or whatever is suitable. |
||
20 | * Create a @tapestry@ user and a @tapestry_test@ database on your docker host (or somewhere else reachable from a docker container). |
||
21 | * <pre>create database tapestry_test; |
||
22 | grant all privileges on tapestry_test.* to tapestry identified by 'secretzzz'; |
||
23 | </pre> |
||
24 | * Create @config/database.yml@ (see @config/database.yml.example@) |
||
25 | * @make docker-test@ |
||
26 | 4 | Tom Clegg | |
27 | 14 | Tom Clegg | Currently (March 2016) there are tests failing on master, but you should do at least this well: |
28 | * <pre>$ make docker-test |
||
29 | |||
30 | [...] |
||
31 | |||
32 | 623 tests, 964 assertions, 228 failures, 88 errors |
||
33 | Errors running test:units, test:functionals! |
||
34 | Makefile:6: recipe for target 'docker-test' failed |
||
35 | make: *** [docker-test] Error 1 |
||
36 | </pre> |
||
37 | |||
38 | 1 | Tom Clegg | h2. Writing and contributing code |
39 | |||
40 | Start a branch like username/master or username/rails3 |
||
41 | |||
42 | git branch example/rails3 |
||
43 | git checkout example/rails3 |
||
44 | |||
45 | Do something trivial like |
||
46 | |||
47 | * add app/views/pages/specimen_collection.html.erb |
||
48 | * add link to it in app/views/pages/home.html.erb |
||
49 | |||
50 | 3 | Tom Clegg | Commit it. If you refer to the issue# in the comment, redmine will notice this and do smart things (e.g., link to the commit from the issue page). |
51 | 1 | Tom Clegg | |
52 | git add ... |
||
53 | 3 | Tom Clegg | git commit -m 'description of stuff (closes #123)' |
54 | 1 | Tom Clegg | |
55 | Push it |
||
56 | |||
57 | git push |
||
58 | |||
59 | Generate a pull request |
||
60 | |||
61 | 12 | Ward Vandewege | git request-pull e68ab19^ git@git.clinicalfuture.com:tapestry.git e68ab19 |
62 | 1 | Tom Clegg | |
63 | Send the pull request to someone like Ward |
||
64 | |||
65 | 2 | Ward Vandewege | h2. Merging code from other contributors/branches |
66 | 1 | Tom Clegg | |
67 | 4 | Tom Clegg | Fetch latest code in other developers branches |
68 | 1 | Tom Clegg | |
69 | 4 | Tom Clegg | git fetch |
70 | 1 | Tom Clegg | |
71 | 4 | Tom Clegg | List remote branches |
72 | |||
73 | git branch -a |
||
74 | |||
75 | 1 | Tom Clegg | Switch to the other branch |
76 | 2 | Ward Vandewege | |
77 | 1 | Tom Clegg | git checkout origin/example/rails3 |
78 | 2 | Ward Vandewege | |
79 | (git will complain about being in a detached head state, but that's fine - just don't commit to this state) |
||
80 | |||
81 | Now look around, test |
||
82 | 1 | Tom Clegg | |
83 | 2 | Ward Vandewege | git log |
84 | |||
85 | 4 | Tom Clegg | Switch to production branch (set up with @git checkout --track origin/rails3@ if you haven't already) and make sure it's up-to-date |
86 | 2 | Ward Vandewege | |
87 | git checkout rails3 |
||
88 | 4 | Tom Clegg | git pull origin rails3 |
89 | 2 | Ward Vandewege | |
90 | 5 | Tom Clegg | See what hasn't been merged |
91 | |||
92 | git cherry -v rails3 origin/example/rails3 |
||
93 | |||
94 | 1 | Tom Clegg | Cherry-pick a commit |
95 | |||
96 | git cherry-pick e68ab19 |
||
97 | |||
98 | 2 | Ward Vandewege | Or merge the entire remote tree (this will fetch and merge but not yet commit) |
99 | |||
100 | git merge --no-commit origin/tomc/rails3 |
||
101 | |||
102 | When you're happy, |
||
103 | |||
104 | git commit |
||
105 | |||
106 | Or rewind |
||
107 | |||
108 | git reset --hard rails3 |
||
109 | |||
110 | Finally, push |
||
111 | 1 | Tom Clegg | |
112 | git push |
||
113 | 5 | Tom Clegg | |
114 | h2. Deploying to my-dev |
||
115 | |||
116 | 6 | Tom Clegg | Basics |
117 | |||
118 | sudo gem install capistrano |
||
119 | |||
120 | 10 | Tom Clegg | Make sure "ssh root@www-dev.sum" puts you in root@www-dev and that *you have an SSH agent available.* You might need in @~/.ssh/config@: |
121 | 1 | Tom Clegg | |
122 | 6 | Tom Clegg | Host www-dev.sum |
123 | 1 | Tom Clegg | HostName www-dev |
124 | 6 | Tom Clegg | |
125 | Check out production branch |
||
126 | |||
127 | git checkout rails3 |
||
128 | |||
129 | Deploy to www-dev |
||
130 | |||
131 | cap deploy |
||
132 | |||
133 | 11 | Ward Vandewege | The capistrano task will run any required db migrations automatically. If you ever need to run them manually, you can do this (on www-dev): |
134 | 6 | Tom Clegg | |
135 | 1 | Tom Clegg | ssh root@www-dev.sum sh -c "'cd /var/www/my-dev.personalgenomes.org/current && RAILS_ENV=staging rake db:migrate'" |
136 | 9 | Tom Clegg | |
137 | 7 | Tom Clegg | h2. Deploying to production server |
138 | |||
139 | 10 | Tom Clegg | Make sure "ssh root@www-prod.sum" puts you in root@www-prod and that you have a working SSH agent. |
140 | 7 | Tom Clegg | |
141 | Check out production branch |
||
142 | |||
143 | git checkout rails3 |
||
144 | |||
145 | Deploy to www-prod |
||
146 | |||
147 | cap deploy -f Capfile.production |
||
148 | |||
149 | 11 | Ward Vandewege | The capistrano task will run any required db migrations automatically. If you ever need to run them manually, you can do this (on www-prod): |
150 | 7 | Tom Clegg | |
151 | 9 | Tom Clegg | ssh root@www-prod.sum sh -c "'cd /var/www/my.personalgenomes.org/current && RAILS_ENV=production rake db:migrate'" |