## Collaborative & FAIR workflow ### Part 1: GitHub & Code review slides: [tinyurl.com/FAIRworkflow-part1](https://hackmd.io/@ambjQTu_QASE8UvZFvGL2A/SJdaGlbWi) --- ## Who are we? ### Yang Liu & Barbara Vreede Research Software Engineers Netherlands eScience Center -- ### ... and who are you? --- ## What we will do today (times are approximate) | | | |:---:|:---| | 10:00 | Introduction & quiz | | 11:00 | Pull Request workflow | | 12:00 | Code review | | | | --- ## Introduction - Authentication & troubleshooting - Recap of GitHub workflow [video] - Quiz --- ## Before we start! Please find three things: - Something red/pink/orange 🧮💕☢️ - Something yellow/white/beige ⚠️📝📔 - Something green/blue 🦠🧿 --- ## We will use them later for a quiz... --- #### but let's give them a try already :smiley_cat: Please turn on your camera :movie_camera: ! --- ### How long have you been awake today? 🟥 I just woke up... 🟧 🟨 About an hour, maybe two. ⬜️ 🟦 I've been up for hours! 🟩 --- ### How confident do you feel with Git? 🟥 Not at all. 🟧 🟨 I feel more confident every day. ⬜️ 🟦 I'm a happy and active user. 🟩 --- ### How do you authenticate? 🟥 with SSH 🟧 🟨 with HTTPS ⬜️ 🟦 I don't know 🟩 --- ## Let's check SSH: - Open a terminal - Enter: `ssh -T git@github.com` - You should get: ```clojure Hi [username]! You've successfully authenticated, but GitHub does not provide shell access. ``` you may also get something like this: ```clojure > The authenticity of host 'github.com (IP ADDRESS)' can't be established. > RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8. > Are you sure you want to continue connecting (yes/no)? ``` if you do, enter `yes` --- ## Did that work? If not: - work through [these steps](https://docs.github.com/en/authentication/connecting-to-github-with-ssh) to connect with SSH - Tip: **leave the passphrase empty!** - please let us know if you get stuck, we can help! --- ## Video: Peer review on GitHub - We will take 20 minutes for this video. Please watch at your own speed. - Write down questions, we will discuss them together. --- ! Note that the architecture in this video is slightly different from STEMMUS/SCOPE: #### Video (where `main` is called `master`): ```mermaid %%{init: { 'logLevel': 'debug', 'gitGraph': {'showBranches': true,'showCommitLabel': false}} }%% gitGraph commit id: "hello" branch develop commit checkout develop branch feature checkout feature commit commit checkout develop merge feature checkout main merge develop ``` #### STEMMUS/SCOPE: ```mermaid %%{init: { 'logLevel': 'debug', 'gitGraph': {'showBranches': true,'showCommitLabel': false}} }%% gitGraph commit branch feature commit commit checkout main merge feature ``` --- tinyurl.com/FAIRworkflow-video1 {%youtube 8fx-EaOUK2E %} --- ### :question: Questions? :question: --- Let's test your knowledge! --- Grab your 🟥🟧 / 🟨⬜️ / 🟩🟦 items and turn on your camera :movie_camera: ! --- #### A new git repository can be made with: 🟥 `git checkout` 🟧 🟨 `git init` ⬜️ 🟦 `git push` 🟩 --- #### After making a change, I update my git repository with: 🟥 `git commit` 🟧 🟨 `git pull` ⬜️ 🟦 `git checkout` 🟩 --- #### Downloading an existing repository can be done with: 🟥 `git clone` 🟧 🟨 `git push` ⬜️ 🟦 `git checkout` 🟩 --- #### Before I commit any new changes, I make sure to update my local repository with: 🟥 `git commit` 🟧 🟨 `git pull` ⬜️ 🟦 `git checkout` 🟩 --- #### I can move to another branch with: 🟥 `git commit` 🟧 🟨 `git pull` ⬜️ 🟦 `git checkout` 🟩 --- #### I can start a new branch using: 🟥 `git checkout -a new_branch_name` 🟧 🟨 `git checkout -b new_branch_name` ⬜️ 🟦 `git checkout -c new_branch_name` 🟩 --- #### Put the following commands in order you would use them in a workflow: 🟥 `add push commit pull` 🟧 🟨 `commit add pull push` ⬜️ 🟦 `pull add commit push` 🟩 --- ### How many correct answers did you get? 🟥 0-2 🟧 🟨 3-5 ⬜️ 🟦 6-7 🟩 --- ![](https://media.giphy.com/media/ely3apij36BJhoZ234/giphy-downsized-large.gif) --- ### Let's take a break! {%youtube Pm2BvdiZUXA %} --- ## Pull request workflow - Recap & demo - Show your skills --- ### Adding a feature: what is the first step? 🟥 Clone the repository 🟧 🟨 Open the code in an editor ⬜️ 🟦 Make an issue to discuss the new feature 🟩 --- ![](https://i.imgur.com/tTdJWYU.png) --- ### First step: an issue - What is missing? - Use tags to indicate the type of issue: - is it nice to have? 'enhancement' - Perhaps a 'good first issue' - Use the issue discussion to scope with collaborators and understand _what needs doing_. ```mermaid flowchart LR A[What is missing?] A --Tags--> K(Scoped Issue) A --Discussion--> K style K fill:#99f,stroke:#333,stroke-width:3px ``` --- ### Second step: implementation From the main branch, checkout a new feature: ```shell git checkout -b new-branch ``` Edit the code, add concise commits: ```shell git commit -am "commit message" ``` Push the code to the remote repository: ```shell git push -u origin new-branch ``` --- ### Third step: Pull Request At the remote repository, open a Pull Request: ![](https://i.imgur.com/qFg3eRO.png) Use it to reference the issue: ![](https://i.imgur.com/m4V3vT9.png) --- ### Good practices for Pull Requests - Be clear about the scope before you start - Keep the pull request focused and limited (big monsters take a looooooong time to merge!) - Be kind to a reviewer: clearly show what changed, and how to test it. - Write tests along with a new feature! --- ### Can you do it? - You should have accepted an invitation to work on [bvreede/ascii-art](https://github.com/bvreede/ascii-art). - If not: let us know now! --- #### Exercise: make a pull request! 1. Clone the repository 2. Run the project from your command line 3. What will you change? Make an [issue](https://github.com/bvreede/ascii-art/issues) 4. Create a new branch: `git checkout -b new-branch-name` (use your own name in the branch name to prevent confusion later) 5. Make edits, `add`, and `commit`. 6. Push the branch up to remote: `git push -u origin new-branch-name` 7. Make a [Pull Request](https://github.com/bvreede/ascii-art/issues), don't forget to reference your issue! --- # Questions? --- ### Let's take a break! {%youtube Pm2BvdiZUXA %} --- ## Code Review [demo] --- ### Exercise: code review 1. Choose a Pull Request to review. 2. Assign yourself so we know you are working on it!) 3. Review thoughtfully. Make at least: - one general comment - one inline comment - one suggestion for a change in the code 4. Submit your review. Do you have time left? Take a look at your own Pull Request and see if you can implement suggestions for improvement! --- ## Bonus: merge conflicts - We can now merge some Pull Requests. - Let's fix the merge conflicts that will inevitably arise! --- # Questions? --- ![](https://media.giphy.com/media/BYoRqTmcgzHcL9TCy1/giphy.gif) ---
{"metaMigratedAt":"2023-06-17T09:20:32.669Z","metaMigratedFrom":"YAML","title":"Collaborative and FAIR workflow - part 1, Github","breaks":true,"description":"Collaborate on GitHub for research software developers","slideOptions":"{\"theme\":\"solarized\"}","contributors":"[{\"id\":\"6a66e341-3bbf-4004-84f1-4bd916f18bd8\",\"add\":12872,\"del\":5454}]"}
    269 views