From 9391b15a8c844c40e24bc4348188764bbce39e08 Mon Sep 17 00:00:00 2001 From: Russell Martin Date: Sat, 18 Nov 2023 11:29:26 -0500 Subject: [PATCH] Specify app user data path for tested on Windows --- .github/workflows/ci.yml | 36 +++++++++++++++++++----------------- changes/2235.misc.rst | 1 + 2 files changed, 20 insertions(+), 17 deletions(-) create mode 100644 changes/2235.misc.rst diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a397153c5c..b4bfa4fee3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -150,7 +150,7 @@ jobs: - backend: macOS runs-on: macos-12 - app-user-data-path: /Users/runner/Library/Application Support/org.beeware.toga.testbed + app-user-data-path: $HOME/Library/Application Support/org.beeware.toga.testbed # We use a fixed Ubuntu version rather than `-latest` because at some point, # `-latest` will be updated, but it will be a soft changeover, which would cause @@ -180,22 +180,23 @@ jobs: briefcase-run-prefix: 'DISPLAY=:99' setup-python: false # Use the system Python packages. - app-user-data-path: /home/runner/.local/share/testbed + app-user-data-path: $HOME/.local/share/testbed - backend: windows runs-on: windows-latest + app-user-data-path: $HOME\AppData\Local\Tiberius Yak\Toga Testbed\Data - backend: iOS runs-on: macos-12 briefcase-run-args: ' -d "iPhone SE (3rd generation)"' - # app data path is determined at runtime, as the path contains the Simulator and app ID. + app-user-data-path: $(xcrun simctl get_app_container booted org.beeware.toga.testbed data)/Documents - backend: android runs-on: ubuntu-latest briefcase-run-args: " -d '{\"avd\":\"beePhone\"}' --Xemulator=-no-window --Xemulator=-no-snapshot --Xemulator=-no-audio --Xemulator=-no-boot-anim --shutdown-on-exit" pre-command: | # check if virtualization is supported... - sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok + sudo apt install -qq --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok # allow access to KVM to run the emulator echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ | sudo tee /etc/udev/rules.d/99-kvm4all.rules @@ -205,46 +206,47 @@ jobs: - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 + - name: Set up Python uses: actions/setup-python@v4.7.1 - if: ${{ matrix.setup-python }} + if: matrix.setup-python with: # We're not using Python 3.11 yet, because: # * The testbed's ProxyEventLoop has some problems with it # (https://github.com/beeware/toga/issues/1982). # * It doesn't have an Android build of Pillow yet. python-version: "3.10" + - name: Install dependencies run: | ${{ matrix.pre-command }} # Use the development version of Briefcase python -m pip install git+https://github.com/beeware/briefcase.git + - name: Test App - run: | - cd testbed - ${{ matrix.briefcase-run-prefix }} briefcase run ${{ matrix.backend }} --test ${{ matrix.briefcase-run-args }} + working-directory: testbed + run: ${{ matrix.briefcase-run-prefix }} briefcase run ${{ matrix.backend }} --test ${{ matrix.briefcase-run-args }} + - name: Upload logs uses: actions/upload-artifact@v3.1.3 if: failure() with: name: testbed-failure-logs-${{ matrix.backend }} path: testbed/logs/* + - name: Copy app generated user data - if: failure() + if: failure() && matrix.backend != 'android' run: | - mkdir testbed/app_data - if [ "${{ matrix.backend }}" = "iOS" ]; then - APP_DATA_PATH="$(xcrun simctl get_app_container booted org.beeware.toga.testbed data)/Documents" - else - APP_DATA_PATH="${{ matrix.app-user-data-path }}" - fi - cp -r "$APP_DATA_PATH" testbed/app_data/testbed-app_data-${{ matrix.backend }} + mkdir -p testbed/app_data + cp -r "${{ matrix.app-user-data-path }}" testbed/app_data/testbed-app_data-${{ matrix.backend }} + - name: Upload app data uses: actions/upload-artifact@v3.1.3 - if: failure() + if: failure() && matrix.backend != 'android' with: name: testbed-failure-app-data-${{ matrix.backend }} path: testbed/app_data/* + # This step is only needed if you're trying to diagnose test failures that # only occur in CI, and can't be reproduced locally. When it runs, it will # open an SSH server (URL reported in the logs) so you can ssh into the CI diff --git a/changes/2235.misc.rst b/changes/2235.misc.rst new file mode 100644 index 0000000000..164d14d437 --- /dev/null +++ b/changes/2235.misc.rst @@ -0,0 +1 @@ +If the testbed fails on Windows, the user's app data path contents are now uploaded.