Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 50 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
timeout-minutes: 5
outputs:
documentation: ${{ steps.changes.outputs.documentation_all }}
markdown: ${{ steps.changes.outputs.markdown_all }}
python: ${{ steps.changes.outputs.python_all }}
yaml: ${{ steps.changes.outputs.yaml_all }}
steps:
Expand All @@ -38,41 +39,28 @@ jobs:
if: needs.files-changed.outputs.python == 'true'
needs: ["files-changed"]
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version:
- "3.12"
poetry-version:
- "1.8.5"
timeout-minutes: 5
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Set up Python ${{ matrix.python-version }}"
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: ${{ matrix.python-version }}
- name: "Install Poetry ${{ matrix.poetry-version }}"
uses: "snok/install-poetry@v1"
python-version: "3.12"
- name: "Install uv"
uses: "astral-sh/setup-uv@v5"
with:
version: ${{ matrix.poetry-version }}
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: "Setup Python environment"
run: |
poetry config virtualenvs.create true --local
poetry env use ${{ matrix.python-version }}
version: "0.9.18"
- name: "Install dependencies"
run: "poetry install --no-interaction --no-ansi --with dev"
run: "uv sync --group dev"
- name: "Linting: ruff check"
run: "poetry run ruff check ."
run: "uv run ruff check ."
- name: "Linting: ruff format"
run: "poetry run ruff format --check --diff ."
run: "uv run ruff format --check --diff ."
- name: "Mypy Tests"
run: "poetry run mypy --show-error-codes ."
run: "uv run mypy --show-error-codes ."
- name: "Pylint Tests"
run: "poetry run pylint --ignore .venv ."
run: "uv run pylint --ignore .venv ."

yaml-lint:
name: Run yaml lint
Expand All @@ -88,6 +76,24 @@ jobs:
- name: "Linting: yamllint"
run: "yamllint -s ."

markdown-lint:
name: Run markdown lint
if: needs.files-changed.outputs.markdown == 'true'
needs: ["files-changed"]
runs-on: "ubuntu-latest"
timeout-minutes: 5
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Setup Node.js"
uses: "actions/setup-node@v4"
with:
node-version: "20"
- name: "Install markdownlint-cli"
run: "npm install -g markdownlint-cli"
- name: "Linting: markdownlint"
run: "markdownlint '**/*.md' '**/*.mdx'"

schema-test:
name: Test all schema files
needs:
Expand All @@ -111,25 +117,29 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Invoke
run: poetry install --no-interaction --no-ansi --with dev
- name: "Install uv"
uses: "astral-sh/setup-uv@v5"
with:
version: "0.9.18"
- name: Install dependencies
run: uv sync --group dev
- name: Set job name
run: echo JOB_NAME="$GITHUB_JOB" >> $GITHUB_ENV
- name: "Set environment variable INFRAHUB_BUILD_NAME"
run: echo INFRAHUB_BUILD_NAME=infrahub-${{ runner.name }} >> $GITHUB_ENV
- name: Initialize Infrahub
run: poetry run invoke start
run: uv run invoke start
- name: Set infrahub address
run: |
PORT=$(docker compose -p $INFRAHUB_BUILD_NAME port infrahub-server 8000 | cut -d: -f2)
echo "INFRAHUB_ADDRESS=http://localhost:${PORT}" >> $GITHUB_ENV
- name: "Store start time"
run: echo TEST_START_TIME=$(date +%s)000 >> $GITHUB_ENV
- name: Load all schemas files
run: poetry run invoke schemas.load-all-schemas
run: uv run invoke schemas.load-all-schemas
- name: "Clear docker environment and force vmagent to stop"
if: always()
run: poetry run invoke destroy
run: uv run invoke destroy

documentation:
defaults:
Expand All @@ -154,15 +164,22 @@ jobs:
node-version: 20
cache: 'npm'
cache-dependency-path: docs/package-lock.json
- name: "Setup Python environment"
run: "pip install invoke toml"
- name: "Install uv"
uses: "astral-sh/setup-uv@v5"
with:
version: "0.9.18"
- name: "Install Python dependencies"
run: "uv sync"
working-directory: ./
- name: "Install dependencies"
run: "invoke docs.install"
run: "uv run invoke docs.install"
working-directory: ./
- name: "Generate reference documentation"
run: "invoke docs.generate"
run: "uv run invoke docs.generate"
working-directory: ./
- name: "Build docs website"
run: "invoke docs.build"
run: "uv run invoke docs.build"
working-directory: ./

validate-documentation-style:
if: |
Expand Down
1 change: 1 addition & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ MD034: false # no-bare-urls
MD045: false # no alt text around images
MD047: false # single trailing newline
MD014: false # dollar signs used before commands
MD060: false # table column style - disabled for generated tables
2 changes: 2 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docs/node_modules/
.venv/
Loading