Skip to content

Commit

Permalink
Update qbittorrent-nox-static.sh
Browse files Browse the repository at this point in the history
Update matrix_multi_build_and_release_customs_tags.yml

Update matrix_multi_build_and_release_customs_tags.yml

wf

v2

Update qbittorrent-nox-static.sh
  • Loading branch information
userdocs committed Apr 7, 2023
1 parent 8cd0f08 commit dedbb74
Show file tree
Hide file tree
Showing 6 changed files with 2,115 additions and 1,750 deletions.
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,29 @@ insert_final_newline = true
indent_style = tab
indent_size = 4

[{**.*sh,test/run,**.bats}]
indent_size = 4
indent_style = tab

shell_variant = bash
binary_next_line = true # like -bn
switch_case_indent = true # like -ci
space_redirects = true # like -sr
keep_padding = false # like -kp
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[**.md]
indent_size = 4
indent_style = space

[**.bats]
indent_size = tab
indent_style = tab
shell_variant = bats

[.vscode/settings.json]
indent_style = tab
indent_size = 4
Expand Down
221 changes: 131 additions & 90 deletions .github/workflows/matrix_multi_build_and_release_customs_tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,53 @@ name: matrix multi build and release - customs tags

on:
workflow_dispatch:
inputs:
distinct_id:
skip_rerun:
description: "Skip rerun?"
required: true
type: boolean
retries:
description: "Number of rerun retries"
required: true
default: "5"
type: choice
options: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os_id: [alpine]
os_version_id: [edge]
arch_type: [x86_64, armhf, armv7, aarch64]
qbittorrent_tag: ["-qt release-4.3.9"]

name: "${{ matrix.arch_type }}-libtorrent-v1.2"
qbt_libtorrent_version: [1.2]
qbt_qt_version: [5]
qbt_build_tool: [qmake]
qbt_qbittorrent_tag: [release-4.3.9]
arch_type:
[
armel,
armhf,
armv7,
aarch64,
x86_64,
x86,
s390x,
powerpc,
ppc64el,
mips,
mipsel,
mips64,
mips64el,
riscv64,
]

name: "${{ matrix.arch_type }}-qbittorent-nox-legacy"

env:
build_dir: "qbt-build"
qbt_build_dir: "qbt-build"
name: "${{ matrix.arch_type }}-libtorrent-v1.2"
draft_status: true
outputs:
Expand All @@ -30,30 +61,42 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Host - phased updates
run: printf '%s\n' 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates

- name: Host - set up lunar repo -t lunar
run: |
printf '%b\n' 'Package: *\nPin: release n=lunar\nPin-Priority: 50' | sudo tee /etc/apt/preferences
printf '%b\n' 'deb http://archive.ubuntu.com/ubuntu/ lunar main universe restricted' | sudo tee /etc/apt/sources.list.d/lunar.list
- name: Host - update
run: sudo apt-get update

- name: Host - upgrade
run: sudo apt-get -y upgrade

- name: Host - Install host qemu-static
run: sudo apt-get install -y qemu binfmt-support qemu-user-static

- name: Host - Docker multiarch bootstrap
run: sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Host - set up qemu-user-static binfmt-support from lunar
run: sudo apt install -t lunar libpipeline1 qemu-user-static binfmt-support

- name: Host - Create Docker template env file
run: |
echo "qbt_build_tool=qmake" > env.custom
echo "qbt_cross_name=${{ matrix.arch_type }}" >> env.custom
echo "qbt_libtorrent_version=1.2" >> env.custom
echo "qbt_qt_version=5" >> env.custom
echo "qbt_patches_url=${{ github.repository }}" >> env.custom
echo "qbt_workflow_files=yes" >> env.custom
echo "qbt_libtorrent_master_jamfile=no" >> env.custom
echo "qbt_optimise_strip=yes" >> env.custom
echo "qbt_revision_url=${{ github.repository }}" >> env.custom
echo "qbt_workflow_type=legacy" >> env.custom
printf '%s\n' "qbt_libtorrent_version=${{ matrix.qbt_libtorrent_version }}" > env.custom
printf '%s\n' "qbt_qt_version=${{ matrix.qbt_qt_version }}" >> env.custom
printf '%s\n' "qbt_build_tool=${{ matrix.qbt_build_tool }}" >> env.custom
printf '%s\n' "qbt_cross_name=${{ matrix.arch_type }}" >> env.custom
printf '%s\n' "qbt_patches_url=${{ github.repository }}" >> env.custom
printf '%s\n' "qbt_skip_icu=no" >> env.custom
# printf '%s\n' "qbt_boost_tag=" >> env.custom
# printf '%s\n' "qbt_libtorrent_tag=" >> env.custom
# printf '%s\n' "qbt_qt_tag=" >> env.custom
printf '%s\n' "qbt_qbittorrent_tag=${{ matrix.qbt_qbittorrent_tag }}" >> env.custom
printf '%s\n' "qbt_libtorrent_master_jamfile=no" >> env.custom
printf '%s\n' "qbt_workflow_files=yes" >> env.custom
printf '%s\n' "qbt_workflow_artifacts=no" >> env.custom
# printf '%s\n' "qbt_cache_dir= >> env.custom
printf '%s\n' "qbt_optimise_strip=yes" >> env.custom
printf '%s\n' "qbt_build_debug=no" >> env.custom
printf '%s\n' "qbt_revision_url=${{ github.repository }}" >> env.custom
- name: Host - Create docker multiarch container
run: docker run --name multiarch -it -d --env-file env.custom -w /root -v ${{ github.workspace }}:/root ${{ matrix.os_id }}:${{ matrix.os_version_id }}
Expand All @@ -65,7 +108,7 @@ jobs:
run: docker exec -w /root multiarch apk add bash

