Handle GitHub url with a branch

This commit is contained in:
Maniack Crudelis 2020-04-30 01:13:22 +02:00
parent a865689c84
commit d00cd37f5d
3 changed files with 17 additions and 0 deletions

View file

@ -184,6 +184,7 @@ Le script `package_check.sh` accepte 6 arguments en plus du package à tester.
- `--bash-mode`: Rend le script autonome. Aucune intervention de l'utilisateur ne sera nécessaire. - `--bash-mode`: Rend le script autonome. Aucune intervention de l'utilisateur ne sera nécessaire.
La valeur de auto_remove est ignorée. La valeur de auto_remove est ignorée.
- `--branch=nom-de-branche`: Teste une branche du dépôt plutôt que de tester master. Permet de tester les pull request. - `--branch=nom-de-branche`: Teste une branche du dépôt plutôt que de tester master. Permet de tester les pull request.
Vous pouvez utiliser une url avec une branche, https://github.com/YunoHost-Apps/APP_ynh/tree/my_branch, pour utiliser implicitement cet argument.
- `--build-lxc`: Installe LXC et créer le conteneur debian Yunohost si nécessaire. - `--build-lxc`: Installe LXC et créer le conteneur debian Yunohost si nécessaire.
- `--force-install-ok`: Force la réussite des installations, même si elles échouent. Permet d'effectuer les tests qui suivent même si l'installation a échouée. - `--force-install-ok`: Force la réussite des installations, même si elles échouent. Permet d'effectuer les tests qui suivent même si l'installation a échouée.
- `--interrupt`: Force l'option auto_remove à 0, le script marquera une pause avant chaque suppression d'application. - `--interrupt`: Force l'option auto_remove à 0, le script marquera une pause avant chaque suppression d'application.

View file

@ -184,6 +184,7 @@ The `package_check.sh` script accept 6 arguments in addition of the package to b
- `--bash-mode`: The script will work without user intervention. - `--bash-mode`: The script will work without user intervention.
auto_remove value is ignored auto_remove value is ignored
- `--branch=branch-name`: Check a branch of the repository instead of master. Allow to check a pull request. - `--branch=branch-name`: Check a branch of the repository instead of master. Allow to check a pull request.
You can use an url with a branch, https://github.com/YunoHost-Apps/APP_ynh/tree/my_branch, to implicitly use this argument.
- `--build-lxc`: Install LXC and create the Debian YunoHost container if necessary. - `--build-lxc`: Install LXC and create the Debian YunoHost container if necessary.
- `--force-install-ok`: Force success of installations, even if they fail. Allow to perform following tests even if an installation fails. - `--force-install-ok`: Force success of installations, even if they fail. Allow to perform following tests even if an installation fails.
- `--interrupt`: Force auto_remove value, break before each remove. - `--interrupt`: Force auto_remove value, break before each remove.

View file

@ -490,6 +490,21 @@ fi
echo "Pick up the package which will be tested." echo "Pick up the package which will be tested."
# If the url is on a specific branch, extract the branch
if echo "$app_arg" | grep --quiet --extended-regexp "https?:\/\/.*\/tree\/"
then
gitbranch="-b ${app_arg##*/tree/}"
app_arg="${app_arg%%/tree/*}"
fi
ECHO_FORMAT "Test the package $app_arg" "blue" "bold"
if [ -n "$gitbranch" ]
then
ECHO_FORMAT " on the branch ${gitbranch##-b }.\n" "blue" "bold"
else
ECHO_FORMAT ".\n" "blue" "bold"
fi
# Remove the previous package if it's still here. # Remove the previous package if it's still here.
rm -rf "$script_dir"/*_check rm -rf "$script_dir"/*_check