Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
t184256 committed Jun 15, 2024
1 parent e931f1e commit 383cb96
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/emulator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ jobs:
- name: Build zipball, channel tarball and flake to inject
run: |
rm -rf n-o-d
mkdir -p n-o-d/unpacked
git -C . archive --format=tar --prefix n-o-d/ HEAD > n-o-d/archive.tar
tar --strip-components=1 -xf n-o-d/archive.tar -C n-o-d/unpacked
gzip n-o-d/archive.tar
mkdir -p n-o-d
git -C . archive --format=tar.gz --prefix n-o-d/ HEAD > n-o-d/archive.tar.gz
nix run '.#deploy' -- file:///data/local/tmp/n-o-d/archive.tar.gz n-o-d/
- name: Configure AVD cache
Expand Down Expand Up @@ -77,6 +75,7 @@ jobs:
script: >
adb shell 'rm -rf /data/local/tmp/n-o-d' &&
adb push n-o-d /data/local/tmp/ &&
adb shell 'cd /data/local/tmp/n-o-d && tar xzof archive.tar.gz && mv n-o-d unpacked' &&
cd tests/emulator &&
adb shell settings put secure enabled_accessibility_services com.google.android.marvin.talkback/com.google.android.marvin.talkback.TalkBackService &&
nix run 'github:t184256/droidctl' -- run ${{ matrix.way }}.py
Expand Down
10 changes: 1 addition & 9 deletions nix-on-droid/nix-on-droid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,7 @@ function doHelp() {
}

function doOnDeviceTest() {
# This is for maintainer convenience only, see tests/on-device/.run.sh

# /data/local/tmp/n-o-d/unpacked is available in fakedroid environment
if [[ -d "/data/local/tmp/n-o-d/unpacked" ]]; then
export NIX_PATH="nix-on-droid=/data/local/tmp/n-o-d/unpacked:$NIX_PATH"
else
nix-channel --update nix-on-droid
fi

nix-channel --update nix-on-droid
exec "$(nix-instantiate --eval --expr \
"<nix-on-droid/tests/on-device/.run.sh>")" "$@"
}
Expand Down
7 changes: 5 additions & 2 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ else
{ echo "unsupported url $PUBLIC_URL" >&2; exit 1; }
export NIX_ON_DROID_CHANNEL_URL="$PUBLIC_URL"
fi
if [[ "$PUBLIC_URL" =~ ^file:///(.*) ]]; then
export NIX_ON_DROID_FLAKE_URL="/${BASH_REMATCH[1]}"
# special case for local / CI testing
if [[ "$PUBLIC_URL" =~ ^file:///(.*)/archive.tar.gz ]]; then
export NIX_ON_DROID_FLAKE_URL="/${BASH_REMATCH[1]}/unpacked"
else
export NIX_ON_DROID_FLAKE_URL="$PUBLIC_URL"
fi
log "NIX_ON_DROID_CHANNEL_URL=$NIX_ON_DROID_CHANNEL_URL"
log "NIX_ON_DROID_FLAKE_URL=$NIX_ON_DROID_FLAKE_URL"


PROOT_HASH_FILE="modules/environment/login/default.nix"
Expand Down
9 changes: 4 additions & 5 deletions tests/fakedroid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,11 @@ fi

rm -rf "$ENV_DIR/data/local/tmp/n-o-d"
mkdir -p "$ENV_DIR/data/local/tmp/n-o-d/unpacked"
git -C "$REPO_DIR" archive --format=tar --prefix n-o-d/ HEAD \
> "$ENV_DIR/data/local/tmp/n-o-d/archive.tar"
tar --strip-components=1 -xf \
"$ENV_DIR/data/local/tmp/n-o-d/archive.tar" \
git -C "$REPO_DIR" archive --format=tar.gz --prefix n-o-d/ HEAD \
> "$ENV_DIR/data/local/tmp/n-o-d/archive.tar.gz"
tar --strip-components=1 -xzf \
"$ENV_DIR/data/local/tmp/n-o-d/archive.tar.gz" \
-C "$ENV_DIR/data/local/tmp/n-o-d/unpacked"
gzip "$ENV_DIR/data/local/tmp/n-o-d/archive.tar"


# The 'first boot' proot invocation:
Expand Down

0 comments on commit 383cb96

Please sign in to comment.