Browse Source

Merge pull request #7685 from ThomasWaldmann/gha-reduce-master

github actions CI: misc improvements
TW 1 year ago
parent
commit
b37c38afa9
2 changed files with 66 additions and 13 deletions
  1. 65 11
      .github/workflows/ci.yml
  2. 1 2
      setup_docs.py

+ 65 - 11
.github/workflows/ci.yml

@@ -16,7 +16,7 @@ on:
     - 'requirements.d/*'
     - '!docs/**'
   pull_request:
-    branches: [ master, borg2 ]
+    branches: [ master ]
     paths:
     - '**.py'
     - '**.pyx'
@@ -45,7 +45,7 @@ jobs:
         pip install flake8
         flake8 src scripts conftest.py
 
-  tox:
+  linux:
 
     needs: lint
     strategy:
@@ -64,13 +64,8 @@ jobs:
             - os: ubuntu-20.04
               python-version: '3.11'
               toxenv: py311-fuse3
-            - os: macos-12
-              python-version: '3.11'
-              toxenv: py311-none  # note: no fuse testing, due to #6099, see also #6196.
 
     env:
-      # Configure pkg-config to use OpenSSL from Homebrew
-      PKG_CONFIG_PATH: "/usr/local/opt/openssl@1.1/lib/pkgconfig:$PKG_CONFIG_PATH"
       TOXENV: ${{ matrix.toxenv }}
 
     runs-on: ${{ matrix.os }}
@@ -95,7 +90,6 @@ jobs:
             ${{ runner.os }}-
 
     - name: Install Linux packages
-      if: ${{ runner.os == 'Linux' }}
       run: |
         sudo apt-get update
         sudo apt-get install -y pkg-config build-essential
@@ -103,8 +97,68 @@ jobs:
         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
 
+    - name: Install Python requirements
+      run: |
+        python -m pip install --upgrade pip setuptools wheel
+        pip install -r requirements.d/development.txt
+    - name: Install borgbackup
+      run: |
+        # pip install -e .
+        python setup.py -v develop
+    - name: run tox env
+      env:
+        XDISTN: "4"
+      run: |
+        # do not use fakeroot, but run as root. avoids the dreaded EISDIR sporadic failures. see #2482.
+        #sudo -E bash -c "tox -e py"
+        tox --skip-missing-interpreters
+    - name: Upload coverage to Codecov
+      uses: codecov/codecov-action@v3
+      env:
+        OS: ${{ runner.os }}
+        python: ${{ matrix.python-version }}
+      with:
+        token: ${{ secrets.CODECOV_TOKEN }}
+        env_vars: OS, python
+
+  macOS:
+
+    needs: linux
+    strategy:
+      fail-fast: true
+      matrix:
+        include:
+            - os: macos-12
+              python-version: '3.11'
+              toxenv: py311-none  # note: no fuse testing, due to #6099, see also #6196.
+
+    env:
+      # Configure pkg-config to use OpenSSL from Homebrew
+      PKG_CONFIG_PATH: "/usr/local/opt/openssl@1.1/lib/pkgconfig:$PKG_CONFIG_PATH"
+      TOXENV: ${{ matrix.toxenv }}
+
+    runs-on: ${{ matrix.os }}
+    timeout-minutes: 60
+
+    steps:
+    - uses: actions/checkout@v3
+      with:
+        # just fetching 1 commit is not enough for setuptools-scm, so we fetch all
+        fetch-depth: 0
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v4
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Cache pip
+      uses: actions/cache@v3
+      with:
+        path: ~/.cache/pip
+        key: ${{ runner.os }}-pip-${{ hashFiles('requirements.d/development.txt') }}
+        restore-keys: |
+            ${{ runner.os }}-pip-
+            ${{ runner.os }}-
+
     - name: Install macOS packages
-      if: ${{ runner.os == 'macOS' }}
       run: |
         brew install pkg-config || brew upgrade pkg-config
         brew install zstd || brew upgrade zstd
@@ -129,7 +183,7 @@ jobs:
         # we already have that in the global env, but something is broken and overwrites that.
         # so, set it here, again.
         PKG_CONFIG_PATH: "/usr/local/opt/openssl@1.1/lib/pkgconfig:$PKG_CONFIG_PATH"
-        XDISTN: "4"
+        XDISTN: "6"
       run: |
         # do not use fakeroot, but run as root. avoids the dreaded EISDIR sporadic failures. see #2482.
         #sudo -E bash -c "tox -e py"
@@ -147,7 +201,7 @@ jobs:
 
     runs-on: windows-latest
     timeout-minutes: 60
-    needs: lint
+    needs: linux
 
     env:
       SETUPTOOLS_USE_DISTUTILS: stdlib # Needed for pip to work - https://www.msys2.org/docs/python/#known-issues

+ 1 - 2
setup_docs.py

@@ -53,8 +53,7 @@ class build_usage(Command):
         import borg
 
         borg.doc_mode = "build_man"
-        if not os.path.exists("docs/usage"):
-            os.mkdir("docs/usage")
+        os.makedirs("docs/usage", exist_ok=True)
         # allows us to build docs without the C modules fully loaded during help generation
         from borg.archiver import Archiver