Browse Source

CI: FUSE related fixes/improvements (1.4-maint)

fixes #9182

- install OS fuse support packages as indicated by the tox env
  on the macOS runners, we do not have any fuse support.
  on the linux runners, we may have fuse2 or fuse3.
  on FreeBSD, we have fuse2.
- install fuse python library for binary build
- first build/upload binaries, then run tests (including binary tests).
  early uploading makes inspection of a malfunctioning binary possible.
- for now, use llfuse, as there is an issue with pyinstaller and pyfuse3.

Also:
- remove || true - this just hides errors, not what we want.
Thomas Waldmann 3 weeks ago
parent
commit
c845565c4a
1 changed files with 41 additions and 23 deletions
  1. 41 23
      .github/workflows/ci.yml

+ 41 - 23
.github/workflows/ci.yml

@@ -176,9 +176,12 @@ jobs:
       run: |
       run: |
         sudo apt-get update
         sudo apt-get update
         sudo apt-get install -y libssl-dev libacl1-dev liblz4-dev libzstd-dev pkg-config build-essential
         sudo apt-get install -y libssl-dev libacl1-dev liblz4-dev libzstd-dev pkg-config build-essential
-        sudo apt-get install -y libxxhash-dev || true
-        sudo apt-get install -y libfuse-dev fuse || true  # Required for Python llfuse module
-        sudo apt-get install -y libfuse3-dev fuse3 || true  # Required for Python pyfuse3 module
+        sudo apt-get install -y libxxhash-dev
+        if [[ "$TOXENV" == *"fuse2"* ]]; then
+          sudo apt-get install -y libfuse-dev fuse  # Required for Python llfuse module
+        elif [[ "$TOXENV" == *"fuse3"* ]]; then
+          sudo apt-get install -y libfuse3-dev fuse3  # Required for Python pyfuse3 module
+        fi
 
 
     - name: Install macOS packages
     - name: Install macOS packages
       if: ${{ runner.os == 'macOS' }}
       if: ${{ runner.os == 'macOS' }}
@@ -191,28 +194,21 @@ jobs:
 
 
     - name: Install BorgBackup
     - name: Install BorgBackup
       run: |
       run: |
-        pip install -ve .
-
-    - name: Run pytest via tox
-      run: |
-        # Do not use fakeroot; run as root. Avoids the dreaded sporadic EISDIR failures; see #2482.
-        #sudo -E bash -c "tox -e py"
-        tox --skip-missing-interpreters
-
-    - name: Upload coverage to Codecov
-      uses: codecov/codecov-action@v4
-      env:
-        OS: ${{ runner.os }}
-        python: ${{ matrix.python-version }}
-      with:
-        token: ${{ secrets.CODECOV_TOKEN }}
-        env_vars: OS, python
+        if [[ "$TOXENV" == *"fuse2"* ]]; then
+          pip install -ve ".[llfuse]"
+        elif [[ "$TOXENV" == *"fuse3"* ]]; then
+          pip install -ve ".[pyfuse3]"
+        else
+          pip install -ve .
+        fi
 
 
     - name: Build Borg fat binaries (${{ matrix.binary }})
     - name: Build Borg fat binaries (${{ matrix.binary }})
       if: ${{ matrix.binary && startsWith(github.ref, 'refs/tags/') }}
       if: ${{ matrix.binary && startsWith(github.ref, 'refs/tags/') }}
       run: |
       run: |
         pip install 'pyinstaller==6.14.2'
         pip install 'pyinstaller==6.14.2'
         mkdir -p dist/binary
         mkdir -p dist/binary
+        # Ensure locally built binaries in ./dist/binary are found during tox tests
+        echo "$GITHUB_WORKSPACE/dist/binary" >> "$GITHUB_PATH"
         pyinstaller --clean --distpath=dist/binary scripts/borg.exe.spec
         pyinstaller --clean --distpath=dist/binary scripts/borg.exe.spec
 
 
     - name: Smoke-test the built binary (${{ matrix.binary }})
     - name: Smoke-test the built binary (${{ matrix.binary }})
