mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 21:35:59 +00:00
Merge remote-tracking branch 'origin/main' into pr-2265
# Conflicts: # app/src/main/java/com/droiddeck/launcher/ui/FrontEndSetup.kt
This commit is contained in:
commit
62b61e64bb
797 files changed
+87738
-5139
No files matched your search
@@ -1,5 +1,7 @@
|
||||
ASEbrahim
|
||||
FX192
|
||||
K11MCH1
|
||||
KeegantheVeganat0r
|
||||
kingokksa
|
||||
ovurrsl
|
||||
KeegantheVeganat0r
|
||||
@@ -127,6 +127,7 @@ jobs:
|
||||
name: xbox-arm64
|
||||
path: app/src/main/assets/linuxfs/usr/local/lib/droiddeck-xbox
|
||||
retention-days: 14
|
||||
overwrite: true
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: xbox-corresponding-source
|
||||
@@ -135,6 +136,7 @@ jobs:
|
||||
app/build/xbox/runtime/*-source.tar.xz
|
||||
if-no-files-found: error
|
||||
retention-days: 14
|
||||
overwrite: true
|
||||
|
||||
components-runner:
|
||||
needs: source
|
||||
@@ -195,6 +197,7 @@ jobs:
|
||||
!app/src/main/assets/linuxfs/i386/libfaultreport.so
|
||||
!app/src/main/assets/linuxfs/libblaudit.so
|
||||
!app/src/main/assets/linuxfs/libblfastpath.so
|
||||
!app/src/main/assets/linuxfs/libddnatv-hook.so
|
||||
!app/src/main/assets/linuxfs/libblsession.so
|
||||
!app/src/main/assets/linuxfs/libfakeinput.so
|
||||
!app/src/main/assets/linuxfs/libssbs.so
|
||||
@@ -313,6 +316,11 @@ jobs:
|
||||
- name: Build the DiRT 3 / DiRT Showdown ws2_32 stand-in
|
||||
run: python3 tools/components/prepare.py dirt-ws2
|
||||
|
||||
- name: Cache graphics driver inputs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: app/build/quest-inputs
|
||||
key: quest-inputs-${{ hashFiles('tools/quest/build-driver.py') }}
|
||||
- name: Prepare graphics driver variants
|
||||
run: python3 tools/quest/build-driver.py "$ANDROID_HOME/ndk/$NDK_VERSION"
|
||||
- name: Record and pack prepared components
|
||||
@@ -324,6 +332,7 @@ jobs:
|
||||
if-no-files-found: error
|
||||
compression-level: 0
|
||||
retention-days: 14
|
||||
overwrite: true
|
||||
|
||||
build-runner:
|
||||
needs: [components]
|
||||
@@ -550,6 +559,18 @@ jobs:
|
||||
SOURCE_TREE: ${{ needs.source.outputs.tree-sha }}
|
||||
run: python3 tools/components/prepare.py unpack --tree "$SOURCE_TREE"
|
||||
|
||||
- name: Ubisoft launcher service (x86_64-pc-windows-gnu)
|
||||
run: |
|
||||
set -euo pipefail
|
||||
command -v x86_64-w64-mingw32-gcc >/dev/null || { sudo apt-get update -qq && sudo apt-get install -y -qq gcc-mingw-w64-x86-64; }
|
||||
bash tools/ubisoft-launcher/build.sh
|
||||
|
||||
- name: Rockstar launcher service (32-bit and 64-bit)
|
||||
run: |
|
||||
set -euo pipefail
|
||||
command -v i686-w64-mingw32-gcc >/dev/null || { sudo apt-get update -qq && sudo apt-get install -y -qq gcc-mingw-w64-i686; }
|
||||
bash tools/rockstar-launcher/build.sh
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: xbox-arm64
|
||||
@@ -558,9 +579,11 @@ jobs:
|
||||
- name: Cache checksum-pinned pack inputs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/droiddeck-pack-inputs
|
||||
key: pack-inputs-v1-${{ hashFiles('tools/packs/build.sh', 'tools/packs/fetch-verified.sh', 'tools/packs/tracking/release.env') }}
|
||||
restore-keys: pack-inputs-v1-
|
||||
path: |
|
||||
~/.cache/droiddeck-pack-inputs
|
||||
~/.cache/droiddeck-build
|
||||
key: pack-inputs-v2-${{ hashFiles('tools/packs/build.sh', 'tools/packs/fetch-verified.sh', 'tools/packs/tracking/release.env', 'tools/powervr/release.json') }}
|
||||
restore-keys: pack-inputs-v2-
|
||||
- name: Build the add-on packs
|
||||
run: |
|
||||
python3 tools/powervr/fetch.py
|
||||
@@ -603,12 +626,11 @@ jobs:
|
||||
- name: Check out MaliBridge
|
||||
run: git submodule update --init external/MaliBridge
|
||||
- name: Fetch the Mali (Venus) component (tools/venus/release.env)
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
. tools/venus/release.env
|
||||
gh release download "${VENUS_TAG}" -R "${VENUS_REPO}" -p venus.tzst -O venus.tzst
|
||||
curl -fsSL --retry 5 --retry-all-errors --retry-delay 10 -o venus.tzst \
|
||||
"https://github.com/${VENUS_REPO}/releases/download/${VENUS_TAG}/venus.tzst"
|
||||
echo "${VENUS_SHA256} venus.tzst" | sha256sum -c -
|
||||
tar --use-compress-program=unzstd -xf venus.tzst -C app/src/main
|
||||
test -f app/src/main/jniLibs/arm64-v8a/libvirgl_test_server.so
|
||||
@@ -645,6 +667,7 @@ jobs:
|
||||
name: stores-cargo-lock
|
||||
path: app/src/main/rust/stores/Cargo.lock
|
||||
if-no-files-found: ignore
|
||||
overwrite: true
|
||||
|
||||
- name: Unit tests
|
||||
id: unit-tests
|
||||
@@ -668,6 +691,7 @@ jobs:
|
||||
app/build/reports/tests/testReleaseUnitTest/
|
||||
if-no-files-found: ignore
|
||||
retention-days: 14
|
||||
overwrite: true
|
||||
|
||||
- name: Sign with the testkey (v1 + v2 + v3)
|
||||
run: |
|
||||
@@ -705,6 +729,7 @@ jobs:
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
compression-level: 0
|
||||
overwrite: true
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -713,6 +738,7 @@ jobs:
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
compression-level: 0
|
||||
overwrite: true
|
||||
|
||||
- name: Report on the pull request
|
||||
if: always() && github.event_name == 'pull_request'
|
||||
@@ -784,6 +810,11 @@ jobs:
|
||||
set -o pipefail
|
||||
cd app/src/main/rust/stores
|
||||
cargo test --locked 2>&1 | tail -60
|
||||
- name: Windows launcher service host unit tests
|
||||
timeout-minutes: 10
|
||||
run: |
|
||||
cargo test --locked --manifest-path tools/ubisoft-launcher/Cargo.toml
|
||||
cargo test --locked --manifest-path tools/rockstar-launcher/Cargo.toml
|
||||
|
||||
python-tests:
|
||||
name: Python and native regression tests
|
||||
@@ -818,7 +849,7 @@ jobs:
|
||||
run: test "$(git rev-parse 'HEAD^{tree}')" = "$XBOX_SOURCE_TREE"
|
||||
- name: Install Python test dependencies
|
||||
timeout-minutes: 7
|
||||
run: bash tools/ci/install-ubuntu-packages.sh python3-yaml gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user libvulkan-dev mesa-vulkan-drivers
|
||||
run: bash tools/ci/install-ubuntu-packages.sh python3-yaml gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user libvulkan-dev mesa-vulkan-drivers spirv-tools
|
||||
- name: Resolve the pinned Android NDK
|
||||
run: bash tools/ci/resolve-ndk.sh
|
||||
|
||||
@@ -848,6 +879,16 @@ jobs:
|
||||
-ldl -o /tmp/test-presenter-shutdown
|
||||
timeout 10 /tmp/test-presenter-shutdown
|
||||
|
||||
- name: Fetch the Mali compatibility layer's headers
|
||||
run: |
|
||||
set -euo pipefail
|
||||
sdk=$(sed -n 's/^SDK=//p' tools/venus/ci-build.sh)
|
||||
bcdec=$(grep -o 'https://raw.githubusercontent.com/iOrange/bcdec/[^ ]*' tools/venus/ci-build.sh)
|
||||
mkdir -p build/layer-deps/bcdec
|
||||
git -c advice.detachedHead=false clone -q --depth 1 -b "$sdk" https://github.com/KhronosGroup/Vulkan-Headers.git build/layer-deps/vulkan
|
||||
git -c advice.detachedHead=false clone -q --depth 1 -b "$sdk" https://github.com/KhronosGroup/SPIRV-Headers.git build/layer-deps/spirv
|
||||
curl -sSfL -o build/layer-deps/bcdec/bcdec.h "$bcdec"
|
||||
|
||||
- name: Steam import and game environment tests
|
||||
run: bash tools/ci/run-python-tests.sh
|
||||
|
||||
@@ -876,6 +917,17 @@ jobs:
|
||||
variants: ${{ needs.build.outputs.variants }}
|
||||
secrets: inherit
|
||||
|
||||
scan:
|
||||
needs: sign
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||
permissions:
|
||||
contents: read
|
||||
uses: ./.github/workflows/scan.yml
|
||||
with:
|
||||
artifact: droiddeck-signed
|
||||
variant: standard
|
||||
secrets: inherit
|
||||
|
||||
packs:
|
||||
needs: [build, checks]
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
||||
@@ -895,7 +947,7 @@ jobs:
|
||||
pull-requests: read
|
||||
env:
|
||||
CI_REPO: Droid-Deck/DroidDeck-CI
|
||||
KEEP: 10
|
||||
KEEP_DAYS: 14
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -940,3 +992,35 @@ jobs:
|
||||
if: ${{ always() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && needs.announce.result != 'skipped' }}
|
||||
uses: ./.github/workflows/update-catalog.yml
|
||||
secrets: inherit
|
||||
|
||||
retire-tests:
|
||||
needs: catalog
|
||||
if: ${{ always() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && needs.catalog.result == 'success' }}
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.sha }}
|
||||
persist-credentials: false
|
||||
- uses: actions/create-github-app-token@v2
|
||||
id: ci-token
|
||||
with:
|
||||
app-id: ${{ vars.DROIDDECK_CI_APP_ID }}
|
||||
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
|
||||
owner: Droid-Deck
|
||||
repositories: DroidDeck-CI
|
||||
- name: Delete the test builds this Preview build replaces
|
||||
env:
|
||||
SOURCE_GITHUB_TOKEN: ${{ github.token }}
|
||||
CI_GITHUB_TOKEN: ${{ steps.ci-token.outputs.token }}
|
||||
run: python3 tools/release/retire_test_builds.py
|
||||
|
||||
catalog-after-retire:
|
||||
needs: retire-tests
|
||||
if: ${{ always() && needs.retire-tests.result == 'success' }}
|
||||
uses: ./.github/workflows/update-catalog.yml
|
||||
secrets: inherit
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 2
|
||||
outputs:
|
||||
labels: ${{ steps.runner.outputs.labels || '"ubuntu-24.04"' }}
|
||||
labels: ${{ steps.runner.outputs.labels || steps.fork.outputs.labels || '"ubuntu-24.04"' }}
|
||||
steps:
|
||||
- name: Pick the compile runner
|
||||
id: runner
|
||||
@@ -36,3 +36,25 @@ jobs:
|
||||
fi
|
||||
echo "labels=$labels" >> "$GITHUB_OUTPUT"
|
||||
echo "Compile runner: \`$labels\`" >> "$GITHUB_STEP_SUMMARY"
|
||||
- name: Pick the fork runner
|
||||
id: fork
|
||||
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
|
||||
continue-on-error: true
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
labels='"ubuntu-24.04"'
|
||||
gist=https://api.github.com/gists/0c7ed7ad6d6493de84f5123689c64ae6
|
||||
body=$(curl -fsS --max-time 15 -H "Authorization: Bearer $GH_TOKEN" "$gist" 2>/dev/null || curl -fsS --max-time 15 "$gist" 2>/dev/null || echo '{}')
|
||||
IDLE_AT=$(jq -r 'select(.owner.login == "maxjivi05") | .files["idle-at"].content // "0"' <<< "$body" 2>/dev/null || echo 0)
|
||||
echo "Heartbeat: ${IDLE_AT:-none}"
|
||||
age=-1
|
||||
if [[ "${IDLE_AT:-0}" =~ ^[0-9]+$ ]] && [ "${IDLE_AT:-0}" -gt 0 ]; then
|
||||
age=$(( $(date +%s) - IDLE_AT ))
|
||||
fi
|
||||
if [ "$age" -ge 0 ] && [ "$age" -lt 180 ]; then
|
||||
labels='"droiddeck-fork"'
|
||||
fi
|
||||
echo "labels=$labels" >> "$GITHUB_OUTPUT"
|
||||
echo "Compile runner: \`$labels\`" >> "$GITHUB_STEP_SUMMARY"
|
||||
@@ -0,0 +1,141 @@
|
||||
name: PR Rebuild On Version Bump
|
||||
run-name: rebuild test builds below versionCode on main
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths: [app/build.gradle]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
actions: write
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: read
|
||||
|
||||
concurrency:
|
||||
group: pr-rebuild-on-version
|
||||
cancel-in-progress: false
|
||||
queue: max
|
||||
|
||||
jobs:
|
||||
rebuild:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 180
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 2
|
||||
persist-credentials: false
|
||||
- name: Rebuild open PRs whose test build Android would refuse over main
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
BEFORE: ${{ github.event.before }}
|
||||
PUSHED_AT: ${{ github.event.repository.pushed_at }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
code() { sed -n 's/^[[:space:]]*versionCode[[:space:]][[:space:]]*\([0-9][0-9]*\)[[:space:]]*$/\1/p'; }
|
||||
now=$(code < app/build.gradle)
|
||||
[[ "$now" =~ ^[0-9]+$ ]] || { echo "::error::No numeric versionCode on main"; exit 1; }
|
||||
if [ "$EVENT_NAME" = push ]; then
|
||||
was=$(git show "$BEFORE:app/build.gradle" 2>/dev/null | code || true)
|
||||
if [[ "$was" =~ ^[0-9]+$ ]] && [ "$was" -ge "$now" ]; then
|
||||
echo "versionCode stayed at $now"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
# This run is created right after the push, so a PR build that started earlier may have pinned the old main.
|
||||
bumped=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" --jq .created_at)
|
||||
# A build can finish between the push and this run's creation; the push event carries the push time.
|
||||
if [[ "${PUSHED_AT:-}" =~ ^[0-9]+$ ]]; then
|
||||
pushed=$(date -u -d "@$PUSHED_AT" +%Y-%m-%dT%H:%M:%SZ)
|
||||
[[ "$pushed" < "$bumped" ]] && bumped=$pushed
|
||||
else
|
||||
pushed=$(date -u -d "$bumped - 10 minutes" +%Y-%m-%dT%H:%M:%SZ)
|
||||
fi
|
||||
note() {
|
||||
local number=$1
|
||||
local marker="<!-- droiddeck-rebuild-$now -->"
|
||||
gh api "repos/$GITHUB_REPOSITORY/issues/$number/comments?per_page=100" --jq '.[].body' | grep -qF "$marker" && return 0
|
||||
gh api -X POST "repos/$GITHUB_REPOSITORY/issues/$number/comments" -f body="$marker
|
||||
Main is now at versionCode $now, so this PR's test build no longer installs over current DroidDeck, and its last build is too old for GitHub to re-run. Push a commit or merge main to get a new test build." >/dev/null
|
||||
}
|
||||
latest() {
|
||||
gh api "repos/$GITHUB_REPOSITORY/actions/workflows/build.yml/runs?event=pull_request&head_sha=$1&per_page=20" \
|
||||
--jq '[.workflow_runs[] | select(.head_sha == "'"$1"'")] | sort_by(.created_at) | last // empty | [.id, .status, (.run_started_at // .created_at), .created_at, .updated_at] | @tsv'
|
||||
}
|
||||
consider() {
|
||||
local number=$1 head=$2 built=$3 id status started created updated
|
||||
IFS=$'\t' read -r id status started created updated <<<"$4"
|
||||
if [[ "$started" > "$bumped" ]]; then
|
||||
echo "PR #$number: build $id started after the bump"
|
||||
elif ! gh api "repos/$GITHUB_REPOSITORY/pulls/$number" |
|
||||
jq -e --arg head "$head" '.state == "open" and .draft == false and .base.ref == "main" and .head.sha == $head' >/dev/null; then
|
||||
echo "PR #$number: moved on since the scan, its own build covers it"
|
||||
elif gh run rerun "$id" -R "$GITHUB_REPOSITORY"; then
|
||||
echo "PR #$number: rebuilding ${head:0:7} on main (versionCode $built -> $now)"
|
||||
else
|
||||
echo "::warning::PR #$number: could not rerun build $id"
|
||||
# GitHub only re-runs a workflow within 30 days of its first run.
|
||||
if [[ "$created" < "$(date -u -d '-30 days' +%Y-%m-%dT%H:%M:%SZ)" ]]; then
|
||||
note "$number" || echo "::warning::PR #$number: could not leave a note"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
pending=()
|
||||
declare -A seen=()
|
||||
candidates() {
|
||||
gh api --paginate "repos/Droid-Deck/DroidDeck-CI/releases?per_page=100" \
|
||||
--jq '.[] | select(.tag_name | test("^pr-[0-9]+$")) | [(.tag_name | ltrimstr("pr-")), ((.body // "") | capture("(?m)^VersionCode: (?<v>[0-9]+)").v // "0")] | @tsv'
|
||||
# The latest build of every open PR: one that started before the bump and was still running at it
|
||||
# may have pinned the old main. This also covers a PR's first build and fork builds.
|
||||
gh api --paginate -X GET "repos/$GITHUB_REPOSITORY/pulls" -f state=open -f base=main -f per_page=100 \
|
||||
--jq '.[] | select(.draft | not) | [(.number | tostring), .head.sha] | @tsv' |
|
||||
while IFS=$'\t' read -r number sha; do
|
||||
run=$(latest "$sha")
|
||||
[ -n "$run" ] || continue
|
||||
IFS=$'\t' read -r _ status started _ updated <<<"$run"
|
||||
if [[ "$started" < "$bumped" ]] && { [ "$status" != completed ] || [[ ! "$updated" < "$pushed" ]]; }; then
|
||||
printf '%s\t?\n' "$number"
|
||||
fi
|
||||
done
|
||||
}
|
||||
found=$(mktemp)
|
||||
candidates > "$found"
|
||||
while IFS=$'\t' read -r number built; do
|
||||
[ "$built" = "?" ] || [ "$built" -lt "$now" ] || continue
|
||||
[ -z "${seen[$number]:-}" ] || continue
|
||||
seen[$number]=1
|
||||
pr=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$number") || continue
|
||||
jq -e '.state == "open" and .draft == false and .base.ref == "main"' <<<"$pr" >/dev/null || continue
|
||||
head=$(jq -r .head.sha <<<"$pr")
|
||||
run=$(latest "$head")
|
||||
if [ -z "$run" ]; then
|
||||
echo "PR #$number: no build of ${head:0:7} to rerun"
|
||||
elif [ "$(cut -f2 <<<"$run")" = completed ]; then
|
||||
consider "$number" "$head" "$built" "$run"
|
||||
else
|
||||
pending+=("$number $head $built")
|
||||
fi
|
||||
done < "$found"
|
||||
# Builds still running are polled together so one slow build cannot hold up the rest.
|
||||
deadline=$((SECONDS + 150 * 60))
|
||||
while [ ${#pending[@]} -gt 0 ] && [ "$SECONDS" -lt "$deadline" ]; do
|
||||
sleep 60
|
||||
left=()
|
||||
for item in "${pending[@]}"; do
|
||||
read -r number head built <<<"$item"
|
||||
run=$(latest "$head")
|
||||
if [ -n "$run" ] && [ "$(cut -f2 <<<"$run")" = completed ]; then
|
||||
consider "$number" "$head" "$built" "$run"
|
||||
else
|
||||
left+=("$item")
|
||||
fi
|
||||
done
|
||||
pending=(${left[@]+"${left[@]}"})
|
||||
done
|
||||
for item in ${pending[@]+"${pending[@]}"}; do
|
||||
echo "::warning::PR #${item%% *}: its build did not finish in time"
|
||||
done
|
||||
@@ -40,36 +40,19 @@ jobs:
|
||||
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
|
||||
owner: Droid-Deck
|
||||
repositories: DroidDeck-CI
|
||||
- name: Delete the test build
|
||||
if: ${{ steps.state.outputs.closed == 'true' }}
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.ci-token.outputs.token }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
retry() {
|
||||
for attempt in 1 2 3 4; do
|
||||
"$@" && return 0
|
||||
[ "$attempt" = 4 ] || sleep $((attempt * 20))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
existing=$(retry gh api --paginate "repos/Droid-Deck/DroidDeck-CI/releases?per_page=100" --jq '.[].tag_name')
|
||||
found=0
|
||||
for tag in "pr-$PR_NUMBER" "pr-$PR_NUMBER.0"; do
|
||||
if grep -qxF "$tag" <<<"$existing"; then
|
||||
retry gh release delete "$tag" -R Droid-Deck/DroidDeck-CI --yes --cleanup-tag
|
||||
echo "Deleted $tag"
|
||||
found=1
|
||||
fi
|
||||
done
|
||||
[ "$found" = 1 ] || echo "No test build for PR #$PR_NUMBER"
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
if: ${{ steps.state.outputs.closed == 'true' }}
|
||||
with:
|
||||
ref: main
|
||||
persist-credentials: false
|
||||
- name: Delete the test build unless main still needs it
|
||||
if: ${{ steps.state.outputs.closed == 'true' }}
|
||||
env:
|
||||
SOURCE_GITHUB_TOKEN: ${{ github.token }}
|
||||
CI_GITHUB_TOKEN: ${{ steps.ci-token.outputs.token }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
# A merged PR's build stays until a Preview build carries the merge; build.yml and the sweep remove it then.
|
||||
run: python3 tools/release/retire_test_builds.py --pr "$PR_NUMBER"
|
||||
- name: Retire the Discord PR announcement
|
||||
if: ${{ steps.state.outputs.closed == 'true' }}
|
||||
env:
|
||||
|
||||
@@ -226,6 +226,8 @@ jobs:
|
||||
publish:
|
||||
needs: [authorize, sign]
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
keep: ${{ steps.publish.outputs.keep }}
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
@@ -322,12 +324,8 @@ jobs:
|
||||
cp pr-packs/* signed/ 2>/dev/null || true
|
||||
gh release upload "$tag" signed/* -R "$repo" --clobber
|
||||
gh release edit "$tag" -R "$repo" --title "PR #$PR_NUMBER" --notes "$notes" --prerelease
|
||||
keep=$(cd signed && ls | jq -R . | jq -sc .)
|
||||
gh api "repos/$repo/releases/tags/$tag" |
|
||||
jq -r --argjson keep "$keep" '.assets[] | select(.name as $n | $keep | index($n) | not) | .id' |
|
||||
while IFS= read -r id; do
|
||||
gh api --method DELETE "repos/$repo/releases/assets/$id" >/dev/null
|
||||
done
|
||||
# The previous push's files stay until the catalog names these (the prune job), so a download started from the old catalog still finds its APK.
|
||||
echo "keep=$(cd signed && ls | jq -R . | jq -sc .)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
published=$(gh release view "$tag" -R "$repo" --json tagName,assets)
|
||||
jq -e --arg tag "$tag" '.tagName == $tag and (.assets | length) > 0' <<<"$published" >/dev/null
|
||||
@@ -417,3 +415,41 @@ jobs:
|
||||
if: ${{ always() && needs.publish.result != 'skipped' }}
|
||||
uses: ./.github/workflows/update-catalog.yml
|
||||
secrets: inherit
|
||||
|
||||
prune:
|
||||
needs: [authorize, publish, catalog]
|
||||
if: ${{ always() && needs.publish.result == 'success' && needs.catalog.result == 'success' }}
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/create-github-app-token@v2
|
||||
id: ci-token
|
||||
with:
|
||||
app-id: ${{ vars.DROIDDECK_CI_APP_ID }}
|
||||
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
|
||||
owner: Droid-Deck
|
||||
repositories: DroidDeck-CI
|
||||
- name: Remove the previous push's files
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.ci-token.outputs.token }}
|
||||
PR_NUMBER: ${{ needs.authorize.outputs.pr_number }}
|
||||
KEEP: ${{ needs.publish.outputs.keep }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
repo=Droid-Deck/DroidDeck-CI
|
||||
tag="pr-$PR_NUMBER"
|
||||
# An app that read the catalog just before it changed may still be starting that download.
|
||||
sleep 300
|
||||
# Delete nothing the published catalog still names.
|
||||
named=$(gh api -H "Accept: application/vnd.github.raw+json" "repos/$repo/contents/catalog.json?ref=main" |
|
||||
jq -c --argjson pr "$PR_NUMBER" '[.tests[] | select(.pr == $pr) | .apks[].name]')
|
||||
stale=$(jq -nr --argjson named "$named" --argjson keep "$KEEP" '$named - $keep | join(" ")')
|
||||
if [ -n "$stale" ]; then
|
||||
echo "::warning::The catalog still names $stale; keeping every file of $tag"
|
||||
exit 0
|
||||
fi
|
||||
gh api "repos/$repo/releases/tags/$tag" |
|
||||
jq -r --argjson keep "$KEEP" '.assets[] | select(.name as $n | $keep | index($n) | not) | .id' |
|
||||
while IFS= read -r id; do
|
||||
gh api --method DELETE "repos/$repo/releases/assets/$id" >/dev/null
|
||||
done
|
||||
@@ -26,32 +26,18 @@ jobs:
|
||||
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
|
||||
owner: Droid-Deck
|
||||
repositories: DroidDeck-CI
|
||||
- name: Delete test builds whose PR is no longer open
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
persist-credentials: false
|
||||
- name: Delete test builds of closed PRs, and of merged PRs a Preview build carries
|
||||
env:
|
||||
CI_TOKEN: ${{ steps.ci-token.outputs.token }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
retry() {
|
||||
for attempt in 1 2 3 4; do
|
||||
"$@" && return 0
|
||||
[ "$attempt" = 4 ] || sleep $((attempt * 20))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
tags=$(GH_TOKEN="$CI_TOKEN" retry gh api --paginate "repos/Droid-Deck/DroidDeck-CI/releases?per_page=100" --jq '.[].tag_name' |
|
||||
grep -E '^pr-[0-9]+(\.0)?$' || true)
|
||||
failed=0
|
||||
for tag in $tags; do
|
||||
number=${tag#pr-}
|
||||
number=${number%.0}
|
||||
state=$(retry gh api "repos/$GITHUB_REPOSITORY/pulls/$number" --jq .state) || { failed=1; continue; }
|
||||
if [ "$state" != open ]; then
|
||||
if GH_TOKEN="$CI_TOKEN" retry gh release delete "$tag" -R Droid-Deck/DroidDeck-CI --yes --cleanup-tag; then
|
||||
echo "Deleted $tag (PR #$number is $state)"
|
||||
else
|
||||
failed=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
exit "$failed"
|
||||
SOURCE_GITHUB_TOKEN: ${{ github.token }}
|
||||
CI_GITHUB_TOKEN: ${{ steps.ci-token.outputs.token }}
|
||||
run: python3 tools/release/retire_test_builds.py
|
||||
|
||||
catalog:
|
||||
needs: sweep
|
||||
if: ${{ always() }}
|
||||
uses: ./.github/workflows/update-catalog.yml
|
||||
secrets: inherit
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
jq -r --arg n "$2" '.assets // [] | .[] | select(.name == $n) | .digest // empty'
|
||||
}
|
||||
commit=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$BUILD_RUN" --jq .head_sha 2>/dev/null || echo "$GITHUB_SHA")
|
||||
for name in proot directaudio tracking xbox comet butler powervr; do
|
||||
for name in proot directaudio tracking xbox comet butler powervr ubisoft; do
|
||||
file="packs/$name.tar.zst"
|
||||
[ -f "$file" ] || { echo "::error::$name.tar.zst is missing from Build APK run $BUILD_RUN"; exit 1; }
|
||||
sha=$(sha256sum "$file" | cut -d' ' -f1)
|
||||
|
||||
@@ -63,6 +63,15 @@ jobs:
|
||||
artifact: droiddeck-release
|
||||
secrets: inherit
|
||||
|
||||
scan:
|
||||
needs: sign
|
||||
permissions:
|
||||
contents: read
|
||||
uses: ./.github/workflows/scan.yml
|
||||
with:
|
||||
artifact: droiddeck-release
|
||||
secrets: inherit
|
||||
|
||||
packs:
|
||||
needs: find
|
||||
permissions:
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
name: Scan APKs
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
artifact:
|
||||
description: Prefix of the signed artifacts to scan, as passed to sign.yml
|
||||
type: string
|
||||
required: true
|
||||
variant:
|
||||
description: Variant to scan, as listed in tools/release/variants.txt; every variant when omitted
|
||||
type: string
|
||||
default: '*'
|
||||
fail_on_detection:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
virustotal:
|
||||
name: VirusTotal
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 90
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
sparse-checkout: tools/release
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: ${{ inputs.artifact }}-${{ inputs.variant }}
|
||||
merge-multiple: true
|
||||
path: scan
|
||||
|
||||
- name: Scan
|
||||
continue-on-error: ${{ !inputs.fail_on_detection }}
|
||||
env:
|
||||
VT_API_KEY: ${{ secrets.VIRUSTOTAL_API_KEY }}
|
||||
FAIL_ON_DETECTION: ${{ inputs.fail_on_detection && '1' || '0' }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "$VT_API_KEY" ]; then
|
||||
echo "::warning title=VirusTotal::no VIRUSTOTAL_API_KEY secret; skipping the scan"
|
||||
exit 0
|
||||
fi
|
||||
bash tools/release/virustotal-scan.sh scan/*.apk
|
||||
Reference in new issue
Block a user