|
| 1 | +name: CI |
| 2 | + |
| 3 | +env: |
| 4 | + POETRY_VIRTUALENVS_CREATE: true |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ main, develop ] |
| 9 | + pull_request: |
| 10 | + |
| 11 | +jobs: |
| 12 | + lint: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + - uses: actions/setup-python@v5 |
| 17 | + with: |
| 18 | + python-version: '3.11' |
| 19 | + - uses: actions/cache@v4 |
| 20 | + with: |
| 21 | + path: | |
| 22 | + ~/.cache/pip |
| 23 | + ~/.cache/pypoetry |
| 24 | + key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} |
| 25 | + restore-keys: | |
| 26 | + ${{ runner.os }}-poetry- |
| 27 | + - uses: abatilo/actions-poetry@v3 |
| 28 | + with: |
| 29 | + poetry-version: 1.8.3 |
| 30 | + - name: Install deps |
| 31 | + run: poetry install |
| 32 | + - name: Lint |
| 33 | + run: poetry run flake8 src/ssspx |
| 34 | + - name: Docstring style |
| 35 | + run: poetry run pydocstyle src/ssspx |
| 36 | + - name: Docstring coverage |
| 37 | + run: poetry run docstr-coverage src/ssspx --fail-under 90 |
| 38 | + - name: Type check |
| 39 | + run: poetry run mypy src/ssspx |
| 40 | + - name: Security scan |
| 41 | + run: poetry run bandit -r src/ssspx -c bandit.yaml --severity-level high |
| 42 | + - name: Dependency audit |
| 43 | + run: poetry run pip-audit --ignore-vuln PYSEC-2022-42969 |
| 44 | + - name: Deprecations up-to-date |
| 45 | + run: poetry run python tools/check_deprecations.py |
| 46 | + - name: Validate citation metadata |
| 47 | + run: poetry run cffconvert --validate --infile CITATION.cff |
| 48 | + |
| 49 | + unit: |
| 50 | + needs: lint |
| 51 | + runs-on: ${{ matrix.os }} |
| 52 | + strategy: |
| 53 | + fail-fast: false |
| 54 | + matrix: |
| 55 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 56 | + python-version: ['3.9', '3.10', '3.11', '3.12'] |
| 57 | + defaults: |
| 58 | + run: |
| 59 | + shell: bash |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v4 |
| 62 | + - uses: actions/setup-python@v5 |
| 63 | + with: |
| 64 | + python-version: ${{ matrix.python-version }} |
| 65 | + - uses: actions/cache@v4 |
| 66 | + with: |
| 67 | + path: | |
| 68 | + ~/.cache/pip |
| 69 | + ~/.cache/pypoetry |
| 70 | + C:\\Users\\runneradmin\\AppData\\Local\\pip\\Cache |
| 71 | + C:\\Users\\runneradmin\\AppData\\Local\\pypoetry\\Cache |
| 72 | + key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} |
| 73 | + restore-keys: | |
| 74 | + ${{ runner.os }}-poetry- |
| 75 | + - uses: abatilo/actions-poetry@v3 |
| 76 | + with: |
| 77 | + poetry-version: 1.8.3 |
| 78 | + - name: Install deps |
| 79 | + run: poetry install |
| 80 | + - name: Unit tests |
| 81 | + run: poetry run pytest -q --maxfail=1 --disable-warnings --cov=ssspx --cov-report=term-missing -m "not integration" |
| 82 | + |
| 83 | + integration: |
| 84 | + runs-on: ubuntu-latest |
| 85 | + needs: [lint, unit] |
| 86 | + steps: |
| 87 | + - uses: actions/checkout@v4 |
| 88 | + - uses: actions/setup-python@v5 |
| 89 | + with: |
| 90 | + python-version: '3.11' |
| 91 | + - uses: actions/cache@v4 |
| 92 | + with: |
| 93 | + path: | |
| 94 | + ~/.cache/pip |
| 95 | + ~/.cache/pypoetry |
| 96 | + key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} |
| 97 | + restore-keys: | |
| 98 | + ${{ runner.os }}-poetry- |
| 99 | + - uses: abatilo/actions-poetry@v3 |
| 100 | + with: |
| 101 | + poetry-version: 1.8.3 |
| 102 | + - name: Install deps |
| 103 | + run: poetry install |
| 104 | + - name: Integration tests |
| 105 | + run: poetry run pytest -q -m integration |
| 106 | + |
| 107 | + docs: |
| 108 | + runs-on: ubuntu-latest |
| 109 | + needs: [lint, unit] |
| 110 | + steps: |
| 111 | + - uses: actions/checkout@v4 |
| 112 | + - uses: actions/setup-python@v5 |
| 113 | + with: |
| 114 | + python-version: '3.11' |
| 115 | + - uses: actions/cache@v4 |
| 116 | + with: |
| 117 | + path: | |
| 118 | + ~/.cache/pip |
| 119 | + ~/.cache/pypoetry |
| 120 | + key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} |
| 121 | + restore-keys: | |
| 122 | + ${{ runner.os }}-poetry- |
| 123 | + - uses: abatilo/actions-poetry@v3 |
| 124 | + with: |
| 125 | + poetry-version: 1.8.3 |
| 126 | + - name: Install deps |
| 127 | + run: poetry install |
| 128 | + - name: Build docs |
| 129 | + run: poetry run mkdocs build --strict |
| 130 | + |
| 131 | + release: |
| 132 | + runs-on: ubuntu-latest |
| 133 | + needs: [integration, docs] |
| 134 | + if: github.ref == 'refs/heads/main' && github.event_name == 'push' |
| 135 | + steps: |
| 136 | + - uses: actions/checkout@v4 |
| 137 | + - uses: actions/setup-python@v5 |
| 138 | + with: |
| 139 | + python-version: '3.11' |
| 140 | + - uses: actions/cache@v4 |
| 141 | + with: |
| 142 | + path: | |
| 143 | + ~/.cache/pip |
| 144 | + ~/.cache/pypoetry |
| 145 | + key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} |
| 146 | + restore-keys: | |
| 147 | + ${{ runner.os }}-poetry- |
| 148 | + - uses: abatilo/actions-poetry@v3 |
| 149 | + with: |
| 150 | + poetry-version: 1.8.3 |
| 151 | + - name: Install deps |
| 152 | + run: poetry install |
| 153 | + - name: Build distributions |
| 154 | + run: poetry build |
| 155 | + - name: Upload artifacts |
| 156 | + uses: actions/upload-artifact@v4 |
| 157 | + with: |
| 158 | + name: dist |
| 159 | + path: dist/* |
| 160 | + - name: Publish release |
| 161 | + env: |
| 162 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 163 | + run: poetry run semantic-release publish --skip-build |
| 164 | + |
| 165 | + extras: |
| 166 | + runs-on: ubuntu-latest |
| 167 | + needs: lint |
| 168 | + steps: |
| 169 | + - uses: actions/checkout@v4 |
| 170 | + - uses: actions/setup-python@v5 |
| 171 | + with: |
| 172 | + python-version: '3.11' |
| 173 | + - uses: actions/cache@v4 |
| 174 | + with: |
| 175 | + path: | |
| 176 | + ~/.cache/pip |
| 177 | + ~/.cache/pypoetry |
| 178 | + key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}-numpy |
| 179 | + restore-keys: | |
| 180 | + ${{ runner.os }}-poetry- |
| 181 | + - uses: abatilo/actions-poetry@v3 |
| 182 | + with: |
| 183 | + poetry-version: 1.8.3 |
| 184 | + - name: Install with extras |
| 185 | + run: poetry install -E numpy-backend |
| 186 | + - name: Unit tests with extras |
| 187 | + run: poetry run pytest -q --maxfail=1 --disable-warnings -m "not integration" |
0 commit comments