mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
The v13.18 release run: every wekan and wekan-gantt-gpl snap uploaded,
then sat in the Snap Store's "Status: processing" for hours. snapcraft
polls that with no limit, so GitHub cancelled the jobs at timeout-minutes
(2 h native, 6 h Launchpad). snap-upload-retry.sh now gives one upload
30 minutes (SNAP_UPLOAD_PROCESSING_BUDGET). A revision the store accepted
is left for the store to release to the channels sent with it, with a
warning, instead of uploading it again; an upload cut off before the
store accepted it is retried.
Bun android-arm64 died on a Termux mirror mid-sync ("File has unexpected
size ... Mirror sync in progress?") and Bun freebsd-x64 on an unreachable
FreeBSD package mirror. Termux installs (Bun, Android bundles) and the
i386 libraries of single-file now go through releases/apt-install.sh,
which learned Termux's prefix and lack of sudo. Every BSD VM prepare
retries its package install 5 times and says why when it gives up.
Thanks to xet7 !
407 lines
17 KiB
YAML
407 lines
17 KiB
YAML
name: Single-file WeKan
|
|
|
|
# One executable per platform (docs/Platforms/Single-File.md): that
|
|
# platform's published WeKan bundle - its Node.js, FerretDB and native
|
|
# addons, all built where they run - repackaged by releases/single-file/
|
|
# build.mjs as a Node.js single executable application whose ZIP Node mounts
|
|
# as a virtual file system. Nothing is compiled here.
|
|
#
|
|
# Per platform: verify the bundle's checksum, build the single file (on a Mac
|
|
# for macOS, which has to re-sign it), start it on a runner of that platform
|
|
# where GitHub has one (with a browser test on amd64), and attach it to the
|
|
# release. A platform whose bundle the release does not have yet - the BSDs
|
|
# until their Node.js is published, Android until it has a bundle - is
|
|
# SKIPPED, not failed, and starts building by itself once it does.
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Existing WeKan release tag (empty = latest published release)'
|
|
type: string
|
|
required: false
|
|
publish:
|
|
description: 'Attach the single files and checksums to that release'
|
|
type: boolean
|
|
default: true
|
|
only:
|
|
description: 'JSON target list, e.g. ["amd64","win64"] (empty = all)'
|
|
type: string
|
|
default: ''
|
|
missing_only:
|
|
description: 'Only the platforms whose single file the release does not have yet'
|
|
type: boolean
|
|
default: false
|
|
workflow_call:
|
|
inputs:
|
|
tag:
|
|
type: string
|
|
required: true
|
|
publish:
|
|
type: boolean
|
|
default: true
|
|
only:
|
|
type: string
|
|
default: ''
|
|
missing_only:
|
|
type: boolean
|
|
default: false
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: wekan-single-file-${{ inputs.tag || github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
plan:
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 10
|
|
outputs:
|
|
tag: ${{ steps.plan.outputs.tag }}
|
|
matrix: ${{ steps.plan.outputs.matrix }}
|
|
any: ${{ steps.plan.outputs.any }}
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- id: plan
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
TAG: ${{ inputs.tag }}
|
|
ONLY: ${{ inputs.only }}
|
|
MISSING_ONLY: ${{ inputs.missing_only }}
|
|
run: |
|
|
set -euo pipefail
|
|
tag="${TAG:-$(gh release view --repo "$GITHUB_REPOSITORY" --json tagName -q .tagName)}"
|
|
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
|
: > existing.txt
|
|
if [ "$MISSING_ONLY" = true ]; then
|
|
gh release view "$tag" --repo "$GITHUB_REPOSITORY" --json assets -q '.assets[].name' > existing.txt
|
|
fi
|
|
matrix="$(VERSION="${tag#v}" python3 -c '
|
|
import json, os
|
|
targets = json.load(open("releases/single-file/targets.json"))
|
|
only = json.loads(os.environ.get("ONLY") or "[]")
|
|
if only:
|
|
targets = [t for t in targets if t["target"] in only]
|
|
existing = set(open("existing.txt").read().split())
|
|
def name(t):
|
|
ext = ".exe" if t["target"].startswith("win") else ""
|
|
return "wekan-%s-%s-single-file%s" % (os.environ["VERSION"], t["target"], ext)
|
|
targets = [t for t in targets if not (name(t) in existing and name(t) + ".sha256sum" in existing)]
|
|
print(json.dumps({"include": targets}))')"
|
|
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
|
|
echo "any=$([ "$matrix" = '{"include": []}' ] && echo false || echo true)" >> "$GITHUB_OUTPUT"
|
|
echo "Release $tag; targets: $matrix"
|
|
|
|
build:
|
|
needs: plan
|
|
if: needs.plan.outputs.any == 'true'
|
|
name: Build ${{ matrix.target }}
|
|
runs-on: ${{ matrix.build_on }}
|
|
timeout-minutes: 60
|
|
permissions:
|
|
contents: write
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
|
|
env:
|
|
TAG: ${{ needs.plan.outputs.tag }}
|
|
TARGET: ${{ matrix.target }}
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
ref: ${{ needs.plan.outputs.tag }}
|
|
|
|
- name: Fetch and verify ${{ matrix.target }}'s published bundle
|
|
id: fetch
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
ZIP_PATTERN: ${{ matrix.zip }}
|
|
run: |
|
|
set -euo pipefail
|
|
version="${TAG#v}"
|
|
zip="${ZIP_PATTERN//\{version\}/$version}"
|
|
if ! gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --pattern "$zip" --pattern "$zip.sha256sum"; then
|
|
echo "::notice::$TARGET is not built this release: $TAG has no $zip."
|
|
echo "skip=true" >> "$GITHUB_OUTPUT"
|
|
exit 0
|
|
fi
|
|
[ -f "$zip" ] || { echo "::notice::$TARGET: $TAG has no $zip."; echo "skip=true" >> "$GITHUB_OUTPUT"; exit 0; }
|
|
[ -f "$zip.sha256sum" ] || { echo "::error::$zip has no published .sha256sum; a single file is never built from an unverified bundle."; exit 1; }
|
|
if command -v sha256sum >/dev/null; then sha256sum -c "$zip.sha256sum"; else shasum -a 256 -c "$zip.sha256sum"; fi
|
|
unzip -q "$zip"
|
|
rm -f "$zip"
|
|
node_bin=bundle/node
|
|
[ -f "$node_bin" ] || node_bin=bundle/node.exe
|
|
node_version="$(grep -aoE 'nodejs\.org/download/release/v[0-9]+\.[0-9]+\.[0-9]+/' "$node_bin" | head -n1 | sed -E 's#.*/(v[0-9.]+)/#\1#')"
|
|
[ -n "$node_version" ] || { echo "::error::Could not read the Node.js version of $node_bin."; exit 1; }
|
|
echo "node_version=$node_version" >> "$GITHUB_OUTPUT"
|
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
echo "$TARGET: bundle Node.js $node_version"
|
|
|
|
# The SEA blob format belongs to one Node.js version: the builder runs
|
|
# on the same version the bundle embeds (build.mjs checks it too).
|
|
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
if: steps.fetch.outputs.skip != 'true'
|
|
with:
|
|
node-version: ${{ steps.fetch.outputs.node_version }}
|
|
|
|
# A 32-bit target's SEA blob must be written by a 32-bit Node.js: the blob
|
|
# stores its lengths as size_t (build.mjs refuses otherwise). An i386
|
|
# Node.js writes it for every 32-bit target - win32, i386 and 32-bit ARM
|
|
# read the same little-endian format - but it has to be the SAME VERSION
|
|
# the target's bundle embeds (build.mjs checks that too). v13.07 took the
|
|
# i386 bundle's own Node.js, and the bundles resolve the newest Node.js of
|
|
# the pinned major per platform: i386 got v26.13.1 while 32-bit ARM still
|
|
# had v26.13.0, and armhf, armv6 and armv7 all stopped on "The bundle's
|
|
# Node.js is v26.13.0 but this is v26.13.1". So the host is resolved at
|
|
# the target bundle's exact version, from the same three sources and with
|
|
# the same published SHA256 as a bundle's Node.js.
|
|
- name: A 32-bit Node.js to build a 32-bit target
|
|
id: host32
|
|
if: steps.fetch.outputs.skip != 'true' && contains(fromJSON('["win32","i386","armv7","armhf","armv6"]'), matrix.target)
|
|
env:
|
|
NODE_VERSION: ${{ steps.fetch.outputs.node_version }}
|
|
run: |
|
|
set -euo pipefail
|
|
mkdir -p host32 .tools/tmp
|
|
export TMPDIR="$PWD/.tools/tmp"
|
|
rc=0
|
|
src="$(bash releases/resolve-node-source.sh i386 "$NODE_VERSION")" || rc=$?
|
|
[ "$rc" = 0 ] || { echo "::error::$TARGET needs an i386 Node.js $NODE_VERSION to build its single file, and none of the three Node.js sources has one."; exit 1; }
|
|
node_url="$(printf '%s\n' "$src" | sed -n 's/^node_url=//p')"
|
|
node_kind="$(printf '%s\n' "$src" | sed -n 's/^node_kind=//p')"
|
|
node_member="$(printf '%s\n' "$src" | sed -n 's/^node_member=//p')"
|
|
node_sha256="$(printf '%s\n' "$src" | sed -n 's/^node_sha256=//p')"
|
|
bash releases/fetch.sh -o host32/download "$node_url"
|
|
echo "$node_sha256 host32/download" | sha256sum -c -
|
|
case "$node_kind" in
|
|
binary) mv host32/download host32/node ;;
|
|
tar.xz) tar -xJf host32/download -C host32 "$node_member" && mv "host32/$node_member" host32/node && rm -f host32/download ;;
|
|
*) echo "::error::An i386 Node.js comes as a binary or a tar.xz, not $node_kind."; exit 1 ;;
|
|
esac
|
|
chmod +x host32/node
|
|
sudo dpkg --add-architecture i386
|
|
bash releases/apt-install.sh libc6:i386 libstdc++6:i386 libatomic1:i386
|
|
host="$PWD/host32/node"
|
|
got="$("$host" -p process.version)"
|
|
[ "$got" = "$NODE_VERSION" ] || { echo "::error::The i386 Node.js resolved for $NODE_VERSION reports $got."; exit 1; }
|
|
echo "node=$host" >> "$GITHUB_OUTPUT"
|
|
# A 32-bit ELF target's blob is injected in a 64-bit process, by
|
|
# LIEF 1.0.0 - the version Node.js vendors - not inside this 32-bit
|
|
# Node.js, which ran out of memory doing it (build.mjs, seaSplit).
|
|
if [ "$TARGET" != win32 ]; then
|
|
python3 -m venv "$RUNNER_TEMP/lief"
|
|
"$RUNNER_TEMP/lief/bin/python" -m pip install --quiet 'lief==1.0.0'
|
|
echo "python=$RUNNER_TEMP/lief/bin/python" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Build the single file
|
|
id: build
|
|
if: steps.fetch.outputs.skip != 'true'
|
|
env:
|
|
VERSION: ${{ steps.fetch.outputs.version }}
|
|
HOST_NODE: ${{ steps.host32.outputs.node }}
|
|
SEA_PYTHON: ${{ steps.host32.outputs.python }}
|
|
run: |
|
|
set -euo pipefail
|
|
case "$TARGET" in win*) ext=.exe ;; *) ext= ;; esac
|
|
out="wekan-${VERSION}-${TARGET}-single-file${ext}"
|
|
# Exit 3: this Node.js is one LIEF cannot inject the SEA into
|
|
# correctly (releases/single-file/sea-inject.mjs says which and why).
|
|
# That is a missing single file, not a failed release.
|
|
rc=0
|
|
node releases/single-file/build.mjs --bundle bundle --target "$TARGET" --version "$VERSION" --out "$out" \
|
|
${HOST_NODE:+--host-node "$HOST_NODE"} 2> build.err || rc=$?
|
|
cat build.err >&2
|
|
rm -rf bundle
|
|
if [ "$rc" = 3 ]; then
|
|
reason="$(sed -n 's/^single-file build: //p' build.err | head -n1)"
|
|
echo "::notice::$reason"
|
|
printf '%s\n' "$reason" > "single-file-skipped-$TARGET.txt"
|
|
rm -f build.err; exit 0
|
|
fi
|
|
rm -f build.err
|
|
[ "$rc" = 0 ] || exit "$rc"
|
|
ls -la "$out" "$out.sha256sum"
|
|
|
|
# A target that was not built still leaves an artifact - one line saying
|
|
# why - so its Start job finds something to read instead of logging an
|
|
# "Artifact not found" error for a release that is fine.
|
|
- name: Say why there is no single file
|
|
if: steps.fetch.outputs.skip == 'true'
|
|
run: |
|
|
[ -f "single-file-skipped-$TARGET.txt" ] || echo "$TARGET: this release has no bundle to build it from." > "single-file-skipped-$TARGET.txt"
|
|
|
|
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: single-file-${{ matrix.target }}
|
|
path: |
|
|
wekan-*-${{ matrix.target }}-single-file*
|
|
single-file-skipped-${{ matrix.target }}.txt
|
|
if-no-files-found: error
|
|
retention-days: 3
|
|
compression-level: 0
|
|
|
|
smoke:
|
|
needs: [plan, build]
|
|
if: ${{ !cancelled() && needs.plan.outputs.any == 'true' }}
|
|
name: Start ${{ matrix.target }}
|
|
runs-on: ${{ matrix.smoke == 'none' && 'ubuntu-24.04' || matrix.smoke }}
|
|
timeout-minutes: 45
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
|
|
env:
|
|
TARGET: ${{ matrix.target }}
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- name: Get the single file
|
|
id: get
|
|
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
continue-on-error: true
|
|
with:
|
|
name: single-file-${{ matrix.target }}
|
|
path: sf
|
|
|
|
- name: Is there one to start here?
|
|
id: what
|
|
env:
|
|
STEP_GET_OUTCOME: ${{ steps.get.outcome }}
|
|
MATRIX_SMOKE: ${{ matrix.smoke }}
|
|
run: |
|
|
set -euo pipefail
|
|
if [ "${STEP_GET_OUTCOME}" != success ]; then
|
|
echo "run=false" >> "$GITHUB_OUTPUT"; echo "::notice::$TARGET was not built this release."; exit 0
|
|
fi
|
|
if [ -f "sf/single-file-skipped-$TARGET.txt" ]; then
|
|
echo "run=false" >> "$GITHUB_OUTPUT"; echo "::notice::$(cat "sf/single-file-skipped-$TARGET.txt")"; exit 0
|
|
fi
|
|
if [ "${MATRIX_SMOKE}" = none ]; then
|
|
echo "run=false" >> "$GITHUB_OUTPUT"
|
|
echo "::notice::GitHub has no runner for $TARGET: the single file is published without being started (its bundle was tested where it was built)."
|
|
mkdir -p ok && echo "$TARGET untested" > "ok/$TARGET"; exit 0
|
|
fi
|
|
exe="$(ls sf/wekan-*-single-file* | grep -v '\.sha256sum$' | head -n1)"
|
|
chmod +x "$exe"
|
|
echo "exe=$PWD/$exe" >> "$GITHUB_OUTPUT"
|
|
echo "run=true" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Start it, as a user starts it
|
|
if: steps.what.outputs.run == 'true'
|
|
env:
|
|
EXE: ${{ steps.what.outputs.exe }}
|
|
run: |
|
|
set -euo pipefail
|
|
cd "$(dirname "$EXE")"
|
|
"$EXE" version
|
|
"$EXE" set PORT 3456
|
|
# Fast polling, so a browser test sees a change made in the database
|
|
# within its timeout; the default is 30 s.
|
|
"$EXE" set METEOR_POLLING_INTERVAL_MS 2000
|
|
"$EXE" start --background
|
|
for i in $(seq 1 120); do
|
|
code="$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:3456/ || true)"
|
|
[ "$code" = 200 ] && break
|
|
sleep 3
|
|
done
|
|
"$EXE" status
|
|
if [ "$code" != 200 ]; then
|
|
echo "::error::$TARGET: WeKan did not answer HTTP 200 within 6 minutes."
|
|
tail -n 200 wekan-files/logs/wekan.log || true
|
|
exit 1
|
|
fi
|
|
ls wekan-files wekan-files/bin
|
|
echo "WeKan answered HTTP 200 from the $TARGET single file."
|
|
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
if: steps.what.outputs.run == 'true' && matrix.target == 'amd64'
|
|
with:
|
|
persist-credentials: false
|
|
ref: ${{ needs.plan.outputs.tag }}
|
|
path: src
|
|
|
|
- name: Browser test against the single file
|
|
if: steps.what.outputs.run == 'true' && matrix.target == 'amd64'
|
|
env:
|
|
EXE: ${{ steps.what.outputs.exe }}
|
|
run: |
|
|
set -euo pipefail
|
|
files="$(dirname "$EXE")/wekan-files"
|
|
cd src/tests/playwright
|
|
npm ci
|
|
npx playwright install --with-deps chromium
|
|
WEKAN_BASE_URL=http://localhost:3456 \
|
|
WEKAN_MONGO_URL=mongodb://127.0.0.1:27017/wekan \
|
|
WEKAN_SINGLE_FILE_FILES="$files" \
|
|
WEKAN_FILES_PATH="$files" \
|
|
WEKAN_PLAYWRIGHT_PROJECT=chromium \
|
|
npx playwright test specs/single-file.e2e.js specs/01-boards-users.e2e.js specs/07-attachments-links.e2e.js --reporter=line
|
|
|
|
- name: Stop it
|
|
if: always() && steps.what.outputs.run == 'true'
|
|
env:
|
|
EXE: ${{ steps.what.outputs.exe }}
|
|
run: |
|
|
cd "$(dirname "$EXE")"
|
|
"$EXE" stop || true
|
|
"$EXE" status || true
|
|
[ -f wekan-files/logs/wekan.log ] && tail -n 60 wekan-files/logs/wekan.log || true
|
|
mkdir -p ok && echo "$TARGET started" > "ok/$TARGET"
|
|
|
|
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
if: success() && (steps.what.outputs.run == 'true' || matrix.smoke == 'none')
|
|
with:
|
|
name: single-file-ok-${{ matrix.target }}
|
|
path: |
|
|
ok
|
|
sf/ok
|
|
if-no-files-found: ignore
|
|
retention-days: 3
|
|
|
|
publish:
|
|
needs: [plan, build, smoke]
|
|
if: ${{ !cancelled() && inputs.publish && needs.plan.outputs.any == 'true' }}
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 60
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
with:
|
|
pattern: single-file-*
|
|
path: artifacts
|
|
- name: Attach every single file that started, or has no runner to start on
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
TAG: ${{ needs.plan.outputs.tag }}
|
|
run: |
|
|
set -euo pipefail
|
|
shopt -s nullglob
|
|
published=0
|
|
for dir in artifacts/single-file-*; do
|
|
target="${dir#artifacts/single-file-}"
|
|
case "$target" in ok-*) continue ;; esac
|
|
# Not built, and its build job said why in a notice already.
|
|
[ -f "$dir/single-file-skipped-$target.txt" ] && continue
|
|
if [ ! -d "artifacts/single-file-ok-$target" ]; then
|
|
echo "::warning::$target: not published - it did not start on its runner."
|
|
continue
|
|
fi
|
|
for f in "$dir"/wekan-*-single-file*; do
|
|
case "$f" in *.sha256sum) continue ;; esac
|
|
(cd "$dir" && sha256sum -c "$(basename "$f").sha256sum")
|
|
bash releases/github-release-upload.sh "$GITHUB_REPOSITORY" "$TAG" "$f" "$f.sha256sum"
|
|
published=$((published + 1))
|
|
done
|
|
done
|
|
echo "Published $published single files to $TAG."
|