|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + pytest-conda: |
| 7 | + name: pytest (conda) |
| 8 | + |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 12 | + python-version: ['3.13t', '3.13', '3.12', '3.11', '3.10', '3.9', '3.8', '3.7'] |
| 13 | + |
| 14 | + fail-fast: false |
| 15 | + |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + |
| 18 | + defaults: |
| 19 | + run: |
| 20 | + shell: bash -l {0} |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout repository |
| 24 | + uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Substitute Python version |
| 27 | + run: | |
| 28 | + perl -i -spwe 's/^ *- python=\K.+$/$pyver/' -- \ |
| 29 | + -pyver=${{ matrix.python-version }} environment.yml |
| 30 | +
|
| 31 | + - name: Set up micromamba |
| 32 | + uses: mamba-org/setup-micromamba@v1 |
| 33 | + with: |
| 34 | + environment-file: environment.yml |
| 35 | + |
| 36 | + - name: Run all tests |
| 37 | + run: pytest --doctest-modules |
| 38 | + timeout-minutes: 2 |
| 39 | + |
| 40 | + pytest-pipenv-lock: |
| 41 | + name: pytest (Pipfile.lock) |
| 42 | + |
| 43 | + strategy: |
| 44 | + matrix: |
| 45 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 46 | + |
| 47 | + fail-fast: false |
| 48 | + |
| 49 | + runs-on: ${{ matrix.os }} |
| 50 | + |
| 51 | + steps: |
| 52 | + - name: Checkout repository |
| 53 | + uses: actions/checkout@v4 |
| 54 | + |
| 55 | + - name: Set up Python |
| 56 | + uses: actions/setup-python@v5 |
| 57 | + with: |
| 58 | + python-version: 3.11 |
| 59 | + |
| 60 | + - name: Upgrade PyPA packages |
| 61 | + run: python -m pip install -U pip setuptools wheel |
| 62 | + |
| 63 | + - name: Install pipenv |
| 64 | + run: pip install pipenv |
| 65 | + |
| 66 | + - name: Install project with all dependencies |
| 67 | + run: pipenv install -d |
| 68 | + |
| 69 | + - name: Run all tests |
| 70 | + run: pipenv run pytest --doctest-modules |
| 71 | + timeout-minutes: 2 |
| 72 | + |
| 73 | + pytest-pipenv: |
| 74 | + name: pytest (Pipfile) |
| 75 | + |
| 76 | + strategy: |
| 77 | + matrix: |
| 78 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 79 | + python-version: ['3.13t', '3.13', '3.12', '3.11', '3.10', '3.9', '3.8', '3.7'] |
| 80 | + |
| 81 | + fail-fast: false |
| 82 | + |
| 83 | + runs-on: ${{ matrix.os }} |
| 84 | + |
| 85 | + defaults: |
| 86 | + run: |
| 87 | + shell: bash |
| 88 | + |
| 89 | + steps: |
| 90 | + - name: Checkout repository |
| 91 | + uses: actions/checkout@v4 |
| 92 | + |
| 93 | + - name: Remove Pipfile.lock |
| 94 | + run: rm Pipfile.lock |
| 95 | + |
| 96 | + - name: Drop full Python version |
| 97 | + run: | |
| 98 | + perl -i -nwe 'print unless /^python_full_version = "[^"]+"$/' Pipfile |
| 99 | +
|
| 100 | + - name: Substitute Python version |
| 101 | + run: | |
| 102 | + perl -i -spwe 's/^python_version = "\K[^"]+(?="$)/$pyver/' -- \ |
| 103 | + -pyver=${{ matrix.python-version }} Pipfile |
| 104 | +
|
| 105 | + - name: Set up Python |
| 106 | + uses: actions/setup-python@v5 |
| 107 | + with: |
| 108 | + python-version: ${{ matrix.python-version }} |
| 109 | + |
| 110 | + - name: Upgrade PyPA packages |
| 111 | + run: python -m pip install -U pip setuptools wheel |
| 112 | + |
| 113 | + - name: Install pipenv |
| 114 | + run: pip install pipenv |
| 115 | + |
| 116 | + - name: Install project with all dependencies |
| 117 | + run: pipenv install -d |
| 118 | + |
| 119 | + - name: Run all tests |
| 120 | + run: pipenv run pytest --doctest-modules |
| 121 | + timeout-minutes: 2 |
| 122 | + |
| 123 | + lint: |
| 124 | + name: Lint (flake8) |
| 125 | + |
| 126 | + runs-on: ubuntu-latest |
| 127 | + |
| 128 | + steps: |
| 129 | + - name: Check out source repository |
| 130 | + uses: actions/checkout@v4 |
| 131 | + |
| 132 | + - name: Set up Python environment |
| 133 | + uses: actions/setup-python@v5 |
| 134 | + with: |
| 135 | + python-version: "3.11" |
| 136 | + |
| 137 | + - name: flake8 Lint |
| 138 | + uses: py-actions/flake8@v2 |
| 139 | + |
| 140 | + shellcheck: |
| 141 | + name: ShellCheck |
| 142 | + |
| 143 | + runs-on: ubuntu-latest |
| 144 | + |
| 145 | + steps: |
| 146 | + - name: Check out source repository |
| 147 | + uses: actions/checkout@v4 |
| 148 | + |
| 149 | + - name: Analyze shell scripts |
| 150 | + uses: bewuethr/shellcheck-action@v2 |
0 commit comments