-
Notifications
You must be signed in to change notification settings - Fork 9
Add GitHub workflow workshop content #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3260974
Create readme file
Bachibouzouk a536523
Add draft of presentation
Bachibouzouk 10c9b3f
Add slide for preparing code review
Bachibouzouk e68a990
Add __pycache__ files to gitignore
Bachibouzouk 72a11d1
Add main dummy code
Bachibouzouk a35699b
Add recipes modules
Bachibouzouk ce650fa
Add cooking techniques modules
Bachibouzouk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| .ipynb_checkpoints/ | ||
| .idea/ | ||
| .idea/ | ||
| **/__pycache__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
|
|
||
|
|
||
|
|
||
| ## Setup for the workshop | ||
|
|
||
| 1. create a branch `fake_main` to mimic a conflict without impacting `main` | ||
|
|
||
| add cake and pie code | ||
| move pie to a different module | ||
|
|
||
|
|
||
| ## Reference | ||
| https://docs.github.com/en/get-started/quickstart/github-flow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from src.cakes import banana_cake | ||
| from src.sauces import vanilla_sauce | ||
|
|
||
| my_banana_cake = banana_cake("flour", "banana", "sugar", "milk") | ||
| a_vanilla_sauce = vanilla_sauce("eggs", "milk", "vanilla", "sugar") | ||
|
|
||
| print(a_vanilla_sauce) |
120 changes: 120 additions & 0 deletions
120
github workflow/presentation/presentation_github_workflow.tex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| \documentclass{beamer} | ||
|
|
||
| \input{template/2019-08-23-rli-beamer-template-stylev0-0.tex} | ||
| \setbeamertemplate{footline}[frame number] | ||
| \usepackage{amsmath} | ||
| \usepackage{tikz} | ||
| \usepackage{listings} | ||
|
|
||
| % Overlays for TIKZ pictures | ||
| \tikzset{ | ||
| invisible/.style={opacity=0}, | ||
| visible on/.style={alt={#1{}{invisible}}}, | ||
| alt/.code args={<#1>#2#3}{% | ||
| \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path | ||
| }, | ||
| } | ||
|
|
||
| \title[Yo]{\textbf{SimRunde Workshop} \\ Github workflow} | ||
| \author{Pierre-Francois Duc\\ | ||
| } | ||
| \institute{Reiner Lemoine Institut} | ||
| \date{\today} | ||
|
|
||
| \begin{document} | ||
|
|
||
| \begin{frame} | ||
| \titlepage | ||
| \end{frame} | ||
|
|
||
| \begin{frame}{Why should you care?} | ||
|
|
||
| \begin{enumerate} | ||
| \item Help make the changes in the code more transparent, important for open\_source | ||
| \item Help reviewing and reviewing help avoiding bugs | ||
| \item Issue and resolution can be linked | ||
| \end{enumerate} | ||
|
|
||
| \end{frame} | ||
|
|
||
| \begin{frame}{Agenda} | ||
| \begin{enumerate} | ||
| \item Branch out | ||
| \item Commiting changes | ||
| \item Push changes and create pull request (or merge request for gitlab) | ||
| \item Interacting on the pull request (from now on PR) | ||
| \item Preparing for code review | ||
| \item CI and checks, protecting branches | ||
| \item Merging the PR | ||
| \end{enumerate} | ||
|
|
||
| \end{frame} | ||
|
|
||
| \begin{frame}{Branch out} | ||
|
|
||
| Main or develop (or dev) branch should not be used to push daily commits, one should work in a dedicated branch | ||
|
|
||
|
|
||
| {\tt git checkout main} | ||
|
|
||
| {\tt git pull} | ||
|
|
||
| {\tt git checkout -b feature/nameyoucomeupwith} | ||
|
|
||
|
|
||
| \end{frame} | ||
|
|
||
| \begin{frame}{Commiting changes} | ||
|
|
||
| Make changes locally and ``save'' them by commiting them, a commit can be parts of a file or several files or whole files. The idea is that a commit should be a conceptual change like ``Correct spelling mistakes'', or ``Improved paragraph 1 by elaborating on the benefit of berries on the diet''. Typically changes done reworking and entire book chapter for many hours should ideally not be packed into one commit. What is important is to still make the commits and push them to the remote to have backup of your work (and show your chefs you are making progress). | ||
|
|
||
| {\tt git push} | ||
|
|
||
| \end{frame} | ||
|
|
||
| \begin{frame}{Create pull request} | ||
| Once you pushed your changes, github will automatically propose you to open a Pull Request, so you can click on the green button, don't worry you can edit most of its content later. You can even flag it as Draft Request to indicate that this is not ready yet for review. | ||
| \end{frame} | ||
|
|
||
| \begin{frame}{Interacting on pull request} | ||
| \begin{itemize} | ||
| \item Comments (suggestions) | ||
| \item View changes | ||
| \item Commit view (come back on it after rework) | ||
| \item Linking with open Issues | ||
| \end{itemize} | ||
|
|
||
| \end{frame} | ||
|
|
||
| \begin{frame}{Preparing for code review} | ||
|
|
||
| Reset commits but keep changes | ||
|
|
||
| {\tt git checkout dev } | ||
| {\tt git pull } | ||
| {\tt git checkout feature/nameyoucomeupwith }(without the -b because it exists) | ||
| {\tt git rebase -i dev } | ||
| (solve potential conflicts) | ||
|
|
||
| {\tt git reset --soft dev } | ||
|
|
||
|
|
||
| Make thoughful commits | ||
|
|
||
| {\tt git push -f } (if you are alone on the branch it is ok, careful if more than one working on the branch) | ||
|
|
||
| \end{frame} | ||
|
|
||
| \begin{frame}{CI and checks} | ||
| If we have time | ||
| \end{frame} | ||
|
|
||
| \begin{frame}{Merging the PR} | ||
| After it has been reviewed and approved, the person making the changes should normally merge the PR and delete the branch. | ||
|
|
||
| \end{frame} | ||
|
|
||
|
|
||
|
|
||
| \end{document} | ||
|
|
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| from src.utils.cooking_techniques import mix, bake | ||
|
|
||
| def banana_cake(*ingredients): | ||
|
|
||
| dough = mix(*ingredients) | ||
| return bake(dough) | ||
|
|
||
| def cheesecake(*ingredients): | ||
| dough = mix(*ingredients) | ||
| return bake(dough) | ||
|
|
||
| def pekan_pie(*ingredients): | ||
|
Comment on lines
+8
to
+12
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More specific about many lines
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dsasfdsdsa |
||
| dough = mix(*ingredients) | ||
| return bake(dough) | ||
|
|
||
|
|
||
|
|
||
|
|
||
| def cake(*ingredients, cake_name=""): | ||
| dough = mix(*ingredients) | ||
| return f"{bake(dough)}for {cake_name}" | ||
|
|
||
| def banana_cake(*ingredients): | ||
|
|
||
| return cake(*ingredients, cake_name="banana cake") | ||
|
|
||
| def cheesecake(*ingredients): | ||
| return cake(*ingredients, cake_name="cheesecake") | ||
|
|
||
| def pekan_pie(*ingredients): | ||
| return cake(*ingredients, cake_name="pekan_pie") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| from src.utils.cooking_techniques import stir | ||
|
|
||
| def vanilla_sauce(*ingredients): | ||
| return stir(*ingredients) |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| def mix(*ingredients): | ||
| return ",".join(ingredients) | ||
|
|
||
|
|
||
| def bake(dough): | ||
| return f"baked {dough}" | ||
|
|
||
|
|
||
| def stir(*ingredients): | ||
| return mix(*ingredients) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.