Skip to content
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

Gnome-Shell 43 compatibility update. #26

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/report-an-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Report an issue
about: Any issue relating to build/sync of this fork
title: ''
labels: ''
assignees: ''

---

As noted in the README.md, this fork of
`paradoxxxzero/gnome-shell-system-monitor-applet` is for packaging purposes
only. Any issues, bug reports, feature requests, etc. for the extension
itself should be submitted to the [upstream
repo](https://github.com/paradoxxxzero/gnome-shell-system-monitor-applet),
but build/sync issues should be reported here.
10 changes: 10 additions & 0 deletions .github/sync-failed-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Sync has failed
assignees: mgalgs
---
YIIIIIKES!!! Better check out recent Actions failures!

Last failure:

- Date: `{{ date | date('') }}`
- URL: {{ env.GITHUB_SERVER_URL }}/{{ env.GITHUB_REPOSITORY }}/actions/runs/{{ env.GITHUB_RUN_ID }}
31 changes: 31 additions & 0 deletions .github/workflows/syncer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Repo syncer
on:
schedule:
- cron: "0 */6 * * *"
push:
branches:
- master # We mostly rely on the above cron schedule but having this
# push handler is handy so that we re-sync after making
# changes to our GA workflows or scripts. Unfortunately,
# since this workflow can actually push to master it could
# trigger itself a second time, but that second run shouldn't
# have any updates so it will just complete quietly.
jobs:
sync_plz_thx:
name: Sync and push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0' # fetch all history
token: ${{ secrets.PAT }}
- name: ./actions/syncer/
uses: ./actions/syncer/
- name: The job has failed
if: ${{ failure() }}
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
filename: .github/sync-failed-template.md
update_existing: true
23 changes: 23 additions & 0 deletions .github/workflows/uploader.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Extension uploader
on:
push:
branches:
- master
paths:
- 'system-monitor@paradoxxx.zero.gmail.com/**'
jobs:
upload_plz_thx:
name: Uploader
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ./actions/uploader/
uses: ./actions/uploader/
env:
USERNAME: ${{ secrets.GNOME_USERNAME }}
PASSWORD: ${{ secrets.GNOME_PASSWORD }}
- name: Archive extension zipball
uses: actions/upload-artifact@v2
with:
name: zipball
path: dist/system-monitor@paradoxxx.zero.gmail.com.zip
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ ZIPFILE=$(UUID)$(VSTRING).zip

zip-file: build.clean build
$(Q)cd _build ; zip $(V) -qr $(ZIPFILE) .
$(Q)mkdir -p dist
$(Q)mv _build/$(ZIPFILE) ./dist/$(ZIPFILE)
$(call msg,$@,OK)

Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
![Extension uploader](https://github.com/mgalgs/gnome-shell-system-monitor-applet/workflows/Extension%20uploader/badge.svg)
![Repo syncer](https://github.com/mgalgs/gnome-shell-system-monitor-applet/workflows/Repo%20syncer/badge.svg)

This fork of `paradoxxxzero/gnome-shell-system-monitor-applet` is for
packaging purposes only. This fork contains Github Actions workflows
([here](.github/workflows)) to continuously sync against the upstream
`master` branch and upload the resulting build to extensions.gnome.org
([system-monitor-next](https://extensions.gnome.org/extension/3010/system-monitor-next/)).

Any issues, bug reports, feature requests, etc. for the extension itself
should be submitted to the [upstream
repo](https://github.com/paradoxxxzero/gnome-shell-system-monitor-applet),
but build/sync issues should be reported here.

The approach in this repo is preferable for users on bleeding edge
distributions who prefer not to wait for a stable release from the main
repo. Of course, since we're releasing directly from `master` some
instability is inevitable.

## GNOME Shell system monitor extension

[![Build Status](https://travis-ci.com/paradoxxxzero/gnome-shell-system-monitor-applet.svg?branch=master)](https://travis-ci.com/paradoxxxzero/gnome-shell-system-monitor-applet)
Expand Down
6 changes: 6 additions & 0 deletions actions/syncer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM debian:buster

RUN apt update && apt install -y git

COPY . /app
CMD ["/app/run.sh"]
5 changes: 5 additions & 0 deletions actions/syncer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
image: run.sh
docker build . -t mgalgs/system-monitor-next-syncer

# shouldn't ever need to push this image since it's built on-demand by
# GitHub Actions.
1 change: 1 addition & 0 deletions actions/syncer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This action rebases this fork from upstream and pushes the result.
27 changes: 27 additions & 0 deletions actions/syncer/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

set -e

mkdir -pv ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts

git config --global user.email mitch.special@gmail.com
git config --global user.name "Mitchel Humpherys"
git config --global http.postBuffer 1048576000

git remote add upstream https://github.com/paradoxxxzero/gnome-shell-system-monitor-applet.git

echo "Remotes:"
git remote -v

git fetch upstream
git rebase upstream/master || {
echo "Couldn't rebase against upstream :(. Please rebase manually."
# Right now the repo is in a mangled state, awaiting merge conflict
# resolution. Abort the rebase to ensure that all of our fork patches
# are present for subsequent actions.
git rebase --abort
exit 1
}
echo "After rebase: next=$(git rev-parse master) upstream=$(git rev-parse upstream/master)"
git push --force origin master
1 change: 1 addition & 0 deletions actions/uploader/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/env/
24 changes: 24 additions & 0 deletions actions/uploader/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM debian:buster

ENV LANG="en_US.UTF-8"
RUN apt update && apt install -y curl

RUN apt install -y \
bc \
build-essential \
chromium \
chromium-driver \
gettext \
gir1.2-clutter-1.0 \
gir1.2-gtop-2.0 \
gir1.2-nm-1.0 \
git \
libglib2.0-bin \
python3-dev \
python3-pip \
unzip \
zip

RUN pip3 install selenium
COPY . /app
CMD ["/app/run.sh"]
5 changes: 5 additions & 0 deletions actions/uploader/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
image: upload.py run.sh
docker build . -t mgalgs/system-monitor-next-uploader

# shouldn't ever need to push this image since it's built on-demand by
# GitHub Actions.
6 changes: 6 additions & 0 deletions actions/uploader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This is a dockerized script for uploading new versions of this extension to
extensions.gnome.org under GitHub Actions. Selenium is used to login and
upload the extension since there's no upload API on the extensions web
site.

The docker image is automatically built on-demand by GitHub Actions.
13 changes: 13 additions & 0 deletions actions/uploader/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -e

[[ -d ./system-monitor@paradoxxx.zero.gmail.com ]] || {
echo "Please execute this script from the root of the extension repo"
exit 1
}
make zip-file clean
export USERNAME
export PASSWORD
export ZIPBALL=./dist/system-monitor@paradoxxx.zero.gmail.com.zip
python3 /app/upload.py
62 changes: 62 additions & 0 deletions actions/uploader/upload.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import os
import sys

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options


class MyDriver(webdriver.Chrome):
def __init__(self, *args, **kwargs):
options = Options()
options.add_argument('headless')
options.add_argument("no-sandbox")
options.add_argument("disable-dev-shm-usage")
options.add_experimental_option('detach', True)
super().__init__(options=options)

def find_by_css(self, selector):
return WebDriverWait(self, 10) \
.until(EC.element_to_be_clickable((By.CSS_SELECTOR, selector)))


def main(username, password, zipball_path):
login_url = 'https://extensions.gnome.org/accounts/login/?next=/upload/'

driver = MyDriver()

# login
driver.get(login_url)
ipt_username = driver.find_by_css('form.auth_form input#id_username')
ipt_password = driver.find_by_css('form.auth_form input#id_password')
btn_submit = driver.find_by_css('form.auth_form button[type=submit]')
ipt_username.send_keys(username)
ipt_password.send_keys(password)
print("Submitting login form")
btn_submit.click()

# submit new build
ipt_source = driver.find_by_css('input#id_source')
ipt_source.send_keys(zipball_path)
driver.find_by_css('#id_gplv2_compliant').click()
driver.find_by_css('#id_tos_compliant').click()
print("Submitting extension form")
driver.find_by_css('#container button[type=submit]').click()
print("Done!")


if __name__ == "__main__":
username = os.getenv('USERNAME')
password = os.getenv('PASSWORD')
zipball_path = os.getenv('ZIPBALL')

if not all([username, password, zipball_path]):
print(("Please set the following environment variables: "
"USERNAME, PASSWORD, ZIPBALL"))
sys.exit(1)

zipball_path = os.path.abspath(zipball_path)
print(f"Submitting {zipball_path} as {username}")
main(username, password, zipball_path)
6 changes: 5 additions & 1 deletion system-monitor@paradoxxx.zero.gmail.com/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,11 @@ const Battery = class SystemMonitor_Battery extends ElementBase {
this.icon_hidden = false;
this.percentage = 0;
this.timeString = '-- ';
this._proxy = StatusArea.aggregateMenu._power._proxy;
if (shell_Version => '43') {
this._proxy = StatusArea.quickSettings._system._systemItem._powerToggle._proxy;
} else {
this._proxy = StatusArea.aggregateMenu._power._proxy;
}
if (typeof (this._proxy) === 'undefined') {
this._proxy = StatusArea.battery._proxy;
}
Expand Down
10 changes: 5 additions & 5 deletions system-monitor@paradoxxx.zero.gmail.com/metadata.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"shell-version": ["3.26", "3.28", "3.30", "3.32", "3.34", "3.36", "40", "41", "42"],
"uuid": "system-monitor@paradoxxx.zero.gmail.com",
"name": "system-monitor",
"url": "https://github.com/paradoxxxzero/gnome-shell-system-monitor-applet",
"description": "Display system information in GNOME Shell status bar, such as memory, CPU, disk and battery usages, network rates…",
"shell-version": ["3.26", "3.28", "3.30", "3.32", "3.34", "3.36", "40", "41", "42", "43"],
"uuid": "system-monitor-next@paradoxxx.zero.gmail.com",
"name": "system-monitor-next",
"url": "https://github.com/mgalgs/gnome-shell-system-monitor-applet",
"description": "Display system information in GNOME Shell status bar, such as memory, CPU, disk and battery usages, network rates…\n\nThis fork of paradoxxxzero/gnome-shell-system-monitor-applet is for packaging purposes only. This extension is built and updated continuously with the upstream master branch.\n\nThis is preferable for users on bleeding edge distributions that prefer not to wait for a stable release from the main repo. Of course, since we're releasing directly from master some instability is inevitable.\n\nIf you get an error after updating, try restarting Gnome Shell with Alt-F2 then 'r'.",
"settings-schema": "org.gnome.shell.extensions.system-monitor",
"gettext-domain": "system-monitor",
"version": -1
Expand Down