2424 INFRAHUB_IMAGE_VER : " local"
2525 PYTEST_XDIST_WORKER_COUNT : 4
2626 INFRAHUB_TEST_IN_DOCKER : 1
27- VALE_VERSION : " 3.0.7 "
27+ VALE_VERSION : " 3.7.1 "
2828 GITHUB_PR_NUMBER : ${{ github.event.pull_request.number }}
2929 METRICS_ENDPOINT : ${{ secrets.METRICS_ENDPOINT }}
3030
3636 timeout-minutes : 5
3737 outputs :
3838 documentation : ${{ steps.changes.outputs.documentation_all }}
39+ documentation_generated : ${{ steps.changes.outputs.documentation_generated_all }}
3940 helm : ${{ steps.changes.outputs.helm_all }}
4041 python : ${{ steps.changes.outputs.python_all }}
4142 yaml : ${{ steps.changes.outputs.yaml_all }}
7576 - name : " Check out repository code"
7677 uses : " actions/checkout@v4"
7778 - name : " Setup environment"
78- run : " pip install ruff==0.8.6 "
79+ run : " pip install ruff==0.11.0 "
7980 - name : " Linting: ruff check"
8081 run : " ruff check ."
8182 - name : " Linting: ruff format"
@@ -115,6 +116,91 @@ jobs:
115116 SHELLCHECK_OPTS : --exclude=SC2086 --exclude=SC2046 --exclude=SC2004 --exclude=SC2129
116117
117118
119+ documentation :
120+ defaults :
121+ run :
122+ working-directory : ./docs
123+ if : |
124+ always() && !cancelled() &&
125+ !contains(needs.*.result, 'failure') &&
126+ !contains(needs.*.result, 'cancelled') &&
127+ needs.files-changed.outputs.documentation == 'true'
128+ needs : ["files-changed", "yaml-lint", "python-lint"]
129+ runs-on : " ubuntu-22.04"
130+ timeout-minutes : 5
131+ steps :
132+ - name : " Check out repository code"
133+ uses : " actions/checkout@v4"
134+ with :
135+ submodules : true
136+ - name : Install NodeJS
137+ uses : actions/setup-node@v4
138+ with :
139+ node-version : 20
140+ cache : ' npm'
141+ cache-dependency-path : docs/package-lock.json
142+ - name : " Install dependencies"
143+ run : npm install
144+ - name : " Setup Python environment"
145+ run : " pip install invoke toml"
146+ - name : " Build docs website"
147+ run : " invoke docs"
148+
149+ validate-generated-documentation :
150+ if : |
151+ always() && !cancelled() &&
152+ !contains(needs.*.result, 'failure') &&
153+ !contains(needs.*.result, 'cancelled') &&
154+ (needs.files-changed.outputs.python == 'true') || (needs.files-changed.outputs.documentation_generated == 'true')
155+ needs : ["files-changed", "yaml-lint", "python-lint"]
156+ runs-on : " ubuntu-22.04"
157+ timeout-minutes : 5
158+ steps :
159+ - name : " Check out repository code"
160+ uses : " actions/checkout@v4"
161+ with :
162+ submodules : true
163+ - name : Set up Python
164+ uses : actions/setup-python@v5
165+ with :
166+ python-version : " 3.12"
167+ - name : " Setup Python environment"
168+ run : |
169+ pipx install poetry==2.1
170+ poetry config virtualenvs.create true --local
171+ poetry env use 3.12
172+ - name : " Install dependencies"
173+ run : " poetry install --no-interaction --no-ansi --extras ctl"
174+ - name : " Setup environment"
175+ run : " pip install invoke toml"
176+ - name : " Validate generated documentation"
177+ run : " poetry run invoke docs-validate"
178+
179+ validate-documentation-style :
180+ if : |
181+ always() && !cancelled() &&
182+ !contains(needs.*.result, 'failure') &&
183+ !contains(needs.*.result, 'cancelled')
184+ needs : ["files-changed", "yaml-lint", "python-lint"]
185+ runs-on : " ubuntu-22.04"
186+ timeout-minutes : 5
187+ steps :
188+ - name : " Check out repository code"
189+ uses : " actions/checkout@v4"
190+ with :
191+ submodules : true
192+
193+ # The official GitHub Action for Vale doesn't work, installing manually instead:
194+ # https://github.com/errata-ai/vale-action/issues/103
195+ - name : Download Vale
196+ run : |
197+ curl -sL "https://github.com/errata-ai/vale/releases/download/v${VALE_VERSION}/vale_${VALE_VERSION}_Linux_64-bit.tar.gz" -o vale.tar.gz
198+ tar -xzf vale.tar.gz
199+ env :
200+ VALE_VERSION : ${{ env.VALE_VERSION }}
201+ - name : " Validate documentation style"
202+ run : ./vale $(find ./docs -type f \( -name "*.mdx" -o -name "*.md" \) )
203+
118204 unit-tests :
119205 env :
120206 # workaround for Rich table column width
@@ -144,7 +230,7 @@ jobs:
144230 python-version : ${{ matrix.python-version }}
145231 - name : " Setup environment"
146232 run : |
147- pipx install poetry==1.8.5
233+ pipx install poetry==2.1 --python python${{ matrix.python-version }}
148234 poetry config virtualenvs.create true --local
149235 pip install invoke toml codecov
150236 - name : " Install Package"
@@ -174,7 +260,7 @@ jobs:
174260 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
175261
176262 # ------------------------------------------ Integration Tests ------------------------------------------
177- integration-tests :
263+ integration-tests-latest-infrahub :
178264 if : |
179265 always() && !cancelled() &&
180266 !contains(needs.*.result, 'failure') &&
@@ -197,15 +283,93 @@ jobs:
197283 echo "PYTEST_DEBUG_TEMPROOT=/var/lib/github/${RUNNER_NAME}/_temp" >> $GITHUB_ENV
198284 - name : " Setup environment"
199285 run : |
200- pipx install poetry==1.8.5
286+ pipx install poetry==2.1
201287 poetry config virtualenvs.create true --local
202288 pip install invoke toml codecov
203289 - name : " Install Package"
204290 run : " poetry install --all-extras"
205291 - name : " Integration Tests"
206- run : " poetry run pytest --cov infrahub_sdk tests/integration/"
292+ run : |
293+ poetry run pytest --cov infrahub_sdk tests/integration/
207294 - name : " Upload coverage to Codecov"
208295 run : |
209296 codecov --flags integration-tests
210297 env :
211298 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
299+
300+ # NOTE: Disabling this test for now because it's expected that we can't start the latest version of infrahub
301+ # with the current shipping version of infrahub-testcontainers
302+ # integration-tests-local-infrahub:
303+ # if: |
304+ # always() && !cancelled() &&
305+ # !contains(needs.*.result, 'failure') &&
306+ # !contains(needs.*.result, 'cancelled') &&
307+ # needs.files-changed.outputs.python == 'true' &&
308+ # (github.base_ref == 'stable' || github.base_ref == 'develop')
309+ # needs: ["files-changed", "yaml-lint", "python-lint"]
310+ # runs-on:
311+ # group: "huge-runners"
312+ # timeout-minutes: 30
313+ # steps:
314+ # - name: "Check out repository code"
315+ # uses: "actions/checkout@v4"
316+
317+ # - name: "Extract target branch name"
318+ # id: extract_branch
319+ # run: echo "TARGET_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV
320+
321+ # - name: "Checkout infrahub repository"
322+ # uses: "actions/checkout@v4"
323+ # with:
324+ # repository: "opsmill/infrahub"
325+ # path: "infrahub-server"
326+ # ref: ${{ github.base_ref }}
327+ # submodules: true
328+
329+ # - name: Set up Python
330+ # uses: actions/setup-python@v5
331+ # with:
332+ # python-version: "3.12"
333+
334+ # - name: "Setup git credentials prior dev.build"
335+ # run: |
336+ # cd infrahub-server
337+ # git config --global user.name 'Infrahub'
338+ # git config --global user.email '[email protected] ' 339+ # git config --global --add safe.directory '*'
340+ # git config --global credential.usehttppath true
341+ # git config --global credential.helper /usr/local/bin/infrahub-git-credential
342+
343+ # - name: "Set environment variables prior dev.build"
344+ # run: |
345+ # echo "INFRAHUB_BUILD_NAME=infrahub-${{ runner.name }}" >> $GITHUB_ENV
346+ # RUNNER_NAME=$(echo "${{ runner.name }}" | grep -o 'ghrunner[0-9]\+' | sed 's/ghrunner\([0-9]\+\)/ghrunner_\1/')
347+ # echo "PYTEST_DEBUG_TEMPROOT=/var/lib/github/${RUNNER_NAME}/_temp" >> $GITHUB_ENV
348+ # echo "INFRAHUB_IMAGE_VER=local-${{ runner.name }}-${{ github.sha }}" >> $GITHUB_ENV
349+ # echo "INFRAHUB_TESTING_IMAGE_VER=local-${{ runner.name }}-${{ github.sha }}" >> $GITHUB_ENV
350+ # echo "INFRAHUB_TESTING_DOCKER_IMAGE=opsmill/infrahub" >> $GITHUB_ENV
351+
352+ # - name: "Build container"
353+ # run: |
354+ # cd infrahub-server
355+ # inv dev.build
356+
357+ # - name: "Setup environment"
358+ # run: |
359+ # pipx install poetry==2.1
360+ # poetry config virtualenvs.create true --local
361+ # pip install invoke toml codecov
362+
363+ # - name: "Install Package"
364+ # run: "poetry install --all-extras"
365+
366+ # - name: "Integration Tests"
367+ # run: |
368+ # echo "Running tests for version: $INFRAHUB_TESTING_IMAGE_VER"
369+ # poetry run pytest --cov infrahub_sdk tests/integration/
370+
371+ # - name: "Upload coverage to Codecov"
372+ # run: |
373+ # codecov --flags integration-tests
374+ # env:
375+ # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
0 commit comments