sustainable software development in an academic setting
play

Sustainable Software Development in an Academic Setting 4th - PowerPoint PPT Presentation

Sustainable Software Development in an Academic Setting 4th International Symposium on Research and Education of Computational Science (RECS) University of Tokyo, October 1 st , 2019 Hartwig Anzt, Terry Cojean, Thomas Grtzmacher, Pratik Nayak,


  1. Sustainable Software Development in an Academic Setting 4th International Symposium on Research and Education of Computational Science (RECS) University of Tokyo, October 1 st , 2019 Hartwig Anzt, Terry Cojean, Thomas Grűtzmacher, Pratik Nayak, Mike Tsai Steinbuch Centre for Computing (SCC) These slides are available under: https://hartwiganzt.github.io/slides/SustainableSoftwareDevelopment.pdf www.kit.edu KIT – The Research University in the Helmholtz Association

  2. What we cover today To interactively participate in this course, you need a GitLab account. Versioning systems • Git workflow • • Please create an account (choose your name carefully!) • Please log in Git hosting sites • • https://gitlab.com/ Continuous Integration (CI) • For complete interactive participation (on Linux Systems): GitLab runners • Automated Testing • apt-get install git cmake g++ gcovr Unit Testing with Googletest • Software Documentation with Doxygen • Interactive webinar with the help of Terry Cojean Thomas Pratik Nayak Tobias Ribizel Mike Tsai Grützmacher Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 2

  3. What is a version control system? Version control system for tracking changes in computer files. Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 3

  4. What is a version control system? Version control system for tracking changes in computer files. Distributed version control • Coordinates work between multiple developers • Who made what changes and when • Revert back at any time • Local and remote repos • ü Keeps track of code history ü Takes “snapshots” of your files ü You decide when to take a snapshot by making a ”commit” ü You can visit any snapshot at any time Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 4

  5. Git Versioning System git init // Initialize local git repository Ø git add *files // Add file(s) to snapshot Ø git status // Check changes not yet in the snapshot Ø git commit *files // Take snapshot (commit changes) Ø git commit –m ‘put a comment on this commit’ *files Ø Git Cheat Sheet: https://www.git-tower.com/blog/git-cheat-sheet/ Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 5

  6. Git Versioning System git init // Initialize local git repository Ø git add *files // Add file(s) to snapshot Ø git status // Check changes not yet in the snapshot Ø git commit *files // Take snapshot (commit changes) Ø git commit –m ‘put a comment on this commit’ *files Ø Local Repository Git Cheat Sheet: https://www.git-tower.com/blog/git-cheat-sheet/ Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 6

  7. Git Versioning System git init // Initialize local git repository Ø git add *files // Add file(s) to snapshot Ø git status // Check changes not yet in the snapshot Ø git commit *files // Take snapshot (commit changes) Ø git commit –m ‘put a comment on this commit’ *files Ø Local Repository git push // Push local snapshots to remote repo Ø git pull // Get latest snapshot from remote repo Ø git clone *path/to/repo // Clone an existing remote repository Ø Remote Repository Git Cheat Sheet: https://www.git-tower.com/blog/git-cheat-sheet/ Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 7

  8. Git Hosting Sites They offer the environment for the remote repository. We may just choose GitLab for this course GitHub • Please create an account (choose your name carefully!) • Please log in • GitLab • https://gitlab.com/ • Bitbucket • https://en.wikipedia.org/wiki/Comparison_of_source-code-hosting_facilities … • Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 8

  9. Git Hands-On 1. We create an Account at GitLab and log in. 2. I create a project on GitLab ( \git@gitlab.com:hanzt/recs ) 3. I add a first source file and make it a public repository 4. You all clone or the project: git clone git clone git@gitlab. git@gitlab.co com:h m:hanz anzt/r /recs cs 5. You add your name to the local version of contributors.txt 6. You check your changes: git diff git diff 7. You commit your local changes: git git commit commit –m m ‘add ‘add my my name’ name’ contribut contributor ors.t s.txt xt 8. You push your local changes to the remote repository: git git push push origin origin master master 9. You fix ”merge conflicts” …. Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 9

  10. Continuous Integration (CI) Sometimes, someone introduces a bug that breaks the code… How do you find out the code is broken? • How do we find out who which code • clone integration introduced the bug? How can we make sure everything works • at any point in time? Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 10

  11. Continuous Integration (CI) Sometimes, someone introduces a bug that breaks the code… How do you find out the code is broken? • How do we find out who which code • clone integration introduced the bug? How can we make sure everything works • at any point in time? We need a mechanism that constantly checks the functionality of the master “branch”. Continuous Integration Sets up a pre-defined environment; • Clones the remote repository on a server; • Tries to compile and run all pre-defined tests; • Reports the outcome; • Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 11

  12. Continuous Integration on GitLab Load image of OS GitLab supports GitLab runners as CI feature. • Update OS They can be configured via adding the file .gitlab-ci.yml • Install packages needed: https://docs.gitlab.com/ee/ci/yaml/ git cmake g++ gcovr GitLab runner are set up via web interface. • Create directory Call CMake Build library gcov checks unit test coverage example .gitlab-ci.yml Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 12

  13. Software Testing Automated testing: Production Code Test Code The practice of writing code to test the code, and then run those tests in an automated fashion. Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 13

  14. Software Testing Automated testing: Production Code Test Code The practice of writing code to test the code, and then run those tests in an automated fashion. End-to-End tests: Check the applications functionality with its external dependencies and user input. Test complete workflow and application interaction. • Very slow and brittle. • Integration tests: Check the applications functionality with its external dependencies. Give more confidence in complex application. • Tests units/classes as whole. • Unit tests: Check the functionality and validity of each Many. Easy-to-write. Execute Fast. building block without its external dependencies. Track down bugs • Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 14

  15. Software Testing Automated testing: Production Code Test Code The practice of writing code to test the code, and then run those tests in an automated fashion. End-to-End tests: Check the applications functionality with its external dependencies and user input. Test complete workflow and application interaction. • Very slow and brittle. • Integration tests: Check the applications functionality with its external dependencies. Fewer. Dependencies. Give more confidence in complex application. • Tests units/classes as whole. • Unit tests: Check the functionality and validity of each Many. Easy-to-write. Execute Fast. building block without its external dependencies. Track down bugs • Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 15

  16. Software Testing Automated testing: Production Code Test Code The practice of writing code to test the code, and then run those tests in an automated fashion. End-to-End tests: Check the applications functionality with its external dependencies and user input. Few. Test complete workflow and application interaction. • Complex. Very slow and brittle. • Integration tests: Check the applications functionality with its external dependencies. Fewer. Dependencies. Give more confidence in complex application. • Tests units/classes as whole. • Unit tests: Check the functionality and validity of each Many. Easy-to-write. Execute Fast. building block without its external dependencies. Track down bugs • Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 16

  17. Unit tests with Googletest Framework to facilitate unit testing. • https://github.com/google/googletest • Let’s do an example. Much of this material is taken from Nikolaos Pothitos http://cgi.di.uoa.gr/~pothitos/ https://github.com/pothitos/gtest-demo-gitlab Hartwig Anzt: Sustainable Software Development in an Academic Setting 10/01/2019 17

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend