-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run CI tests against multiple versions #246
Merged
+111
−16
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,7 +173,7 @@ jobs: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
# ------------------------------------------ Integration Tests ------------------------------------------ | ||
integration-tests: | ||
integration-tests-latest-infrahub: | ||
if: | | ||
always() && !cancelled() && | ||
!contains(needs.*.result, 'failure') && | ||
|
@@ -201,8 +201,87 @@ jobs: | |
pip install invoke toml codecov | ||
- name: "Install Package" | ||
run: "poetry install --all-extras" | ||
- name: "Set environment variables for python_testcontainers" | ||
run: | | ||
echo INFRAHUB_TESTING_IMAGE_VER=latest >> $GITHUB_ENV | ||
- name: "Integration Tests" | ||
run: "poetry run pytest --cov infrahub_sdk tests/integration/" | ||
run: | | ||
poetry run pytest --cov infrahub_sdk tests/integration/ | ||
- name: "Upload coverage to Codecov" | ||
run: | | ||
codecov --flags integration-tests | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
integration-tests-local-infrahub: | ||
if: | | ||
always() && !cancelled() && | ||
!contains(needs.*.result, 'failure') && | ||
!contains(needs.*.result, 'cancelled') && | ||
needs.files-changed.outputs.python == 'true' && | ||
(github.base_ref == 'stable' || github.base_ref == 'develop') | ||
needs: ["files-changed", "yaml-lint", "python-lint"] | ||
runs-on: | ||
group: "huge-runners" | ||
timeout-minutes: 30 | ||
steps: | ||
- name: "Check out repository code" | ||
uses: "actions/checkout@v4" | ||
|
||
- name: "Extract target branch name" | ||
id: extract_branch | ||
run: echo "TARGET_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV | ||
|
||
- name: "Checkout infrahub repository" | ||
uses: "actions/checkout@v4" | ||
with: | ||
repository: "opsmill/infrahub" | ||
path: "infrahub-server" | ||
ref: ${{ github.base_ref }} | ||
submodules: true | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: "Setup git credentials prior dev.build" | ||
run: | | ||
cd infrahub-server | ||
git config --global user.name 'Infrahub' | ||
git config --global user.email '[email protected]' | ||
git config --global --add safe.directory '*' | ||
git config --global credential.usehttppath true | ||
git config --global credential.helper /usr/local/bin/infrahub-git-credential | ||
- name: "Set environment variables prior dev.build" | ||
run: | | ||
echo "INFRAHUB_BUILD_NAME=infrahub-${{ runner.name }}" >> $GITHUB_ENV | ||
RUNNER_NAME=$(echo "${{ runner.name }}" | grep -o 'ghrunner[0-9]\+' | sed 's/ghrunner\([0-9]\+\)/ghrunner_\1/') | ||
echo "PYTEST_DEBUG_TEMPROOT=/var/lib/github/${RUNNER_NAME}/_temp" >> $GITHUB_ENV | ||
echo "INFRAHUB_IMAGE_VER=local-${{ runner.name }}-${{ github.sha }}" >> $GITHUB_ENV | ||
echo "INFRAHUB_TESTING_IMAGE_VER=local-${{ runner.name }}-${{ github.sha }}" >> $GITHUB_ENV | ||
echo "INFRAHUB_TESTING_DOCKER_IMAGE=opsmill/infrahub" >> $GITHUB_ENV | ||
- name: "Build container" | ||
run: | | ||
cd infrahub-server | ||
inv dev.build | ||
- name: "Setup environment" | ||
run: | | ||
pipx install poetry==1.8.5 | ||
poetry config virtualenvs.create true --local | ||
pip install invoke toml codecov | ||
- name: "Install Package" | ||
run: "poetry install --all-extras" | ||
|
||
- name: "Integration Tests" | ||
run: | | ||
echo "Running tests for version: $INFRAHUB_TESTING_IMAGE_VER" | ||
poetry run pytest --cov infrahub_sdk tests/integration/ | ||
- name: "Upload coverage to Codecov" | ||
run: | | ||
codecov --flags integration-tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is it that this skip_version function gets used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever a SDK test should be running prior/since a given infrahub version. We do not have such tests for now, but should have some in the future