- name: Docker - Bootstrap
run: docker exec -w /root multiarch bash qbittorrent-nox-static.sh ${{ matrix.qbittorrent_tag }} -bs-a
run: docker exec -w /root multiarch bash qbittorrent-nox-static.sh -bs-a

- name: Docker - zlib-ng
run: docker exec -w /root multiarch bash qbittorrent-nox-static.sh zlib
Expand All @@ -85,96 +128,94 @@ jobs:
- name: Docker - libtorrent
run: docker exec -w /root multiarch bash qbittorrent-nox-static.sh libtorrent

- name: Docker - qtbase -i
run: docker exec -w /root multiarch bash qbittorrent-nox-static.sh qtbase -i
- name: Docker - qtbase
run: docker exec -w /root multiarch bash qbittorrent-nox-static.sh qtbase

- name: Docker - qttools
run: docker exec -w /root multiarch bash qbittorrent-nox-static.sh qttools

- name: Docker - qbittorrent
run: docker exec -w /root multiarch bash qbittorrent-nox-static.sh ${{ matrix.qbittorrent_tag }} qbittorrent
run: docker exec -w /root multiarch bash qbittorrent-nox-static.sh qbittorrent

- name: Docker - Set release asset name
run: docker exec -w /root/${{ env.build_dir }}/completed multiarch mv -f qbittorrent-nox ${{ matrix.arch_type }}-qbittorrent-nox
run: docker exec -w /root/${{ env.qbt_build_dir }}/completed multiarch mv -f qbittorrent-nox ${{ matrix.arch_type }}-qbittorrent-nox

- name: Host - Bootstrap release tag
id: release_tag
run: |
echo "release_tag=$(cat ${{ env.build_dir }}/release_info/tag.md)" >> $GITHUB_ENV
echo "release_tag=$(cat ${{ env.build_dir }}/release_info/tag.md)" >> $GITHUB_OUTPUT
- name: Docker - Release Info
run: docker exec -w /root/${{ env.qbt_build_dir }}/release_info multiarch bash -c 'mv *.md *.json '/root/${{ env.qbt_build_dir }}/completed''

- name: Host - Bootstrap release title
run: echo "release_title=$(cat ${{ env.build_dir }}/release_info/title.md)" >> $GITHUB_ENV

- name: Compare latest release tag to release_tag
id: draft_status
run: |
latest_release_tag="$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name')"
if [[ "${latest_release_tag}" == "${{ env.release_tag }}" ]]; then
echo "draft_status=false" >> $GITHUB_ENV
echo "draft_status=false" >> $GITHUB_OUTPUT
else
echo "draft_status=true" >> $GITHUB_OUTPUT
fi
- name: Host - Create release - tag - assets
id: release_id
uses: ncipollo/release-action@v1
- name: Host - Upload libtorrent-${{ matrix.arch_type }}-qbittorrent-nox and release info artifact
uses: actions/upload-artifact@v3
with:
prerelease: "false"
draft: "${{ env.draft_status }}"
commit: "${{ github.ref }}"
artifacts: "${{ env.build_dir }}/completed/${{ matrix.arch_type }}-qbittorrent-nox,${{ env.build_dir }}/release_info/dependency-version.json"
replacesArtifacts: true
tag: "${{ env.release_tag }}"
name: "${{ env.release_title }}"
bodyFile: "${{ env.build_dir }}/release_info/release.md"
allowUpdates: true
token: "${{ secrets.GITHUB_TOKEN }}"

