Continuous Integration
Setup Git server
- Install Java if not installed - https://java.com/en/download/
- Install Git server
- Download http://dl.bintray.com/gitblit/releases/gitblit-1.8.0.zip and unpack it
- Open new cmd.exe window
- Go to unpacked folder:
example: cd C:\Users\IEUser\Downloads\gitblit-1.8.0 - Run command:
java -jar gitblit.jar --httpPort 80 - Now in your browser open 'http://localhost' you should see running Git server:
- Create git remote repository
- Login as admin(username: 'admin', password: 'admin')
- Click 'repositories'
- Click 'new repository'
- Fill in repository data
name: osm-testing
Access Policy: Restrict Push (Authenticated... - Click 'create'
- Now new repository should be created:
- Now you need to copy repository URL - click on 'URL' and copy line starting with 'http'
example: http://admin@localhost/r/osm-testing.git - Push changes to Git server
- Open 'Git Bash' and configure:
git config --global user.email "you@example.com"
git config --global user.name "Your Name" - Navigate to folder which contains our testing code(Hint: use 'cd' command)
- Initialize git local repository:
git init - Add remote repository:
git remote add origin <url copied in step 3.7>
example: git remote add origin http://admin@localhost/r/osm-testing.git - Push all your changes to remote repository(If needed use 'admin' as password):
git add *
git commit -m 'Initial commit'
git push origin master - Go to 'http://localhost/tree/osm-testing.git' and you should be able to see all our files
Setup Jenkins server
- Download Jenkins war file:
https://jenkins.io/download/
http://mirrors.jenkins.io/war-stable/latest/jenkins.war - Start Jenkins server
- Open command line promt(cmd.exe)
- Navigate to folder where jenkins.war is located
- Start Jenkins server:
java -jar jenkins.war
- Remember admin password:
- Go to Jenkins server - Open 'localhost:8080' in browser
- Enter password
- Choose 'Install suggested plugins'
- Set up admin user
- Set proper git.exe path
- click 'Manage Jenkins'
- click 'Global Tool Configuration'
- set 'Path to Git executable' with path to Git: 'C:\Program Files\Git\bin\git.exe' (default location)
- Save
Create Jenkins job
- Click 'create new job'
- Enter job name 'osm_test_job'
- choose 'Freestyle project'
- in 'Build Triggers' check 'Poll SCM' and in 'Schedule' type:
H/5 * * * * - in 'Source Code Management' choose 'Git' and fill
'Repository URL' with 'git://localhost/osm-testing.git' - in 'Build' click 'Add build step' and choose 'Execute Windows batch command' and enter:
easy_selenium_cli.py tests --with-xunit --xunit-file=test_results.xml -b gc - in 'Post-build Actions' click 'Add post-build action' and choose 'Publish JUnit test results' in 'Test report XMLs' type 'test_results.xml'
- click 'Save'
- click 'Build'
- After build is finished you should see test results:
Next
Try:- Add new test
- Push to git
- Check that after 5 mins all tests are executed in CI
This comment has been removed by the author.
ReplyDelete