@@ -227,6 +223,8 @@ jobs:
         ./borg-dir/borg.exe -V
         ./borg-dir/borg.exe -V
         tar czf borg.tgz borg-dir
         tar czf borg.tgz borg-dir
         popd
         popd
+        echo "borg.exe binary in PATH"
+        borg.exe -V
 
 
     - name: Prepare binaries (${{ matrix.binary }})
     - name: Prepare binaries (${{ matrix.binary }})
       if: ${{ matrix.binary && startsWith(github.ref, 'refs/tags/') }}
       if: ${{ matrix.binary && startsWith(github.ref, 'refs/tags/') }}
@@ -255,6 +253,21 @@ jobs:
         path: artifacts/*
         path: artifacts/*
         if-no-files-found: error
         if-no-files-found: error
 
 
+    - name: Run pytest via tox
+      run: |
+        # Do not use fakeroot; run as root. Avoids the dreaded sporadic EISDIR failures; see #2482.
+        #sudo -E bash -c "tox -e py"
+        tox --skip-missing-interpreters
+
+    - name: Upload coverage to Codecov
+      uses: codecov/codecov-action@v4
+      env:
+        OS: ${{ runner.os }}
+        python: ${{ matrix.python-version }}
+      with:
+        token: ${{ secrets.CODECOV_TOKEN }}
+        env_vars: OS, python
+
   vm_tests:
   vm_tests:
 
 
     # Cross-OS tests running inside VMs, aligned with master branch structure.
     # Cross-OS tests running inside VMs, aligned with master branch structure.
@@ -317,8 +330,10 @@ jobs:
               export IGNORE_OSVERSION=yes
               export IGNORE_OSVERSION=yes
               sudo -E pkg update -f
               sudo -E pkg update -f
               sudo -E pkg install -y xxhash liblz4 zstd pkgconf
               sudo -E pkg install -y xxhash liblz4 zstd pkgconf
-              # Install one of the FUSE libraries; fail if neither is available
-              sudo -E pkg install -y fusefs-libs || sudo -E pkg install -y fusefs-libs3
+              sudo -E pkg install -y fusefs-libs
+              sudo -E kldload fusefs
+              sudo -E sysctl vfs.usermount=1
+              sudo -E chmod 666 /dev/fuse
               sudo -E pkg install -y rust
               sudo -E pkg install -y rust
               sudo -E pkg install -y git
               sudo -E pkg install -y git
               sudo -E pkg install -y python310 py310-sqlite3
               sudo -E pkg install -y python310 py310-sqlite3
@@ -333,8 +348,7 @@ jobs:
               pip -V
               pip -V
               python -m pip install --upgrade pip wheel
               python -m pip install --upgrade pip wheel
               pip install -r requirements.d/development.txt
               pip install -r requirements.d/development.txt
-              pip install -e .
-              tox -e py311-none
+              pip install -e ".[llfuse]"
               if [[ "${{ matrix.do_binaries }}" == "true" && "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
               if [[ "${{ matrix.do_binaries }}" == "true" && "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
                 python -m pip install 'pyinstaller==6.14.2'
                 python -m pip install 'pyinstaller==6.14.2'
                 mkdir -p dist/binary
                 mkdir -p dist/binary
@@ -355,7 +369,11 @@ jobs:
                 if [ -f dist/binary/borg.tgz ]; then
                 if [ -f dist/binary/borg.tgz ]; then
                   cp -v dist/binary/borg.tgz artifacts/${{ matrix.artifact_prefix }}.tgz
                   cp -v dist/binary/borg.tgz artifacts/${{ matrix.artifact_prefix }}.tgz
                 fi
                 fi
+                echo "binary files"
+                ls -l artifacts/
               fi
               fi
+              export PATH="$(pwd)/dist/binary:$PATH"
+              tox -e py311-fuse2
               ;;
               ;;
             netbsd)
             netbsd)
               # Ensure a proper hostname/FQDN is set (VMs may not have one by default)
               # Ensure a proper hostname/FQDN is set (VMs may not have one by default)