From 5f26854afc6c0aff4fbec41a03e148aa3525f81e Mon Sep 17 00:00:00 2001 From: "forgejo-actions[bot]" Date: Thu, 7 Nov 2024 23:50:17 +0000 Subject: [PATCH] Inject custom workflow --- .../workflows/generate-dependencies-conf.yml | 48 ++++++++++++ .forgejo/workflows/generate-webrtc.yml | 74 +++++++++++++++++++ .forgejo/workflows/mirror-repository.yml | 52 +++++++++++++ 3 files changed, 174 insertions(+) create mode 100644 .forgejo/workflows/generate-dependencies-conf.yml create mode 100644 .forgejo/workflows/generate-webrtc.yml create mode 100644 .forgejo/workflows/mirror-repository.yml diff --git a/.forgejo/workflows/generate-dependencies-conf.yml b/.forgejo/workflows/generate-dependencies-conf.yml new file mode 100644 index 00000000000..d5a6bfdd412 --- /dev/null +++ b/.forgejo/workflows/generate-dependencies-conf.yml @@ -0,0 +1,48 @@ +on: + workflow_dispatch: + inputs: + ref_name: + description: 'webrtc version' + required: true + type: string + + push: + tags: + - 'v7*' + +jobs: + build-tarball: + name: Build tarball + runs-on: x86_64 + container: + image: alpine:3.19 + steps: + - name: Environment setup + run: apk add nodejs git zstd tar sed bash py3-httplib2 wget curl + - name: Getting variables + run: | + if test $GITHUB_REF_NAME == "ci" ; then + CI_REF_NAME=${{ inputs.ref_name }} + else + CI_REF_NAME=$GITHUB_REF_NAME + fi + echo $CI_REF_NAME > ci_ref_name + curl --silent https://raw.githubusercontent.com/signalapp/Signal-Desktop/$CI_REF_NAME/package-lock.json | grep "@signalapp/ringrtc\": \"" | awk '{print $2}' | tr -d ',' | tr -d '"' | head -n 1 > ringrtcver + curl --silent https://raw.githubusercontent.com/signalapp/Signal-Desktop/$CI_REF_NAME/package-lock.json | grep "@signalapp/libsignal-client\": \"" | awk '{print $2}' | tr -d ',' | tr -d '"' | head -n 1 > libsignalver + curl --silent https://raw.githubusercontent.com/signalapp/Signal-Desktop/$CI_REF_NAME/package-lock.json | grep "@signalapp/better-sqlite3\": \"" | awk '{print $2}' | tr -d ',' | tr -d '"' | head -n 1 > bsqlitever + read _bsqlitever < bsqlitever + curl --silent https://raw.githubusercontent.com/signalapp/better-sqlite3/v$_bsqlitever/deps/download.js | grep "const TOKENIZER_VERSION" | awk '{print $4}' | tr -d "'" | tr -d ';' | head -n 1 > stokenizerver + read _ringrtcver < ringrtcver + curl --silent https://raw.githubusercontent.com/signalapp/ringrtc/v$_ringrtcver/config/version.properties | awk -F '=' '{if($1 == "webrtc.version"){print $2}}' | head -n 1 > webrtcver + read _libsignalver < libsignalver + read _webrtcver < webrtcver + read _stokenizerver < stokenizerver + echo "_libsignalver=$_libsignalver" > dependencies.conf + echo "_ringrtcver=$_ringrtcver" >> dependencies.conf + echo "_webrtcver=$_webrtcver" >> dependencies.conf + echo "_stokenizerver=$_stokenizerver" >> dependencies.conf + - name: Package deployment + run: | + read CI_REF_NAME < ci_ref_name + echo "Sending to ${{ github.server_url }}/api/packages/mirrors/generic/signal-desktop/$CI_REF_NAME/dependencies.conf" + curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file dependencies.conf ${{ github.server_url }}/api/packages/mirrors/generic/signal-desktop/$CI_REF_NAME/dependencies.conf diff --git a/.forgejo/workflows/generate-webrtc.yml b/.forgejo/workflows/generate-webrtc.yml new file mode 100644 index 00000000000..61390356634 --- /dev/null +++ b/.forgejo/workflows/generate-webrtc.yml @@ -0,0 +1,74 @@ +on: + workflow_dispatch: + inputs: + ref_name: + description: 'webrtc version' + required: true + type: string + + push: + tags: + - 'v7.2*' + tags-ignore: + - '*-beta*' + +jobs: + build-tarball: + name: Build tarball + runs-on: x86_64 + container: + image: alpine:3.19 + env: + VPYTHON_BYPASS: manually managed python not supported by chrome operations + ZSTD_LIMIT: 0 + DEPOT_TOOLS_VER: ae3745656b1111c995e41ec70eaa4397eaea7951 + steps: + - name: Environment setup + run: apk add nodejs git zstd tar sed bash py3-httplib2 wget curl + - name: Getting depot_tools + run: | + git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git ./ + git fetch --depth 1 origin $DEPOT_TOOLS_VER + git checkout $DEPOT_TOOLS_VER + - name: Getting variables + run: | + echo $GITHUB_REF_NAME + if test $GITHUB_REF_NAME == "ci" ; then + echo ${{ inputs.ref_name }} > webrtcver + else + curl --silent https://raw.githubusercontent.com/signalapp/Signal-Desktop/$GITHUB_REF_NAME/package-lock.json | grep "@signalapp/ringrtc\": \"" | awk '{print $2}' | tr -d ',' | tr -d '"' | head -n 1 > ringrtcver + read _ringrtcver < ringrtcver + curl --silent https://raw.githubusercontent.com/signalapp/ringrtc/v$_ringrtcver/config/version.properties | awk -F '=' '{if($1 == "webrtc.version"){print $2}}' | head -n 1 > webrtcver + fi + - name: Fetching webrtc + run: | + read _webrtcver < webrtcver + echo "solutions = [{'name': 'src','url': 'https://github.com/signalapp/webrtc.git@$_webrtcver',}]" > .gclient + echo "target_cpu = ['x64', 'arm64']" >> .gclient + echo "target_cpu_only = True" >> .gclient + ./gclient sync --no-history --nohooks + - name: Preparing source + run: | + read _webrtcver < webrtcver + python3 'src/build/landmines.py' --landmine-scripts 'src/tools_webrtc/get_landmines.py' --src-dir 'src' + python3 'src/build/util/lastchange.py' -o 'src/build/util/LASTCHANGE' + scanelf -RA -F "%F" src > elf.list + while read file; do rm -f "$file"; done < elf.list + mv src webrtc-$_webrtcver + - name: Packaging source + run: | + read _webrtcver < webrtcver + tar -cf webrtc-$_webrtcver.tar --exclude="ChangeLog*" --exclude="testdata/" --exclude="test_data/" --exclude="android_rust_toolchain/toolchain/" --exclude="base/" --exclude=third_party/instrumented_libs/binaries --exclude-backups --exclude-caches-all --exclude-vcs webrtc-$_webrtcver + zstd --auto-threads=logical --ultra --long -22 -T"$ZSTD_LIMIT" -vv webrtc-$_webrtcver.tar -o webrtc-$_webrtcver.tar.zst + - name: Computing checksums + run: | + read _webrtcver < webrtcver + sha512sum webrtc-$_webrtcver.tar.zst > webrtc-$_webrtcver.tar.zst.sha512sum + sha256sum webrtc-$_webrtcver.tar.zst > webrtc-$_webrtcver.tar.zst.sha256sum + - name: Package deployment + run: | + read _webrtcver < webrtcver + echo "Sending to ${{ github.server_url }}/api/packages/mirrors/generic/webrtc/$_webrtcver/webrtc-$_webrtcver.tar.zst" + curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file webrtc-*.tar.zst ${{ github.server_url }}/api/packages/mirrors/generic/webrtc/$_webrtcver/webrtc-$_webrtcver.tar.zst + curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file webrtc-*.tar.zst.sha512sum ${{ github.server_url }}/api/packages/mirrors/generic/webrtc/$_webrtcver/webrtc-$_webrtcver.tar.zst.sha512sum + curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file webrtc-*.tar.zst.sha256sum ${{ github.server_url }}/api/packages/mirrors/generic/webrtc/$_webrtcver/webrtc-$_webrtcver.tar.zst.sha256sum diff --git a/.forgejo/workflows/mirror-repository.yml b/.forgejo/workflows/mirror-repository.yml new file mode 100644 index 00000000000..f494d5a3e4b --- /dev/null +++ b/.forgejo/workflows/mirror-repository.yml @@ -0,0 +1,52 @@ +on: + workflow_dispatch: + + schedule: + - cron: '@hourly' + +jobs: + mirror: + name: Pull from upstream + runs-on: x86_64 + container: + image: alpine:latest + env: + upstream: https://github.com/signalapp/Signal-Desktop + tags: 'v7*' + steps: + - name: Environment setup + run: apk add grep git sed coreutils bash nodejs + - name: Fetch destination + uses: actions/checkout@v4 + with: + fetch_depth: 1 + ref: ci + token: ${{ secrets.CODE_FORGEJO_TOKEN }} + - name: Missing tag detecting + run: | + git ls-remote $upstream "refs/tags/$tags" | grep -v '{' | sed 's|.*/||' > upstream_tags + git ls-remote ${{ github.server_url}}/${{ github.repository }} "refs/tags/$tags" | grep -v '{' | sed 's|.*/||' > destination_tags + cat upstream_tags destination_tags | tr ' ' '\n' | sort | uniq -u > missing_tags + echo "Missing tags:" + cat missing_tags + - name: Missing tag fetch + run: | + git remote add upstream $upstream + while read tag; do + git fetch upstream tag $tag --no-tags + done < missing_tags + - name: Packaging workflow injection + run: | + while read tag; do + git checkout $tag + git tag -d $tag + git checkout ci -- ./.forgejo + git config user.name "forgejo-actions[bot]" + git config user.email "dev@ayakael.net" + git commit -m 'Inject custom workflow' + git tag -a $tag -m $tag + done < missing_tags + - name: Push to destination + run: | # use http 1.1 due to http 2 stream not closing cleanly + git config --global http.version HTTP/1.1 + git push --force origin refs/tags/*:refs/tags/* --tags