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