1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yunorunner_ynh.git synced 2024-09-03 20:36:13 +02:00

Merge pull request #25 from YunoHost-Apps/testing

Testing
This commit is contained in:
tituspijean 2022-01-10 21:36:00 +01:00 committed by GitHub
commit 4ac6342537
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 134 additions and 11 deletions

64
.github/workflows/updater.sh vendored Normal file
View file

@ -0,0 +1,64 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
current_yunorunner_release=$(grep -Po 'yunorunner_release="\K.*?(?=")' scripts/_common.sh)
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/commits/master" | jq -r '.commit.committer.date | split("T")[0] | gsub("-";".")')
yunorunner_release=$(curl --silent "https://api.github.com/repos/$repo/commits/master" | jq -r '.sha')
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if [[ ! "$version" > "$current_version" ]]; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
#=================================================
# UPDATE SOURCE FILES
#=================================================
sed -i "s/$current_yunorunner_release/$yunorunner_release/gi" scripts/_common.sh
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

50
.github/workflows/updater.yml vendored Normal file
View file

@ -0,0 +1,50 @@
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
# This file should be enough by itself, but feel free to tune it to your needs.
# It calls updater.sh, which is where you should put the app-specific update steps.
name: Check for new upstream releases
on:
# Allow to manually trigger the workflow
workflow_dispatch:
# Run it every day at 6:00 UTC
schedule:
- cron: '0 6 * * *'
jobs:
updater:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Run the updater script
/bin/bash .github/workflows/updater.sh
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade to v$VERSION"
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
base: testing
branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'
body: |
Upgrade to v${{ env.VERSION }}
draft: false

View file

@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
CI runner of YunoHost
**Shipped version:** 2021.09.22~ynh3
**Shipped version:** 2022.01.09~ynh1

View file

@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Runner d'intégration continue de YunoHost
**Version incluse :** 2021.09.22~ynh3
**Version incluse :** 2022.01.09~ynh1

View file

@ -1,6 +1,6 @@
;; Test complet
; pre-install
sudo git clone https://github.com/YunoHost/CI_package_check /home/CI_package_check
sudo git clone --quiet https://github.com/YunoHost/CI_package_check /home/CI_package_check
; Manifest
domain="domain.tld"
path="/path"

View file

@ -13,10 +13,19 @@ location __PATH__/ {
location __PATH__/logs {
alias /home/CI_package_check/logs/;
autoindex on;
default_type "text/plain";
}
location __PATH__/badges/ {
alias /home/CI_package_check/badges/;
autoindex on;
}
location __PATH__/summary/ {
alias /home/CI_package_check/summary/;
autoindex on;
etag off;
more_set_headers "Cache-control: max-age=300, s-maxage=300";
error_page 404 /ci/summary/empty.png;
}
}

View file

@ -6,7 +6,7 @@
"en": "CI runner of YunoHost",
"fr": "Runner d'intégration continue de YunoHost"
},
"version": "2021.09.22~ynh3",
"version": "2022.01.09~ynh1",
"url": "https://github.com/YunoHost/yunorunner",
"upstream": {
"license": "GPL-3.0-or-later",
@ -28,7 +28,7 @@
"nginx"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"

View file

@ -9,7 +9,7 @@ pkg_dependencies="python3-venv python3-dev python3-pip sqlite3"
yunorunner_repository="https://github.com/YunoHost/yunorunner"
yunorunner_release="0e87f07e8bcb1f3aee055a694f3c7198e22b4019"
yunorunner_release="de28fea3b51a3f5b4e3d0bdc956e2f172cea592c"
#=================================================
# PERSONAL HELPERS

View file

@ -79,7 +79,7 @@ fi
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped YunoRunner CI"
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped YunoRunner CI" --timeout=30
#=================================================
# MODIFY URL IN NGINX CONF

View file

@ -145,7 +145,7 @@ yunohost service add $app --description="$app daemon for YunoRunner"
ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI"
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" --timeout=30
#=================================================
# SETUP SSOWAT

View file

@ -113,7 +113,7 @@ yunohost service add $app --description="$app daemon for YunoRunner"
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI"
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" --timeout=30
#=================================================
# DEACTIVE MAINTENANCE MODE

View file

@ -183,7 +183,7 @@ yunohost service add $app --description="$app daemon for YunoRunner"
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI"
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" --timeout=30
#=================================================
# DEACTIVE MAINTENANCE MODE