@@ -116,6 +116,9 @@ jobs:
116116
117117
118118 unit-tests :
119+ env :
120+ # workaround for Rich table column width
121+ COLUMNS : 140
119122 strategy :
120123 matrix :
121124 python-version :
@@ -148,8 +151,6 @@ jobs:
148151 run : " poetry install --all-extras"
149152 - name : " Mypy Tests"
150153 run : " poetry run mypy --show-error-codes infrahub_sdk/"
151- # - name: "Pylint Tests"
152- # run: "poetry run pylint infrahub_sdk/"
153154 - name : " Unit Tests"
154155 run : " poetry run pytest --cov infrahub_sdk tests/unit/"
155156 - name : " Upload coverage to Codecov"
@@ -173,7 +174,7 @@ jobs:
173174 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
174175
175176 # ------------------------------------------ Integration Tests ------------------------------------------
176- integration-tests :
177+ integration-tests-latest-infrahub :
177178 if : |
178179 always() && !cancelled() &&
179180 !contains(needs.*.result, 'failure') &&
@@ -201,8 +202,87 @@ jobs:
201202 pip install invoke toml codecov
202203 - name : " Install Package"
203204 run : " poetry install --all-extras"
205+ - name : " Set environment variables for python_testcontainers"
206+ run : |
207+ echo INFRAHUB_TESTING_IMAGE_VER=latest >> $GITHUB_ENV
204208 - name : " Integration Tests"
205- run : " poetry run pytest --cov infrahub_sdk tests/integration/"
209+ run : |
210+ poetry run pytest --cov infrahub_sdk tests/integration/
211+ - name : " Upload coverage to Codecov"
212+ run : |
213+ codecov --flags integration-tests
214+ env :
215+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
216+
217+ integration-tests-local-infrahub :
218+ if : |
219+ always() && !cancelled() &&
220+ !contains(needs.*.result, 'failure') &&
221+ !contains(needs.*.result, 'cancelled') &&
222+ needs.files-changed.outputs.python == 'true' &&
223+ (github.base_ref == 'stable' || github.base_ref == 'develop')
224+ needs : ["files-changed", "yaml-lint", "python-lint"]
225+ runs-on :
226+ group : " huge-runners"
227+ timeout-minutes : 30
228+ steps :
229+ - name : " Check out repository code"
230+ uses : " actions/checkout@v4"
231+
232+ - name : " Extract target branch name"
233+ id : extract_branch
234+ run : echo "TARGET_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV
235+
236+ - name : " Checkout infrahub repository"
237+ uses : " actions/checkout@v4"
238+ with :
239+ repository : " opsmill/infrahub"
240+ path : " infrahub-server"
241+ ref : ${{ github.base_ref }}
242+ submodules : true
243+
244+ - name : Set up Python
245+ uses : actions/setup-python@v5
246+ with :
247+ python-version : " 3.12"
248+
249+ - name : " Setup git credentials prior dev.build"
250+ run : |
251+ cd infrahub-server
252+ git config --global user.name 'Infrahub'
253+ git config --global user.email '[email protected] ' 254+ git config --global --add safe.directory '*'
255+ git config --global credential.usehttppath true
256+ git config --global credential.helper /usr/local/bin/infrahub-git-credential
257+
258+ - name : " Set environment variables prior dev.build"
259+ run : |
260+ echo "INFRAHUB_BUILD_NAME=infrahub-${{ runner.name }}" >> $GITHUB_ENV
261+ RUNNER_NAME=$(echo "${{ runner.name }}" | grep -o 'ghrunner[0-9]\+' | sed 's/ghrunner\([0-9]\+\)/ghrunner_\1/')
262+ echo "PYTEST_DEBUG_TEMPROOT=/var/lib/github/${RUNNER_NAME}/_temp" >> $GITHUB_ENV
263+ echo "INFRAHUB_IMAGE_VER=local-${{ runner.name }}-${{ github.sha }}" >> $GITHUB_ENV
264+ echo "INFRAHUB_TESTING_IMAGE_VER=local-${{ runner.name }}-${{ github.sha }}" >> $GITHUB_ENV
265+ echo "INFRAHUB_TESTING_DOCKER_IMAGE=opsmill/infrahub" >> $GITHUB_ENV
266+
267+ - name : " Build container"
268+ run : |
269+ cd infrahub-server
270+ inv dev.build
271+
272+ - name : " Setup environment"
273+ run : |
274+ pipx install poetry==1.8.5
275+ poetry config virtualenvs.create true --local
276+ pip install invoke toml codecov
277+
278+ - name : " Install Package"
279+ run : " poetry install --all-extras"
280+
281+ - name : " Integration Tests"
282+ run : |
283+ echo "Running tests for version: $INFRAHUB_TESTING_IMAGE_VER"
284+ poetry run pytest --cov infrahub_sdk tests/integration/
285+
206286 - name : " Upload coverage to Codecov"
207287 run : |
208288 codecov --flags integration-tests
0 commit comments