publish_draft:
if: needs.build.outputs.draft_status == 'true'
name: Publish draft release
runs-on: ubuntu-22.04
name: libtorrent-${{ matrix.arch_type }}-qbittorrent-nox
path: |
${{ env.qbt_build_dir }}/completed/*
!${{ env.qbt_build_dir }}/completed/*.png
release:
runs-on: ubuntu-latest
permissions:
contents: write
needs: build
steps:
- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.build.outputs.draft_id }}
if: always() && contains(needs.*.result, 'success') && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')

name: "Publish release libtorrent-v${{ matrix.libtorrent_version }}"

publish_revision:
if: needs.build.outputs.draft_status == 'false'
name: Publish revision info
runs-on: ubuntu-22.04
needs: build
env:
revision_url: "https://github.com/${{ github.repository }}/releases/download/${{ needs.build.outputs.release_tag }}/dependency-version.json"
qbt_build_dir: "qbt-build"

steps:
- name: Revision Version
- name: Checkout
uses: actions/checkout@v3

- name: Pandoc - Bootstrap
run: |
pandoc_git_tag="$(git ls-remote -q -t --refs https://github.com/jgm/pandoc.git | awk '/tags\/[0-9]/{sub("refs/tags/", ""); print $2 }' | awk '!/^$/' | sort -rV | head -n 1)"
curl -sLo- "https://github.com/jgm/pandoc/releases/latest/download/pandoc-${pandoc_git_tag}-linux-amd64.tar.gz" | tar xzf - --strip-components 2 -C "$(pwd)" --exclude="share"
- name: Host - Download qbittorrent-nox artifacts
uses: actions/download-artifact@v3

- name: Host - artifacts organise for release
run: |
until curl -sLf "${{ env.revision_url }}" > remote-dependency-version.json; do
echo "waiting for URL."
sleep 2
mkdir -p "releases"
for files in libtorrent-*-qbittorrent-nox; do
cp -rf ${files}/* "releases/"
done
cat remote-dependency-version.json
- name: Host - merge release-info
run: |
paste -d '\n' releases/qt5-*-release.md | uniq > tmp-release.md
./pandoc --wrap=preserve -f gfm tmp-release.md -t gfm -o release.md
revision_version="$(jq -r '.revision' remote-dependency-version.json)"
mv -f releases/qt5-dependency-version.json dependency-version.json
jq -r ".revision=\"$((revision_version +1 ))\"" remote-dependency-version.json --indent 4 > dependency-version.json
- name: Host - Bootstrap release tag
run: printf '%s\n' "release_tag=$(cat releases/tag.md)" >> $GITHUB_ENV

cat dependency-version.json
- name: Host - Bootstrap release title
run: printf '%s\n' "release_title=$(cat releases/title.md)" >> $GITHUB_ENV

- name: Host - Update release
- name: Host- Create release - tag - assets
uses: ncipollo/release-action@v1
with:
artifacts: "dependency-version.json"
prerelease: false
artifacts: "releases/*-qbittorrent-nox,dependency-version.json"
replacesArtifacts: true
tag: "${{ needs.build.outputs.release_tag }}"
tag: "${{ env.release_tag }}"
name: "${{ env.release_title }}"
bodyFile: "release.md"
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
token: "${{ secrets.GITHUB_TOKEN }}"

rerun-on-failure:
if: failure() && inputs.skip_rerun == '0'
name: rerun-on-failure
needs: release
permissions:
actions: write
runs-on: ubuntu-latest
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
steps:
- uses: actions/checkout@v3
- name: Trigger rerun workflow on job failures
run: gh workflow run rerun.yml -f run_id=${{ github.run_id }} -f attempts=${{ github.run_attempt }} -f retries=${{ inputs.retries }}
41 changes: 41 additions & 0 deletions .github/workflows/rerun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: rerun failed jobs with gh cli

on:
workflow_dispatch:
inputs:
run_id:
required: true
attempts:
required: true
retries:
required: true

jobs:
gh-cli-rerun:
name: rerun - attempt ${{ inputs.attempts }}
permissions:
actions: write
runs-on: ubuntu-latest
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
steps:
- name: Host - Checkout action
uses: actions/checkout@v3

- name: gh cli rerun and summaries
if: inputs.attempts < inputs.retries
run: |
failures="$(gh run view ${{ inputs.run_id }} --log-failed | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g")"
[[ -z "${failures}" ]] && failures="$(gh run view ${{ inputs.run_id }} | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g")"
gh run rerun ${{ inputs.run_id }} --failed
printf '%b\n' "# gh cli workflow reruns" >> $GITHUB_STEP_SUMMARY
printf '\n%b\n' ":octocat: Here is a summary of inputs from the failed workflow" >> $GITHUB_STEP_SUMMARY
printf '\n%b\n' "🟥 Failures at:\n\n\`\`\`log\n${failures}\n\`\`\`" >> $GITHUB_STEP_SUMMARY
printf '\n%b\n' "🟦 Attempt: ${{ inputs.attempts }} - Rerun failed jobs in ${{ inputs.run_id }} :hammer:" >> $GITHUB_STEP_SUMMARY
if gh run watch ${{ inputs.run_id }} --exit-status; then
printf '\n%b\n' "✅ Attempt: ${{ inputs.attempts }} succeeded 😺" >> $GITHUB_STEP_SUMMARY
else
printf '\n%b\n' "❌ Attempt: ${{ inputs.attempts }} failed 😾" >> $GITHUB_STEP_SUMMARY
fi
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/*
package-lock.json
package.json
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ The `qbittorrent-nox-static-legacy` is a fully static build of qBittorrent 4.3.9

Or uses these commands for your arch:

### x86

```bash
mkdir -p ~/bin && source ~/.profile
wget -qO ~/bin/qbittorrent-nox https://github.com/userdocs/qbittorrent-nox-static-legacy/releases/latest/download/x86-qbittorrent-nox
chmod 700 ~/bin/qbittorrent-nox
```


### x86_64

```bash
Expand Down
Loading

0 comments on commit dedbb74

Please sign in to comment.