From 8fb8cc42c69b90133978d4907adce6fe7de224ec Mon Sep 17 00:00:00 2001 From: XiangRongLin <41164160+XiangRongLin@users.noreply.github.com> Date: Sat, 27 Nov 2021 18:08:35 +0100 Subject: [PATCH 1/6] Migrate to github actions from travis CI --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ .travis.yml | 19 ------------------- 2 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9432539 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: linkcheck + +on: + push: + branches: + - master + pull_request: + +jobs: + linkcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: set up python 3 + uses: actions/setup-python@v2 + with: + python-version: '3.x' + cache: 'pip' + + - name: install dependencies + run: pip install -r requirements.txt + + - name: Verify links + run: python linkcheck.py diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a358363..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: python - -python: - - "3.6" - -branches: - only: - - master - -before_install: - - "pip3 install -U pip" - - "export PYTHONPATH=$PYTHONPATH:$(pwd)" - -cache: pip -install: - - pip install -r requirements.txt - -script: python linkcheck.py - From c55155d0e871c6365410f480625138de8e314e09 Mon Sep 17 00:00:00 2001 From: XiangRongLin <41164160+XiangRongLin@users.noreply.github.com> Date: Sun, 28 Nov 2021 21:01:26 +0100 Subject: [PATCH 2/6] Add 5 second timeout for http request --- linkcheck.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linkcheck.py b/linkcheck.py index 4beb724..63f358c 100755 --- a/linkcheck.py +++ b/linkcheck.py @@ -20,7 +20,7 @@ for filename in os.listdir(): checkstring = "# " + link.replace("#", "").replace("-", " ") if not checkstring in filedata.lower(): RETURN_VALUE = 1 - print(filename + ": Could not find target for" + link) + print(filename + ": Could not find target for " + link) else: if link.startswith("img/"): link = BASE_URL + "/" + link @@ -31,7 +31,7 @@ for filename in os.listdir(): RETURN_VALUE = 1 print(filename + ": " + link + " is not https") else: - res = requests.get(link) + res = requests.get(link, timeout=5) if res.status_code != 200: RETURN_VALUE = 1 print(filename + ": " + link + " returns " + str(res.status_code)) From a718c89e0791828326a2d3980b30d45ce7fd2de1 Mon Sep 17 00:00:00 2001 From: XiangRongLin <41164160+XiangRongLin@users.noreply.github.com> Date: Sun, 28 Nov 2021 21:01:59 +0100 Subject: [PATCH 3/6] Fix most errors from linkcheck --- docs/00_Prepare_everything.md | 2 +- docs/03_Implement_a_service.md | 2 +- docs/06_releasing.md | 10 +++++----- linkcheck.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/00_Prepare_everything.md b/docs/00_Prepare_everything.md index 39bca47..a1b6315 100644 --- a/docs/00_Prepare_everything.md +++ b/docs/00_Prepare_everything.md @@ -25,7 +25,7 @@ First and foremost, you need to meet the following conditions in order to write - A dev environment/IDE that supports: - __[Git](https://git-scm.com/downloads/guis)__ - - __[Java 8](https://www.java.com/en/download/faq/java8.xml)__ + - __[Java 8](https://adoptium.net/?variant=openjdk8&jvmVariant=hotspot)__ - __[Gradle](https://gradle.org/)__ - __[Unit testing](https://junit.org/junit5/)__ - [IDEA Community](https://www.jetbrains.com/idea/) (Strongly recommended, but not required) diff --git a/docs/03_Implement_a_service.md b/docs/03_Implement_a_service.md index 120cf49..515c4a2 100644 --- a/docs/03_Implement_a_service.md +++ b/docs/03_Implement_a_service.md @@ -34,7 +34,7 @@ ask us to introduce a new library than start using Regex too often. - Html/XML Parsing: [jsoup](https://jsoup.org/apidocs/overview-summary.html) - JSON Parsing: [nanojson](https://github.com/mmastrac/nanojson#parser-example) -- JavaScript Parsing/Execution: [Mozilla Rhino](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Documentation) +- JavaScript Parsing/Execution: [Mozilla Rhino](https://github.com/mozilla/rhino) - Link detection in strings: [AutoLink](https://github.com/robinst/autolink-java) If you need to introduce new libraries, please tell us before you do so. diff --git a/docs/06_releasing.md b/docs/06_releasing.md index 1a0ea1a..0256f56 100644 --- a/docs/06_releasing.md +++ b/docs/06_releasing.md @@ -74,9 +74,9 @@ For NewPipe, this means: __Don't do a release if you don't have time for it!!!__ By following the steps listed below, you can publish a stable version of NewPipe: -1. [Merge the translations from Weblate into NewPipe](../07_maintainers_view#merge-changes-from-weblate-into-newpipe). +1. [Merge the translations from Weblate into NewPipe](../08_maintainers_view#merge-changes-from-weblate-into-newpipe). 2. Update your local __dev__ branch and create a [changelog file](#changelog-file). - Make sure to push the changes and [update Weblate](../07_maintainers_view#update-weblate). + Make sure to push the changes and [update Weblate](../08_maintainers_view#update-weblate). 3. In your local NewPipe repo, fork the __dev__ branch into a new __release/x.y.z__ branch. 4. Increase the [version number](#version-nomenclature) and update the version code in the `build.gradle` file. 5. Open a pull request form the new __release/x.y.z__ branch into the __master__ branch. @@ -96,7 +96,7 @@ PRs which aim to fix regressions of the upcoming release need to target the __re Read [Quickfixes](#quickfixes) for more info. The changelogs are translated during the test phase. -Therefore, [the translations need to be merged from Weblate](../07_maintainers_view#merge-changes-from-weblate-into-newpipe) once more. +Therefore, [the translations need to be merged from Weblate](../08_maintainers_view#merge-changes-from-weblate-into-newpipe) once more. The translation commit is cherry-picked into the release branch. Once testing is done and the release branch does not contain critical regressions, and you think the update is ready, @@ -122,7 +122,7 @@ _Don't update the actual version number. :P_ ### Releasing Once the glorious day of all days has come, and you fulfill the ceremony of releasing. -After going through the release procedure of [creating a new release](#create_a_new_release) +After going through the release procedure of [creating a new release](#creating-a-new-release) and maybe a few [quickfixes](#quickfixes) on the new release, this is what you should do when releasing: @@ -275,7 +275,7 @@ For this reason it is recommended to keep the changelog at 400 bytes. When creating the changelog file be aware of changes which were done in the extractor as well. Before pushing the changelog to NewPipe's repo, ask other maintainers to review it. -After pushing the changelog to NewPipe's GitHub repo, [updating Weblate](07_maintainers_view/#update-webalte) is necessary. +After pushing the changelog to NewPipe's GitHub repo, [updating Weblate](../08_maintainers_view#update-weblate) is necessary. This enables translators to work on localized versions of the changelog before a release is tagged and published. ## Publish on F-Droid diff --git a/linkcheck.py b/linkcheck.py index 63f358c..608dff4 100755 --- a/linkcheck.py +++ b/linkcheck.py @@ -18,7 +18,7 @@ for filename in os.listdir(): for link in re.findall('\[.*\]\(([^\)]*)\)', filedata): if link.startswith("#"): checkstring = "# " + link.replace("#", "").replace("-", " ") - if not checkstring in filedata.lower(): + if not checkstring in filedata.lower().replace("-", " "): RETURN_VALUE = 1 print(filename + ": Could not find target for " + link) else: From 604acd36d10a6894e8d15c758e10ae0ddd55de09 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sun, 28 Nov 2021 21:53:09 +0100 Subject: [PATCH 4/6] Use docker container for link check --- .github/workflows/ci.yml | 25 ------------------------- .github/workflows/linkcheck.yml | 16 ++++++++++++++++ ci/docker-linkcheck.sh | 16 ++++++++++++++++ 3 files changed, 32 insertions(+), 25 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/linkcheck.yml create mode 100644 ci/docker-linkcheck.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 9432539..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: linkcheck - -on: - push: - branches: - - master - pull_request: - -jobs: - linkcheck: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: set up python 3 - uses: actions/setup-python@v2 - with: - python-version: '3.x' - cache: 'pip' - - - name: install dependencies - run: pip install -r requirements.txt - - - name: Verify links - run: python linkcheck.py diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml new file mode 100644 index 0000000..df006f4 --- /dev/null +++ b/.github/workflows/linkcheck.yml @@ -0,0 +1,16 @@ +name: linkcheck + +on: + push: + branches: + - master + pull_request: + +jobs: + linkcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Verify links + run: bash ci/docker-linkcheck.sh diff --git a/ci/docker-linkcheck.sh b/ci/docker-linkcheck.sh new file mode 100644 index 0000000..29c1bdd --- /dev/null +++ b/ci/docker-linkcheck.sh @@ -0,0 +1,16 @@ +#! /bin/bash + +set -e +set -o pipefail +set -x + +this_dir="$(readlink -f -- "$(dirname -- "${BASH_SOURCE[0]}")")" +image="python:3-alpine" + +# as we use a pipe to stdin and thus cannot use -it, Ctrl-C does not work by default +# turns out that combining -i with --init solves that problem +# see https://stackoverflow.com/a/60812082 +docker run --rm -i -v "$this_dir"/..:/ws -w /ws --init "$image" sh <<\EOF + pip install -r requirements.txt + python linkcheck.py +EOF From b8555f01f256928a6b3a288857d8481985686efc Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sun, 28 Nov 2021 21:58:04 +0100 Subject: [PATCH 5/6] Add workflow_dispatch trigger --- .github/workflows/linkcheck.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index df006f4..9ae100c 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -5,6 +5,7 @@ on: branches: - master pull_request: + workflow_dispatch: jobs: linkcheck: From ef4b54e558b5cc15acac75de4085c827b52bd45a Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sun, 28 Nov 2021 21:58:32 +0100 Subject: [PATCH 6/6] Ignore temporary editor backups --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index dd11e35..13677be 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea site/ +*.*swp