Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • R3/school/courses
  • vilem.ded/courses
  • todor.kondic/courses
  • noua.toukourou/courses
  • nene.barry/courses
  • laurent.heirendt/courses
  • marina.popleteeva/courses
  • jenny.tran/courses
8 results
Show changes
Commits on Source (274)
Showing
with 430 additions and 19 deletions
......@@ -10,9 +10,9 @@ rm -rf $rootDir/public
rm -rf $rootDir/theme
mkdir $rootDir/public
if [[ $CI_COMMIT_BRANCH == "develop" ]]; then
if [[ $CI_COMMIT_REF_NAME == "develop" ]]; then
version="latest";
elif [[ $CI_COMMIT_BRANCH == "master" ]]; then
elif [[ $CI_COMMIT_REF_NAME == "master" ]]; then
version="stable";
else
version="unstable";
......@@ -33,7 +33,7 @@ nBlades=0
for d in $(find . -maxdepth 1 -type d)
do
if [[ "${d}" == *20* ]]; then
cd "${d}"
pushd "${d}"
echo "changed to ${d}"
for d1 in $(find . -maxdepth 1 -type d)
do
......@@ -46,20 +46,23 @@ do
# create the required folders in public
mkdir -p $rootDir/public/$BLADE/$version
# change to the blade directory to be built
cd $BLADE
echo "going to $BLADE..."
pushd $BLADE
# run contribute
cp ../../template/Gruntfile.coffee .
ln -s ../../theme/package.json package.json
ln -s ../../theme theme
cp -v ../../template/Gruntfile.coffee .
ln -sv ../../theme/package.json package.json
ln -sv ../../theme theme
# install npm
yarn global add grunt-cli generator-reveal
echo "installing deps"
yarn add grunt-cli generator-reveal grunt
yarn install
grunt dist
mv public/* $rootDir/public/$BLADE/$version/.
echo "running dist"
yarn exec grunt dist
echo "copying to common public dir"
cp -rLv public/* $rootDir/public/$BLADE/$version/.
echo " > latest built for file set ${BLADE}"
......@@ -75,10 +78,10 @@ do
echo "autoredirect file set"
# move back out
cd ..
popd
echo " > -----------------------------------------------------"
fi
done
cd "${rootDir}"
popd
fi
done
......@@ -19,7 +19,7 @@ localroot = os.getcwd()
# generate the index properly speaking
cardDirs = ["2020", "2019"]
cardDirs = ["2023", "2022", "2021", "2020", "2019"]
index=''
# determine first the directories
......@@ -68,4 +68,4 @@ with open(indexFile, 'w') as file:
file.write(filedata)
print("\n > New index generated and saved in " + indexFile)
os.chdir("..")
\ No newline at end of file
os.chdir("..")
*.ai
site/
courses.lcsb.uni.lu
index.html
......@@ -22,3 +23,4 @@ package.json
./theme/package.json
__pycache__/
contribute.egg-info/
.*.swp
......@@ -56,7 +56,7 @@ build:website:
JEKYLL_ENV: production
build:courses:
image: git-r3lab.uni.lu:4567/r3/docker/nodejs-yarn-grunt
image: node:19-bullseye
stage: build
rules:
- if: $CI_COMMIT_BRANCH == "develop"
......@@ -72,6 +72,7 @@ upload:
stage: deploy
image: alpine
before_script:
- apk add rsync
- 'which ssh-agent || ( apk add --update openssh )'
- eval $(ssh-agent -s)
- echo "$B64SSHPRIVKEY" | base64 -d | tr -d '\r' | ssh-add - > /dev/null
......@@ -83,5 +84,5 @@ upload:
- if: $CI_COMMIT_BRANCH == "develop"
- if: $CI_COMMIT_BRANCH == "master"
script:
- scp -P $SSHPORT -r site/* $SSHCONNECT:~/web/latest
- scp -P $SSHPORT -r public/* $SSHCONNECT:~/web/latest
- rsync -ravu --info=progress2 -e "ssh -p $SSHPORT" site/* $SSHCONNECT:~/web/latest
- rsync -ravu --info=progress2 -e "ssh -p $SSHPORT" public/* $SSHCONNECT:~/web/latest
[submodule "theme"]
path = theme
url = https://git-r3lab.uni.lu/R3/outreach/theme.git
url = https://gitlab.lcsb.uni.lu/R3/outreach/theme.git
# Best practices
* `pull` before `push` and, generally, before starting to work
* Work on your <font color="red">own</font> branch (in your own fork), and **not** on `master` and **not** on `develop`
* Do **not push** to `master`, but **submit a Pull Request (PR)**
* Get your code **reviewed** by your peers (submit a PR!)
* Submit a PR **often**!
* `clone` a repository, do not download the `.zip` file.
* Do **not** combine `git` commands
```bash
$ git commit -am "myMessage" # do not do this
```
* Stage only 1 file at once using
```bash
$ git add myFile.md
```
* Commit **only a few files** at once (after multiple separate `git add` commands)
* `Push` often - avoid conflicts
Remember: **A `push` a day keeps conflicts away!**
# Development scheme
Generally, in a repository, there are guidelines for contributing.
<div class="fragment">
A common development scheme is dual with a:
- **development** version of the code on `develop`
- **stable** version of the code on `master`
A **version** of the code is referred to as a **branch**.
<div class="fragment">
<img src="slides/img/icon-live-demo.png" height="100px">
<font color="red">In the practice repository, the development branch is called `develop`!</font>
<div class="fragment">
![bulb](slides/img/bulb.png) Use this dual development scheme for your own repositories!
# Branches
A **version** of the code (i.e., a **branch**) is made up of a sequence of code changes.
<div class="fragment">
These individual code changes are called **commits**.
For instance, the `master` and `develop` branches can be represented as a timeline:
<img src="slides/img/branch-master.png" class="branch-master" height="500em"/>
# Switch between branches
List all branches of the repository with
```bash
$ git branch -a
```
Exit by typing `q`. The branch with the * is the current branch.
<div class="fragment">
Checkout another branch
```bash
$ git checkout <branchName>
```
<div class="fragment">
You can switch to the `develop` branch with
```bash
$ git checkout develop
```
If the local branch does not exist but the remote does, it is created automatically.
<div class="fragment">
<img src="slides/img/icon-live-demo.png" height="100px">
# Create your own version
Assume that you want to work on a file:
<div class="fragment">
<font color="red">Create a new **branch**!</font>
```bash
$ git checkout -b myBranch
```
The `-b` flag creates the branch. Locally, you have your own version now:
<img src="slides/img/branch-create.png" class="branch-create" height="500em"/>
Push your version to your fork:
```bash
$ git push origin myBranch
```
<div class="fragment">
<img src="slides/img/icon-live-demo.png" height="100px">
# How do I start working on a repository?
You have to `clone` it first:
```bash
$ git clone git@github.com:LCSB-BioCore/basic-git-practice.git
```
If you did not configure your SSH key, clone using HTTPS:
```bash
$ git clone https://github.com/LCSB-BioCore/basic-git-practice.git
```
You will be prompted to enter your credentials.
# How to configure `git`?
```bash
$ git config --global user.name "Firstname Lastname"
$ git config --global user.email "first.last@uni.lu"
```
Test whether your username and email have been registered
```bash
$ git config --list
```
This should list the configuration with `user.name` and `user.email`.
Exit by typing `q`.
# What is an SSH key?
An SSH key is a secure access credential.
**Principle**: <br><br>
Communicate **securely** with Github/Gitlab **without** entering the username/password.
# How do I get and set my SSH key?
Check if you already have an SSH key:
```bash
$ ls -al ~/.ssh
```
If there are 2 files named `id_rsa`, you have an SSH key.
If you don’t have yet an SSH key, you have to generate one:
```bash
$ ssh-keygen -t rsa -b 4096
```
If you set a password to your key (recommended), add it to the `ssh-agent`:
```bash
$ eval "$(ssh-agent -s)"
$ ssh-add -K ~/.ssh/id_rsa
```
Then, add the SSH key to Github/Gitlab.
<img src="slides/img/icon-live-demo.png" height="100px">
\ No newline at end of file
# The 5 essential commands
**Yes**, you only need 5 commands!
`pull, status, add, commit, push`
or in other words (remember these!):
```bash
$ git pull <remote> <branch>
$ git status
$ git add myFile.md # example
$ git commit -m "myMessage" # example
$ git push <remote> <branch>
```
# Pull the latest version of an existing branch
Pull the latest revision on branch `myBranch`:
```bash
$ git pull origin myBranch
# Already up to date
```
<div class="fragment">
Verify its `status` with:
```bash
$ git status
```
# Modify a file
Copy the file `firstnameLastname.md` in the folder `_attendees` and rename it with your firstname:
```bash
$ cd _attendees
$ cp firstnameLastname.md myName.md
```
Then, make your changes with your favorite editor!
<br><br>
Reference for markdown: https://howto.lcsb.uni.lu/?contribute:markdown
# Add your file to the stage
First, check the repository status
```bash
$ git status
# uncommitted changes (displayed in red)
```
<div class="fragment">
Now, add the file (bring it on stage)
```bash
$ git add myName.md # replace myName
$ git status
# returns the same as before, generally in green (means staged)
```
<div class="fragment">
**ADVANCED**: If there have been more changes after the file has been added, you can see your changes in the terminal
```bash
$ git diff
```
exit with `q`.
<br>
![bulb](slides/img/bulb.png) If it is a long diff, you can display additional lines with space.
# Add a commit message
```bash
$ git commit -m "Add the profile of <myName>"
$ git status
```
# Push your file to your fork
```bash
$ git push origin myBranch
```
<div class="fragment">
**ADVANCED**: see the log of all the commits (and your last one) in the terminal
```bash
$ git log
```
exit by typing `q`.
\ No newline at end of file
# What is a `fork`?
<center>
<img src="slides/img/fork.jpg" class="as-is" height="500em"/>
</center>
<!--http://www.cndajin.com/data/wls/246/22302193.jpg-->
# Not really ...
<center>
<img src="slides/img/fork-crossed.png" class="as-is" height="500em"/>
</center>
# What is a `fork`?
- In general, when contributing to a repository, you only have **read** access.
- In other words, you can only **pull** (unless it is your own repository or access has been granted).
- In general, you **cannot write** changes. In other words, you do not have **push** access.
- You have to work on your **own copy**.
- In other words, you have to work on your own <font color="red">**fork**</font>.
# How to get a fork?
Browse to the original repository and click on the button `Fork`:
![Fork the repo](https://help.github.com/assets/images/help/repository/fork_button.jpg)
<img src="slides/img/icon-live-demo.png" height="100px">
# Time to practice!
Fork the practice repository: <br><br>
https://github.com/LCSB-BioCore/basic-git-practice<br><br>
Then, clone your fork to your home directory!
<img src="slides/img/icon-live-demo.png" height="100px">
```bash
$ git clone git@github.com:<yourName>/basic-git-practice.git
```
Change to the practice directory with:
```bash
$ cd basic-git-practice
```
<img src="slides/img/icon-live-demo.png" height="100px">
If you did not configure your SSH key, clone using HTTPS:
```bash
$ git clone https://github.com/<yourName>/basic-git-practice.git
```
# A note on shortcuts ...
<font color="red">
Any other rudimentary method such as
*'I simply download the `.zip` and unzip it - works like a charm!'*
shall **be avoided**!
</font>
<br>
**Why?**
# How to update my fork?
As you have your own fork, it will not automatically be updated once the original repository is updated.
![bulb](slides/img/bulb.png) You have to update it yourself!
<br>
**More on that later!**
# GitHub and GitLab
<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub" style="width: 200px;"/>
<img src="https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo-extra-whitespace.png" alt="GitLab" style="width: 200px;"/>
GitHub and GitLab are VCS systems.
GitHub/Gitlab are both **publicly available**, but GitLab can be **on-premise**.
Positive point: GitHub and GitLab are (almost) the same.
<img src="slides/img/icon-live-demo.png" height="100px">
- **GitHub**: [https://github.com](https://github.com)
- Public GitLab: [https://gitlab.com](https://gitlab.com)
- LCSB specific: [https://git-r3lab.uni.lu](https://git-r3lab.uni.lu)
../../../../2020/2020-03-30_basicGitTraining/slides/img/Git-Logo-Black.png
\ No newline at end of file
../../../../2020/2020-03-30_basicGitTraining/slides/img/branch-create.png
\ No newline at end of file
../../../../2020/2020-03-30_basicGitTraining/slides/img/branch-master.png
\ No newline at end of file
../../../../2020/2020-03-30_basicGitTraining/slides/img/branch-merge.png
\ No newline at end of file
../../../../2020/2020-03-30_basicGitTraining/slides/img/bulb.png
\ No newline at end of file
../../../../2020/2020-03-30_basicGitTraining/slides/img/computerCode.png
\ No newline at end of file
2021/2021-03-18_basicGitTraining/slides/img/elixir.png

165 KiB

../../../../2020/2020-03-30_basicGitTraining/slides/img/favicon.ico
\ No newline at end of file