summaryrefslogtreecommitdiffstats
path: root/.github/workflows/ci.yml
blob: cc85639bc7beeaf0b0fffa522977f8fe7cf089c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# badge: https://github.com/borgbackup/borg/workflows/CI/badge.svg?branch=master

name: CI

on:
  push:
    branches: [ 1.2-maint ]
    paths:
    - '**.py'
    - '**.pyx'
    - '**.c'
    - '**.h'
    - '**.yml'
    - '**.toml'
    - '**.cfg'
    - '**.ini'
    - 'requirements.d/*'
    - '!docs/**'
  pull_request:
    branches: [ 1.2-maint ]
    paths:
    - '**.py'
    - '**.pyx'
    - '**.c'
    - '**.h'
    - '**.yml'
    - '**.toml'
    - '**.cfg'
    - '**.ini'
    - 'requirements.d/*'
    - '!docs/**'

jobs:
  lint:

    runs-on: ubuntu-22.04
    timeout-minutes: 5

    steps:
    - uses: actions/checkout@v4
    - name: Set up Python
      uses: actions/setup-python@v5
      with:
        python-version: 3.11
    - name: Lint with flake8
      run: |
        pip install flake8
        flake8 src scripts conftest.py

  pytest:

    needs: lint
    strategy:
      fail-fast: false
      matrix:
        include:
            - os: ubuntu-20.04
              python-version: '3.8'
              toxenv: py38-fuse2
            - os: ubuntu-20.04
              python-version: '3.9'
              toxenv: py39-fuse3
            - os: ubuntu-22.04
              python-version: '3.10'
              toxenv: py310-fuse3
            - os: ubuntu-22.04
              python-version: '3.11'
              toxenv: py311-fuse2
            - os: ubuntu-22.04
              python-version: '3.12'
              toxenv: py312-fuse3
            - os: macos-14
              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@3.0/lib/pkgconfig:$PKG_CONFIG_PATH"
      TOXENV: ${{ matrix.toxenv }}

    runs-on: ${{ matrix.os }}
    timeout-minutes: 180

    steps:
    - uses: actions/checkout@v4
      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@v5
      with:
        python-version: ${{ matrix.python-version }}
    - name: Cache pip
      uses: actions/cache@v4
      with:
        path: ~/.cache/pip
        key: ${{ runner.os }}-pip-${{ hashFiles('requirements.d/development.txt') }}
        restore-keys: |
            ${{ runner.os }}-pip-
            ${{ runner.os }}-

    - name: Install Linux packages
      if: ${{ runner.os == 'Linux' }}
      run: |
        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 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

    - name: Install macOS packages
      if: ${{ runner.os == 'macOS' }}
      run: |
        brew install pkg-config || brew upgrade pkg-config
        brew install zstd || brew upgrade zstd
        brew install lz4 || brew upgrade lz4
        brew install openssl@3.0 || brew upgrade openssl@3.0

    - name: Install Python requirements
      run: |
        python -m pip install --upgrade pip setuptools wheel
        pip install -r requirements.d/development.txt
    - name: Install borgbackup
      env:
        # 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@3.0/lib/pkgconfig:$PKG_CONFIG_PATH"
      run: |
        # pip install -e .
        python setup.py -v develop
    - name: run pytest via tox
      env:
        # 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@3.0/lib/pkgconfig:$PKG_CONFIG_PATH"
      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@v4
      env:
        OS: ${{ runner.os }}
        python: ${{ matrix.python-version }}
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        env_vars: OS, python