|
| 1 | +name: CodeEntropy CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: pr-${{ github.ref }} |
| 8 | + cancel-in-progress: true |
| 9 | + |
| 10 | +jobs: |
| 11 | + unit: |
| 12 | + name: Unit |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + timeout-minutes: 25 |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + os: [ubuntu-24.04, macos-15, windows-2025] |
| 19 | + python-version: ["3.12", "3.13", "3.14"] |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 |
| 23 | + |
| 24 | + - name: Set up Python ${{ matrix.python-version }} |
| 25 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 26 | + with: |
| 27 | + python-version: ${{ matrix.python-version }} |
| 28 | + cache: pip |
| 29 | + |
| 30 | + - name: Install testing dependencies |
| 31 | + run: | |
| 32 | + python -m pip install --upgrade pip |
| 33 | + python -m pip install -e .[testing] |
| 34 | +
|
| 35 | + - name: Pytest (unit) • ${{ matrix.os }}, ${{ matrix.python-version }} |
| 36 | + run: python -m pytest tests/unit -q |
| 37 | + |
| 38 | + regression-quick: |
| 39 | + name: Regression (quick) |
| 40 | + needs: unit |
| 41 | + runs-on: ubuntu-24.04 |
| 42 | + timeout-minutes: 35 |
| 43 | + steps: |
| 44 | + - name: Checkout |
| 45 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 |
| 46 | + |
| 47 | + - name: Set up Python 3.14 |
| 48 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 49 | + with: |
| 50 | + python-version: "3.14" |
| 51 | + cache: pip |
| 52 | + |
| 53 | + - name: Cache testdata |
| 54 | + uses: actions/cache@v4 |
| 55 | + with: |
| 56 | + path: .testdata |
| 57 | + key: codeentropy-testdata-v1-${{ runner.os }}-py3.14 |
| 58 | + |
| 59 | + - name: Install (testing) |
| 60 | + run: | |
| 61 | + python -m pip install --upgrade pip |
| 62 | + python -m pip install -e .[testing] |
| 63 | +
|
| 64 | + - name: Pytest (regression quick) |
| 65 | + run: python -m pytest tests/regression -q |
| 66 | + |
| 67 | + - name: Upload artifacts (failure) |
| 68 | + if: failure() |
| 69 | + uses: actions/upload-artifact@v4 |
| 70 | + with: |
| 71 | + name: quick-regression-failure |
| 72 | + path: | |
| 73 | + .testdata/** |
| 74 | + tests/regression/**/.pytest_cache/** |
| 75 | + /tmp/pytest-of-*/pytest-*/**/config.yaml |
| 76 | + /tmp/pytest-of-*/pytest-*/**/codeentropy_stdout.txt |
| 77 | + /tmp/pytest-of-*/pytest-*/**/codeentropy_stderr.txt |
| 78 | + /tmp/pytest-of-*/pytest-*/**/codeentropy_output.json |
| 79 | +
|
| 80 | + docs: |
| 81 | + name: Docs |
| 82 | + runs-on: ubuntu-24.04 |
| 83 | + timeout-minutes: 25 |
| 84 | + steps: |
| 85 | + - name: Checkout |
| 86 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 |
| 87 | + |
| 88 | + - name: Set up Python 3.14 |
| 89 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 90 | + with: |
| 91 | + python-version: "3.14" |
| 92 | + cache: pip |
| 93 | + |
| 94 | + - name: Install (docs) |
| 95 | + run: | |
| 96 | + python -m pip install --upgrade pip |
| 97 | + python -m pip install -e .[docs] |
| 98 | +
|
| 99 | + - name: Build docs |
| 100 | + run: | |
| 101 | + cd docs |
| 102 | + make |
| 103 | +
|
| 104 | + pre-commit: |
| 105 | + name: Pre-commit |
| 106 | + runs-on: ubuntu-24.04 |
| 107 | + timeout-minutes: 15 |
| 108 | + steps: |
| 109 | + - name: Checkout |
| 110 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 |
| 111 | + |
| 112 | + - name: Set up Python 3.14 |
| 113 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 114 | + with: |
| 115 | + python-version: "3.14" |
| 116 | + cache: pip |
| 117 | + |
| 118 | + - name: Install (pre-commit) |
| 119 | + run: | |
| 120 | + python -m pip install --upgrade pip |
| 121 | + python -m pip install -e .[pre-commit] |
| 122 | +
|
| 123 | + - name: Run pre-commit |
| 124 | + shell: bash |
| 125 | + run: | |
| 126 | + pre-commit install |
| 127 | + pre-commit run --all-files || { |
| 128 | + git status --short |
| 129 | + git diff |
| 130 | + exit 1 |
| 131 | + } |
| 132 | +
|
| 133 | + coverage: |
| 134 | + name: Coverage |
| 135 | + needs: unit |
| 136 | + runs-on: ubuntu-24.04 |
| 137 | + timeout-minutes: 30 |
| 138 | + steps: |
| 139 | + - name: Checkout repo |
| 140 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 |
| 141 | + |
| 142 | + - name: Set up Python 3.14 |
| 143 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 |
| 144 | + with: |
| 145 | + python-version: "3.14" |
| 146 | + cache: pip |
| 147 | + |
| 148 | + - name: Install (testing) |
| 149 | + run: | |
| 150 | + python -m pip install --upgrade pip |
| 151 | + python -m pip install -e .[testing] |
| 152 | +
|
| 153 | + - name: Run unit test suite with coverage |
| 154 | + run: | |
| 155 | + pytest tests/unit \ |
| 156 | + --cov CodeEntropy \ |
| 157 | + --cov-report term-missing \ |
| 158 | + --cov-report xml \ |
| 159 | + -q |
| 160 | +
|
| 161 | + - name: Upload to Coveralls |
| 162 | + uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e |
| 163 | + with: |
| 164 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 165 | + file: coverage.xml |
| 166 | + fail-on-error: false |
0 commit comments