|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, maint-0.x ] |
| 6 | + pull_request: |
| 7 | + branches: [ main, maint-0.x ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test-python-312-single-user: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Set up Python 3.12 |
| 17 | + uses: actions/setup-python@v4 |
| 18 | + with: |
| 19 | + python-version: "3.12" |
| 20 | + |
| 21 | + - name: Install dependencies |
| 22 | + run: | |
| 23 | + python -m pip install --upgrade pip |
| 24 | + pip install -e .[dev] |
| 25 | +
|
| 26 | + - name: Lint with flake8 and pylint |
| 27 | + run: make lint |
| 28 | + |
| 29 | + - name: Set up Docker Buildx |
| 30 | + uses: docker/setup-buildx-action@v3 |
| 31 | + |
| 32 | + - name: Generate certificates |
| 33 | + run: make certs |
| 34 | + |
| 35 | + - name: Start NiFi infrastructure (single-user) |
| 36 | + run: make up NIPYAPI_PROFILE=single-user |
| 37 | + |
| 38 | + - name: Wait for NiFi to be ready |
| 39 | + run: make wait-ready NIPYAPI_PROFILE=single-user |
| 40 | + |
| 41 | + - name: Run integration tests with coverage |
| 42 | + run: NIPYAPI_PROFILE=single-user PYTHONPATH=${{ github.workspace }}:$PYTHONPATH pytest --cov=nipyapi --cov-report=xml --cov-report=term-missing |
| 43 | + |
| 44 | + - name: Test distribution build and import |
| 45 | + run: make test-dist |
| 46 | + |
| 47 | + - name: Stop NiFi infrastructure |
| 48 | + if: always() |
| 49 | + run: make down |
| 50 | + |
| 51 | + - name: Upload coverage to Codecov |
| 52 | + uses: codecov/codecov-action@v4 |
| 53 | + with: |
| 54 | + file: ./coverage.xml |
| 55 | + fail_ci_if_error: false |
| 56 | + verbose: true |
| 57 | + env: |
| 58 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 59 | + |
| 60 | + test-python-311-single-user: |
| 61 | + runs-on: ubuntu-latest |
| 62 | + |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v4 |
| 65 | + |
| 66 | + - name: Set up Python 3.11 |
| 67 | + uses: actions/setup-python@v4 |
| 68 | + with: |
| 69 | + python-version: "3.11" |
| 70 | + |
| 71 | + - name: Install dependencies |
| 72 | + run: | |
| 73 | + python -m pip install --upgrade pip |
| 74 | + pip install -e .[dev] |
| 75 | +
|
| 76 | + - name: Set up Docker Buildx |
| 77 | + uses: docker/setup-buildx-action@v3 |
| 78 | + |
| 79 | + - name: Generate certificates |
| 80 | + run: make certs |
| 81 | + |
| 82 | + - name: Start NiFi infrastructure (single-user) |
| 83 | + run: make up NIPYAPI_PROFILE=single-user |
| 84 | + |
| 85 | + - name: Wait for NiFi to be ready |
| 86 | + run: make wait-ready NIPYAPI_PROFILE=single-user |
| 87 | + |
| 88 | + - name: Run integration tests |
| 89 | + run: NIPYAPI_PROFILE=single-user PYTHONPATH=${{ github.workspace }}:$PYTHONPATH pytest |
| 90 | + |
| 91 | + - name: Stop NiFi infrastructure |
| 92 | + if: always() |
| 93 | + run: make down |
| 94 | + |
| 95 | + test-python-310-single-user: |
| 96 | + runs-on: ubuntu-latest |
| 97 | + |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v4 |
| 100 | + |
| 101 | + - name: Set up Python 3.10 |
| 102 | + uses: actions/setup-python@v4 |
| 103 | + with: |
| 104 | + python-version: "3.10" |
| 105 | + |
| 106 | + - name: Install dependencies |
| 107 | + run: | |
| 108 | + python -m pip install --upgrade pip |
| 109 | + pip install -e .[dev] |
| 110 | +
|
| 111 | + - name: Set up Docker Buildx |
| 112 | + uses: docker/setup-buildx-action@v3 |
| 113 | + |
| 114 | + - name: Generate certificates |
| 115 | + run: make certs |
| 116 | + |
| 117 | + - name: Start NiFi infrastructure (single-user) |
| 118 | + run: make up NIPYAPI_PROFILE=single-user |
| 119 | + |
| 120 | + - name: Wait for NiFi to be ready |
| 121 | + run: make wait-ready NIPYAPI_PROFILE=single-user |
| 122 | + |
| 123 | + - name: Run integration tests |
| 124 | + run: NIPYAPI_PROFILE=single-user PYTHONPATH=${{ github.workspace }}:$PYTHONPATH pytest |
| 125 | + |
| 126 | + - name: Stop NiFi infrastructure |
| 127 | + if: always() |
| 128 | + run: make down |
| 129 | + |
| 130 | + test-python-39-single-user: |
| 131 | + runs-on: ubuntu-latest |
| 132 | + |
| 133 | + steps: |
| 134 | + - uses: actions/checkout@v4 |
| 135 | + |
| 136 | + - name: Set up Python 3.9 |
| 137 | + uses: actions/setup-python@v4 |
| 138 | + with: |
| 139 | + python-version: "3.9" |
| 140 | + |
| 141 | + - name: Install dependencies |
| 142 | + run: | |
| 143 | + python -m pip install --upgrade pip |
| 144 | + pip install -e .[dev] |
| 145 | +
|
| 146 | + - name: Set up Docker Buildx |
| 147 | + uses: docker/setup-buildx-action@v3 |
| 148 | + |
| 149 | + - name: Generate certificates |
| 150 | + run: make certs |
| 151 | + |
| 152 | + - name: Start NiFi infrastructure (single-user) |
| 153 | + run: make up NIPYAPI_PROFILE=single-user |
| 154 | + |
| 155 | + - name: Wait for NiFi to be ready |
| 156 | + run: make wait-ready NIPYAPI_PROFILE=single-user |
| 157 | + |
| 158 | + - name: Run integration tests |
| 159 | + run: NIPYAPI_PROFILE=single-user PYTHONPATH=${{ github.workspace }}:$PYTHONPATH pytest |
| 160 | + |
| 161 | + - name: Stop NiFi infrastructure |
| 162 | + if: always() |
| 163 | + run: make down |
| 164 | + |
| 165 | + test-python-312-secure-ldap: |
| 166 | + runs-on: ubuntu-latest |
| 167 | + |
| 168 | + steps: |
| 169 | + - uses: actions/checkout@v4 |
| 170 | + |
| 171 | + - name: Set up Python 3.12 |
| 172 | + uses: actions/setup-python@v4 |
| 173 | + with: |
| 174 | + python-version: "3.12" |
| 175 | + |
| 176 | + - name: Install dependencies |
| 177 | + run: | |
| 178 | + python -m pip install --upgrade pip |
| 179 | + pip install -e .[dev] |
| 180 | +
|
| 181 | + - name: Set up Docker Buildx |
| 182 | + uses: docker/setup-buildx-action@v3 |
| 183 | + |
| 184 | + - name: Generate certificates |
| 185 | + run: make certs |
| 186 | + |
| 187 | + - name: Start NiFi infrastructure (secure-ldap) |
| 188 | + run: make up NIPYAPI_PROFILE=secure-ldap |
| 189 | + |
| 190 | + - name: Wait for containers to stabilize |
| 191 | + run: sleep 5 && docker ps -a |
| 192 | + |
| 193 | + - name: Debug SSL environment |
| 194 | + run: | |
| 195 | + python -c "import ssl; print('OpenSSL version:', ssl.OPENSSL_VERSION)" |
| 196 | + python -c "import ssl; print('SSL context flags:', ssl.create_default_context().verify_flags)" |
| 197 | +
|
| 198 | + - name: Wait for NiFi to be ready |
| 199 | + run: make wait-ready NIPYAPI_PROFILE=secure-ldap |
| 200 | + |
| 201 | + - name: Run integration tests |
| 202 | + run: NIPYAPI_PROFILE=secure-ldap PYTHONPATH=${{ github.workspace }}:$PYTHONPATH pytest |
| 203 | + |
| 204 | + - name: Dump running containers and logs on failure |
| 205 | + if: failure() |
| 206 | + run: | |
| 207 | + echo "=== Container Status ===" |
| 208 | + docker ps -a |
| 209 | + echo "=== Container Logs ===" |
| 210 | + for container in $(docker ps -aq); do |
| 211 | + echo "--- Logs for container: $container ---" |
| 212 | + docker logs "$container" 2>&1 || echo "Failed to get logs for container $container" |
| 213 | + echo "" |
| 214 | + done |
| 215 | +
|
| 216 | + - name: Stop NiFi infrastructure |
| 217 | + if: always() |
| 218 | + run: make down |
| 219 | + |
| 220 | + test-python-312-secure-mtls: |
| 221 | + runs-on: ubuntu-latest |
| 222 | + # Note: This test can be flakey in local CI environments |
| 223 | + |
| 224 | + steps: |
| 225 | + - uses: actions/checkout@v4 |
| 226 | + |
| 227 | + - name: Set up Python 3.12 |
| 228 | + uses: actions/setup-python@v4 |
| 229 | + with: |
| 230 | + python-version: "3.12" |
| 231 | + |
| 232 | + - name: Install dependencies |
| 233 | + run: | |
| 234 | + python -m pip install --upgrade pip |
| 235 | + pip install -e .[dev] |
| 236 | +
|
| 237 | + - name: Set up Docker Buildx |
| 238 | + uses: docker/setup-buildx-action@v3 |
| 239 | + |
| 240 | + - name: Generate certificates |
| 241 | + run: | |
| 242 | + make certs |
| 243 | + echo "Ensuring certificate files are fully written..." |
| 244 | + sync |
| 245 | +
|
| 246 | + - name: Start NiFi infrastructure (secure-mtls) |
| 247 | + run: make up NIPYAPI_PROFILE=secure-mtls |
| 248 | + |
| 249 | + - name: Wait for NiFi to be ready |
| 250 | + run: make wait-ready NIPYAPI_PROFILE=secure-mtls |
| 251 | + |
| 252 | + - name: Run integration tests |
| 253 | + run: NIPYAPI_PROFILE=secure-mtls PYTHONPATH=${{ github.workspace }}:$PYTHONPATH pytest |
| 254 | + |
| 255 | + - name: Dump running containers and logs on failure |
| 256 | + if: failure() |
| 257 | + run: | |
| 258 | + echo "=== Container Status ===" |
| 259 | + docker ps -a |
| 260 | + echo "=== Container Logs ===" |
| 261 | + for container in $(docker ps -aq); do |
| 262 | + echo "--- Logs for container: $container ---" |
| 263 | + docker logs "$container" 2>&1 || echo "Failed to get logs for container $container" |
| 264 | + echo "" |
| 265 | + done |
| 266 | +
|
| 267 | + - name: Stop NiFi infrastructure |
| 268 | + if: always() |
| 269 | + run: make down |
0 commit comments