Skip to content

Merge pull request #43 from opsmill/ps-fix-create-dc-generator #235

Merge pull request #43 from opsmill/ps-fix-create-dc-generator

Merge pull request #43 from opsmill/ps-fix-create-dc-generator #235

Workflow file for this run

---
name: CI
# yamllint disable rule:truthy rule:line-length
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
files-changed:
name: Detect which file has changed
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
documentation: ${{ steps.changes.outputs.documentation_all }}
python: ${{ steps.changes.outputs.python_all }}
yaml: ${{ steps.changes.outputs.yaml_all }}
markdown: ${{ steps.changes.outputs.markdown_all }}
steps:
- name: "Check out repository code"
uses: "actions/checkout@v5"
- name: Check for file changes
uses: opsmill/[email protected]
id: changes
with:
token: ${{ github.token }}
filters: .github/file-filters.yml
python-lint:
if: needs.files-changed.outputs.python == 'true'
needs: ["files-changed"]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.18"
- run: uv sync
- name: Check code formatting
run: |
uv run ruff format --check --diff
uv run ruff check --select I .
- name: Run linters
run: uv run ruff check
- name: Run type checks
run: uv run mypy .
yaml-lint:
if: needs.files-changed.outputs.yaml == 'true'
needs: ["files-changed"]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.18"
- run: uv sync
- name: Run yamllint
run: |
uv run yamllint -d "{extends: default, ignore: [.github/, .venv/ , .dev/ ]}" \
-d "{rules: {truthy: {allowed-values: ['true', 'false', 'yes', 'no', 'on', 'off', 'True', 'False']}}}" .
markdown-lint:
if: needs.files-changed.outputs.markdown == 'true'
needs: ["files-changed"]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 20
- name: Install markdownlint-cli
run: npm install -g markdownlint-cli
- name: Run markdownlint
run: markdownlint "**/*.{md,mdx}"
integration-test:
if: |
always() && !cancelled() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
needs: ["python-lint", "yaml-lint", "markdown-lint"]
runs-on:
group: "huge-runners"
timeout-minutes: 60
env:
INFRAHUB_DB_TYPE: neo4j
INFRAHUB_API_TOKEN: '06438eb2-8019-4776-878c-0941b1f1d1ec'
INFRAHUB_TIMEOUT: 600
INFRAHUB_TESTING_LOG_LEVEL: INFO
steps:
- uses: actions/checkout@v5
- name: Install tini
run: "apt-get update && apt-get install -y tini"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.18"
- run: uv sync
- name: Set environment variables
run: |
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
- name: Run tests
run: exec tini -s -g -- uv run pytest tests/
documentation:
defaults:
run:
working-directory: ./docs
if: |
always() && !cancelled() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
needs.files-changed.outputs.documentation == 'true'
needs: ["files-changed", "yaml-lint", "python-lint", "markdown-lint"]
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v5
with:
submodules: true
- uses: actions/setup-node@v6
with:
node-version: 20
cache: 'npm'
cache-dependency-path: docs/package-lock.json
- name: Install Node dependencies
working-directory: docs
run: npm install
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.18"
- run: uv sync
working-directory: ./
- name: Build docs website
run: uv run invoke docs
validate-documentation-style:
if: |
always() && !cancelled() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
needs: ["files-changed", "yaml-lint", "python-lint", "markdown-lint"]
runs-on: "ubuntu-22.04"
timeout-minutes: 5
env:
VALE_VERSION: "3.13.0"
steps:
- uses: "actions/checkout@v5"
with:
submodules: true
# The official GitHub Action for Vale doesn't work, installing manually instead:
# https://github.com/errata-ai/vale-action/issues/103
- name: Download Vale
run: |
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
tar -xzf vale.tar.gz
- name: "Validate documentation style"
run: ./vale $(find ./docs/docs -type f \( -name "*.mdx" -o -name "*.md" \) )