aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/test.yml
blob: d7aed43128ac080402a62a4d809044c55cb58434 (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
name: Test

on: [push, pull_request]

env:
  LLVM_CONFIG: /usr/bin/llvm-config-10
  PS_PACKAGES: libps4000 libps5000 libps6000
  GMP_PACKAGES: libgmp-dev libmpfr-dev libmpc-dev
  OTHER_PACKAGES: swig gcc libpcsclite-dev llvm-10 libllvm10 llvm-10-dev

jobs:
  test:
    runs-on: ubuntu-20.04
    strategy:
      matrix:
        python-version: ["3.8", "3.9", "3.10"]
        gmp: [0, 1]
    env:
      PYTHON: ${{ matrix.python-version }}
      USE_GMP: ${{ matrix.gmp }}
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
      - uses: actions/cache@v3
        with:
          path: ~/.cache/pip
          key: pip-${{ runner.os }}-${{ matrix.gmp }}-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
          restore-keys: |
            pip-${{ runner.os }}-${{ matrix.gmp }}-${{ matrix.python-version }}-
            pip-${{ runner.os }}-${{ matrix.gmp }}-
            pip-${{ runner.os }}-
      - name: Setup Python ${{ matrix.python-version }}
        uses: actions/setup-python@v3
        with:
          python-version: ${{ matrix.python-version }}
      - name: Add picoscope repository
        run: |
          curl "https://labs.picotech.com/debian/dists/picoscope/Release.gpg.key" | sudo apt-key add
          sudo echo "deb https://labs.picotech.com/debian/ picoscope main" | sudo tee /etc/apt/sources.list.d/picoscope.list
          sudo apt-get update
      - name: Install system dependencies
        run: |
          sudo apt-get install -y $PS_PACKAGES $OTHER_PACKAGES
          if [ $USE_GMP == 1 ]; then sudo apt-get install -y $GMP_PACKAGES; fi
      - name: Install numpy
        run: |
          pip install "numpy<1.25"
      - name: Install picoscope bindings
        run: |
          git clone https://github.com/colinoflynn/pico-python && cd pico-python && python setup.py install && cd ..
          git clone https://github.com/picotech/picosdk-python-wrappers && cd picosdk-python-wrappers && python setup.py install && cd ..
      - name: Install dependencies
        run: |
          python -m pip install -U pip setuptools wheel
          if [ $USE_GMP == 1 ]; then pip install -e ".[picoscope_sdk, picoscope_alt, chipwhisperer, smartcard, leia, gmp, test, dev]"; fi
          if [ $USE_GMP == 0 ]; then pip install -e ".[picoscope_sdk, picoscope_alt, chipwhisperer, smartcard, leia, test, dev]"; fi
      - name: Test
        run: |
          make test
      - name: Code coverage
        uses: codecov/codecov-action@v1
        if: ${{ matrix.python-version == 3.9 }}
        with:
          env_vars: PYTHON,USE_GMP
          functionalities: gcov