@@ -176,7 +176,7 @@ jobs:
176176 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
177177
178178 # ------------------------------------------ Integration Tests ------------------------------------------
179- integration-tests :
179+ integration-tests-latest-infrahub :
180180 if : |
181181 always() && !cancelled() &&
182182 !contains(needs.*.result, 'failure') &&
@@ -204,8 +204,87 @@ jobs:
204204 pip install invoke toml codecov
205205 - name : " Install Package"
206206 run : " poetry install --all-extras"
207+ - name : " Set environment variables for python_testcontainers"
208+ run : |
209+ echo INFRAHUB_TESTING_IMAGE_VER=latest >> $GITHUB_ENV
207210 - name : " Integration Tests"
208- run : " poetry run pytest --cov infrahub_sdk tests/integration/"
211+ run : |
212+ poetry run pytest --cov infrahub_sdk tests/integration/
213+ - name : " Upload coverage to Codecov"
214+ run : |
215+ codecov --flags integration-tests
216+ env :
217+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
218+
219+ integration-tests-local-infrahub :
220+ if : |
221+ always() && !cancelled() &&
222+ !contains(needs.*.result, 'failure') &&
223+ !contains(needs.*.result, 'cancelled') &&
224+ needs.files-changed.outputs.python == 'true' &&
225+ (github.base_ref == 'stable' || github.base_ref == 'develop')
226+ needs : ["files-changed", "yaml-lint", "python-lint"]
227+ runs-on :
228+ group : " huge-runners"
229+ timeout-minutes : 30
230+ steps :
231+ - name : " Check out repository code"
232+ uses : " actions/checkout@v4"
233+
234+ - name : " Extract target branch name"
235+ id : extract_branch
236+ run : echo "TARGET_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV
237+
238+ - name : " Checkout infrahub repository"
239+ uses : " actions/checkout@v4"
240+ with :
241+ repository : " opsmill/infrahub"
242+ path : " infrahub-server"
243+ ref : ${{ github.base_ref }}
244+ submodules : true
245+
246+ - name : Set up Python
247+ uses : actions/setup-python@v5
248+ with :
249+ python-version : " 3.12"
250+
251+ - name : " Setup git credentials prior dev.build"
252+ run : |
253+ cd infrahub-server
254+ git config --global user.name 'Infrahub'
255+ git config --global user.email '[email protected] ' 256+ git config --global --add safe.directory '*'
257+ git config --global credential.usehttppath true
258+ git config --global credential.helper /usr/local/bin/infrahub-git-credential
259+
260+ - name : " Set environment variables prior dev.build"
261+ run : |
262+ echo "INFRAHUB_BUILD_NAME=infrahub-${{ runner.name }}" >> $GITHUB_ENV
263+ RUNNER_NAME=$(echo "${{ runner.name }}" | grep -o 'ghrunner[0-9]\+' | sed 's/ghrunner\([0-9]\+\)/ghrunner_\1/')
264+ echo "PYTEST_DEBUG_TEMPROOT=/var/lib/github/${RUNNER_NAME}/_temp" >> $GITHUB_ENV
265+ echo "INFRAHUB_IMAGE_VER=local-${{ runner.name }}-${{ github.sha }}" >> $GITHUB_ENV
266+ echo "INFRAHUB_TESTING_IMAGE_VER=local-${{ runner.name }}-${{ github.sha }}" >> $GITHUB_ENV
267+ echo "INFRAHUB_TESTING_DOCKER_IMAGE=opsmill/infrahub" >> $GITHUB_ENV
268+
269+ - name : " Build container"
270+ run : |
271+ cd infrahub-server
272+ inv dev.build
273+
274+ - name : " Setup environment"
275+ run : |
276+ pipx install poetry==1.8.5
277+ poetry config virtualenvs.create true --local
278+ pip install invoke toml codecov
279+
280+ - name : " Install Package"
281+ run : " poetry install --all-extras"
282+
283+ - name : " Integration Tests"
284+ run : |
285+ echo "Running tests for version: $INFRAHUB_TESTING_IMAGE_VER"
286+ poetry run pytest --cov infrahub_sdk tests/integration/
287+
209288 - name : " Upload coverage to Codecov"
210289 run : |
211290 codecov --flags integration-tests
0 commit comments