Migrate TriggerGeneratorDefinitionRun to prefect #11156
Workflow file for this run
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
--- | |
# yamllint disable rule:truthy rule:truthy rule:line-length | |
name: "CI" | |
on: | |
pull_request: | |
push: | |
branches: | |
- develop | |
- stable | |
- release-* | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
INFRAHUB_DB_USERNAME: neo4j | |
INFRAHUB_DB_PASSWORD: admin | |
INFRAHUB_DB_PROTOCOL: bolt | |
INFRAHUB_LOG_LEVEL: CRITICAL | |
INFRAHUB_IMAGE_NAME: "opsmill/infrahub" | |
INFRAHUB_IMAGE_VER: "local" | |
INFRAHUB_SERVER_PORT: 0 | |
INFRAHUB_DB_BACKUP_PORT: 0 | |
VMAGENT_PORT: 0 | |
PYTEST_XDIST_WORKER_COUNT: 4 | |
INFRAHUB_USE_TEST_CONTAINERS: 1 | |
VALE_VERSION: "3.7.1" | |
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }} | |
METRICS_ENDPOINT: ${{ secrets.METRICS_ENDPOINT }} | |
jobs: | |
# ------------------------------------------ Check Files Changes ------------------------------------------ | |
files-changed: | |
name: Detect which file has changed | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
outputs: | |
backend: ${{ steps.changes.outputs.backend_all }} | |
documentation: ${{ steps.changes.outputs.documentation_all }} | |
frontend: ${{ steps.changes.outputs.frontend_all }} | |
helm: ${{ steps.changes.outputs.helm_all }} | |
e2e: ${{ steps.changes.outputs.e2e_all }} | |
python: ${{ steps.changes.outputs.python_all }} | |
javascript: ${{ steps.changes.outputs.javascript_all }} | |
yaml: ${{ steps.changes.outputs.yaml_all }} | |
infrahub_poetry_files: ${{ steps.changes.outputs.infrahub_poetry_files }} | |
github_workflows: ${{ steps.changes.outputs.github_workflows }} | |
e2e_tests: ${{ steps.changes.outputs.e2e_test_files }} | |
steps: | |
- name: "Check out repository code" | |
uses: "actions/checkout@v4" | |
with: | |
submodules: true | |
- name: Check for file changes | |
uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
token: ${{ github.token }} | |
filters: .github/file-filters.yml | |
# ------------------------------------------ All Linter ------------------------------------------ | |
helm-lint: | |
if: needs.files-changed.outputs.helm == 'true' | |
needs: ["files-changed"] | |
runs-on: "ubuntu-latest" | |
timeout-minutes: 5 | |
steps: | |
- name: "Check out repository code" | |
uses: "actions/checkout@v4" | |
with: | |
submodules: true | |
- name: "Install Helm" | |
uses: azure/[email protected] | |
- name: "Linting: helm lint" | |
run: "helm lint helm/" | |
yaml-lint: | |
if: needs.files-changed.outputs.yaml == 'true' | |
needs: ["files-changed"] | |
runs-on: "ubuntu-latest" | |
timeout-minutes: 5 | |
steps: | |
- name: "Check out repository code" | |
uses: "actions/checkout@v4" | |
with: | |
submodules: true | |
- name: "Setup environment" | |
run: "pip install yamllint==1.35.1" | |
- name: "Linting: yamllint" | |
run: "yamllint -s ." | |
javascript-lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: "Check out repository code" | |
uses: "actions/checkout@v4" | |
with: | |
submodules: true | |
- name: Setup Biome | |
uses: biomejs/setup-biome@v2 | |
with: | |
version: 1.9.3 | |
- name: Run Biome | |
working-directory: ./frontend/app | |
run: biome ci . | |
python-lint: | |
if: needs.files-changed.outputs.python == 'true' | |
needs: ["files-changed"] | |
runs-on: "ubuntu-latest" | |
timeout-minutes: 5 | |
steps: | |
- name: "Check out repository code" | |
uses: "actions/checkout@v4" | |
with: | |
submodules: true | |
- name: "Setup environment" | |
run: "pip install ruff==0.7.1" | |
- name: "Linting: ruff check" | |
run: "ruff check . --exclude python_sdk" | |
- name: "Linting: ruff format" | |
run: "ruff format --check --diff --exclude python_sdk ." | |
markdown-lint: | |
if: needs.files-changed.outputs.documentation == 'true' | |
needs: ["files-changed"] | |
runs-on: "ubuntu-latest" | |
timeout-minutes: 5 | |
steps: | |
- name: "Check out repository code" | |
uses: "actions/checkout@v4" | |
with: | |
submodules: true | |
- name: "Linting: markdownlint" | |
uses: DavidAnson/markdownlint-cli2-action@v17 | |
with: | |
config: .markdownlint.yaml | |
globs: | | |
**/*.{md,mdx} | |
!changelog/*.md | |
action-lint: | |
if: needs.files-changed.outputs.github_workflows == 'true' | |
needs: ["files-changed"] | |
runs-on: "ubuntu-latest" | |
timeout-minutes: 5 | |
steps: | |
- name: "Check out repository code" | |
uses: "actions/checkout@v4" | |
with: | |
submodules: true | |
- name: Check workflow files | |
run: | | |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) | |
./actionlint -color | |
shell: bash | |
env: | |
SHELLCHECK_OPTS: --exclude=SC2086 --exclude=SC2046 --exclude=SC2004 | |
infrahub-poetry-check: | |
if: | | |
needs.files-changed.outputs.infrahub_poetry_files == 'true' || | |
github.ref_name == 'stable' || | |
github.ref_name == 'develop' | |
needs: | |
- "files-changed" | |
uses: "./.github/workflows/poetry-check.yml" | |
with: | |
directory: "./" | |
# TODO NEED TO REVISIT THIS ONE | |
# python-sdk-poetry-check: | |
# if: | | |
# needs.files-changed.outputs.python_sdk_poetry_files == 'true' || | |
# github.ref_name == 'stable' || | |
# github.ref_name == 'develop' | |
# needs: | |
# - "files-changed" | |
# uses: "./.github/workflows/poetry-check.yml" | |
# with: | |
# directory: "./python-sdk/" | |
# TODO NEED TO REVISIT THIS ONE | |
# python-sdk-integration-tests: | |
# if: | | |
# always() && !cancelled() && | |
# !contains(needs.*.result, 'failure') && | |
# !contains(needs.*.result, 'cancelled') | |
# needs: ["python-sdk-unit-tests"] | |
# runs-on: | |
# group: huge-runners | |
# timeout-minutes: 30 | |
# env: | |
# INFRAHUB_DB_TYPE: memgraph | |
# steps: | |
# - name: "Check out repository code" | |
# uses: "actions/checkout@v4" | |
# with: | |
# submodules: true | |
# - name: "Install Invoke" | |
# run: "pip install toml invoke" | |
# - name: "Set environment variables" | |
# run: echo INFRAHUB_BUILD_NAME=infrahub-${{ runner.name }} >> $GITHUB_ENV | |
# - name: "Set environment variables" | |
# run: echo INFRAHUB_IMAGE_VER=local-${{ runner.name }}-${{ github.sha }} >> $GITHUB_ENV | |
# - name: "Clear docker environment" | |
# run: docker compose -p $INFRAHUB_BUILD_NAME down -v --remove-orphans --rmi local | |
# - name: "Build Test Image" | |
# run: "invoke dev.build" | |
# - name: "Pull External Docker Images" | |
# run: "invoke dev.pull" | |
# - name: "Integration Tests" | |
# run: "invoke sdk.test-integration" | |
# - name: "Coveralls : Integration Tests" | |
# uses: coverallsapp/github-action@v2 | |
# continue-on-error: true | |
# env: | |
# COVERALLS_SERVICE_NUMBER: ${{ github.sha }} | |
# with: | |
# flag-name: python-sdk-integration | |
# parallel: true | |
backend-tests-unit: | |
if: | | |
always() && !cancelled() && | |
!contains(needs.*.result, 'failure') && | |
!contains(needs.*.result, 'cancelled') && | |
needs.files-changed.outputs.backend == 'true' | |
needs: ["files-changed", "yaml-lint", "python-lint"] | |
runs-on: | |
group: huge-runners | |
timeout-minutes: 45 | |
env: | |
INFRAHUB_DB_TYPE: neo4j | |
steps: | |
- name: "Check out repository code" | |
uses: "actions/checkout@v4" | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: "Setup git credentials" | |
run: "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: "Setup Python environment" | |
run: | | |
poetry config virtualenvs.create true --local | |
poetry env use 3.12 | |
- name: "Install dependencies" | |
run: "poetry install --no-interaction --no-ansi" | |
- name: "Unit Tests" | |
run: "poetry run invoke backend.test-unit" | |
- name: "Coveralls : Unit Tests" | |
uses: coverallsapp/github-action@v2 | |
continue-on-error: true | |
env: | |
COVERALLS_SERVICE_NUMBER: ${{ github.sha }} | |
with: | |
flag-name: backend-unit | |
parallel: true | |
- name: Generate tracing spans | |
if: always() && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' | |
uses: inception-health/otel-upload-test-artifact-action@v1 | |
with: | |
jobName: "backend-tests-unit" | |
stepName: "Unit Tests" | |
path: "pytest-junit.xml" | |
type: "junit" | |
githubToken: ${{ secrets.GH_TRACING_REPO_TOKEN }} | |
backend-tests-integration: | |
if: | | |
always() && !cancelled() && | |
!contains(needs.*.result, 'failure') && | |
!contains(needs.*.result, 'cancelled') && | |
needs.files-changed.outputs.backend == 'true' | |
needs: ["files-changed", "yaml-lint", "python-lint"] | |
runs-on: | |
group: "huge-runners" | |
timeout-minutes: 30 | |
env: | |
INFRAHUB_DB_TYPE: neo4j | |
steps: | |
- name: "Check out repository code" | |
uses: "actions/checkout@v4" | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: "Setup git credentials" | |
run: "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: "Setup Python environment" | |
run: | | |
poetry config virtualenvs.create true --local | |
poetry env use 3.12 | |
- name: "Install dependencies" | |
run: "poetry install --no-interaction --no-ansi" | |
- name: "Mypy Tests" | |
run: "poetry run invoke backend.mypy" | |
- name: "Pylint Tests" | |
run: "poetry run invoke backend.pylint" | |
- name: "Integration Tests" | |
run: "poetry run invoke backend.test-integration" | |
- name: "Coveralls : Integration Tests" | |
uses: coverallsapp/github-action@v2 | |
continue-on-error: true | |
env: | |
COVERALLS_SERVICE_NUMBER: ${{ github.sha }} | |
with: | |
flag-name: backend-integration | |
parallel: true | |
backend-tests-memgraph: | |
if: | | |
always() && !cancelled() && | |
!contains(needs.*.result, 'failure') && | |
!contains(needs.*.result, 'cancelled') && | |
needs.files-changed.outputs.backend == 'true' | |
needs: ["files-changed", "yaml-lint", "python-lint"] | |
runs-on: | |
group: huge-runners | |
timeout-minutes: 45 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: backend-tests-unit-memgraph | |
env: | |
INFRAHUB_DB_TYPE: memgraph | |
# - name: backend-tests-unit-nats | |
# env: | |
# INFRAHUB_DB_TYPE: memgraph | |
# INFRAHUB_USE_NATS: 1 | |
# INFRAHUB_BROKER_DRIVER: nats | |
# INFRAHUB_CACHE_DRIVER: nats | |
name: ${{ matrix.name }} | |
env: ${{ matrix.env }} | |
steps: | |
- name: "Check out repository code" | |
uses: "actions/checkout@v4" | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: "Setup git credentials" | |
run: "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: "Setup Python environment" | |
run: | | |
poetry config virtualenvs.create true --local | |
poetry env use 3.12 | |
- name: "Install dependencies" | |
run: "poetry install --no-interaction --no-ansi" | |
- name: "Unit Tests" | |
run: "poetry run invoke backend.test-unit" | |
backend-validate-generated: | |
if: | | |
always() && !cancelled() && | |
!contains(needs.*.result, 'failure') && | |
!contains(needs.*.result, 'cancelled') && | |
(needs.files-changed.outputs.backend == 'true' || | |
needs.files-changed.outputs.documentation == 'true') | |
needs: ["files-changed", "yaml-lint", "python-lint"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: "Setup environment" | |
run: | | |
pipx install poetry | |
poetry config virtualenvs.prefer-active-python true | |
pip install invoke toml | |
- name: "Install Package" | |
run: "poetry install" | |
- name: "Run validator" | |
run: "poetry run invoke backend.validate-generated" | |
frontend-tests: | |
if: | | |
always() && !cancelled() && | |
!contains(needs.*.result, 'failure') && | |
!contains(needs.*.result, 'cancelled') && | |
needs.files-changed.outputs.frontend == 'true' | |
needs: ["files-changed", "yaml-lint", "javascript-lint"] | |
runs-on: "ubuntu-22.04" | |
timeout-minutes: 30 | |
steps: | |
- name: "Check out repository code" | |
uses: "actions/checkout@v4" | |
with: | |
submodules: true | |
- name: Install NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
cache-dependency-path: frontend/app/package-lock.json | |
- name: "Install frontend" | |
working-directory: ./frontend/app | |
run: npm install | |
- name: "Run unit tests" | |
working-directory: ./frontend/app | |
run: "npm run test:coverage" | |
- name: "Run integration tests" | |
working-directory: ./frontend/app | |
run: "npm run cypress:run" | |
- name: Upload cypress screenshots | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: screenshots | |
path: docs/docs/media/* | |
- name: Upload cypress videos | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: screenshots | |
path: frontend/app/cypress/videos/* | |
- name: "Coveralls : Unit Tests" | |
uses: coverallsapp/github-action@v2 | |
continue-on-error: true | |
env: | |
COVERALLS_SERVICE_NUMBER: ${{ github.sha }} | |
with: | |
flag-name: frontend-unit | |
parallel: true | |
file: frontend/app/coverage/lcov.info | |
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"] | |
runs-on: "ubuntu-22.04" | |
timeout-minutes: 5 | |
steps: | |
- name: "Check out repository code" | |
uses: "actions/checkout@v4" | |
with: | |
submodules: true | |
- name: Install NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
cache-dependency-path: docs/package-lock.json | |
- name: "Install dependencies" | |
run: npm install | |
- name: "Setup Python environment" | |
run: "pip install toml invoke" | |
- name: "Build website" | |
run: "invoke docs.build" | |
validate-generated-documentation: | |
if: | | |
always() && !cancelled() && | |
!contains(needs.*.result, 'failure') && | |
!contains(needs.*.result, 'cancelled') && | |
needs.files-changed.outputs.python == 'true' | |
needs: ["files-changed", "yaml-lint", "python-lint"] | |
runs-on: "ubuntu-22.04" | |
timeout-minutes: 5 | |
steps: | |
- name: "Check out repository code" | |
uses: "actions/checkout@v4" | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: "Setup environment" | |
run: "pip install invoke toml" | |
- name: "Build Test Image" | |
run: "invoke dev.build" | |
- name: "Validate generated documentation" | |
run: "invoke docs.validate --docker" | |
validate-documentation-style: | |
if: | | |
always() && !cancelled() && | |
!contains(needs.*.result, 'failure') && | |
!contains(needs.*.result, 'cancelled') && | |
needs.files-changed.outputs.documentation == 'true' | |
needs: ["files-changed", "yaml-lint", "python-lint"] | |
runs-on: "ubuntu-22.04" | |
timeout-minutes: 5 | |
steps: | |
- name: "Check out repository code" | |
uses: "actions/checkout@v4" | |
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 | |
env: | |
VALE_VERSION: ${{ env.VALE_VERSION }} | |
- name: "Validate documentation style" | |
run: ./vale $(find . -type f \( -name "*.mdx" -o -name "*.md" \) -not -path "./docs/node_modules/*") | |
# ------------------------------------------ E2E Tests ------------------------------------------ | |
E2E-testing-playwright: | |
defaults: | |
run: | |
working-directory: ./frontend/app | |
needs: | |
- javascript-lint | |
- files-changed | |
- yaml-lint | |
- python-lint | |
if: | | |
always() && !cancelled() && | |
!contains(needs.*.result, 'failure') && | |
!contains(needs.*.result, 'cancelled') | |
runs-on: | |
group: huge-runners | |
timeout-minutes: 40 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: E2E-testing-playwright | |
env: | |
INFRAHUB_DB_TYPE: neo4j | |
# - name: E2E-testing-playwright-nats | |
# env: | |
# INFRAHUB_DB_TYPE: neo4j | |
# INFRAHUB_USE_NATS: 1 | |
# INFRAHUB_BROKER_DRIVER: nats | |
# INFRAHUB_BROKER_PORT: 4222 | |
# INFRAHUB_CACHE_DRIVER: nats | |
# INFRAHUB_CACHE_ADDRESS: message-queue | |
# INFRAHUB_CACHE_PORT: 4222 | |
name: ${{ matrix.name }} | |
env: ${{ matrix.env }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
cache-dependency-path: frontend/app/package-lock.json | |
- name: Install Invoke | |
run: pip install toml invoke | |
- name: Set job name | |
run: echo JOB_NAME="$GITHUB_JOB" >> $GITHUB_ENV | |
- name: Enable tracing | |
if: github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' | |
run: echo "INFRAHUB_TRACE_ENABLE=true" >> $GITHUB_ENV | |
- name: Set tracing configuration | |
run: echo "INFRAHUB_TRACE_INSECURE=false" >> $GITHUB_ENV | |
- name: Set tracing configuration | |
run: echo "INFRAHUB_TRACE_EXPORTER_TYPE=otlp" >> $GITHUB_ENV | |
- name: Set tracing configuration | |
run: echo "INFRAHUB_TRACE_EXPORTER_ENDPOINT=${{ secrets.TRACING_ENDPOINT }}" >> $GITHUB_ENV | |
- name: Set tracing configuration | |
run: echo "OTEL_RESOURCE_ATTRIBUTES=github.run_id=${GITHUB_RUN_ID}" >> $GITHUB_ENV | |
- name: "Store start time" | |
run: echo TEST_START_TIME=$(date +%s)000 >> $GITHUB_ENV | |
- name: "Set environment variables" | |
run: echo INFRAHUB_BUILD_NAME=infrahub-${{ runner.name }} >> $GITHUB_ENV | |
- name: "Set environment variables" | |
run: echo INFRAHUB_IMAGE_VER=local-${{ runner.name }}-${{ github.sha }} >> $GITHUB_ENV | |
- name: "Clear docker environment" | |
run: docker compose -p $INFRAHUB_BUILD_NAME down -v --remove-orphans --rmi local | |
- name: Build Demo | |
run: invoke dev.build | |
- name: Pull External Docker Images | |
run: invoke dev.pull | |
- name: Initialize Demo | |
id: init-demo | |
run: invoke dev.start dev.load-infra-schema | |
- name: Check Demo Status | |
run: invoke dev.status | |
- name: Load Data | |
run: invoke dev.load-infra-data | |
- name: Git Repository | |
run: invoke dev.infra-git-import dev.infra-git-create | |
- name: Set infrahub address | |
run: | | |
PORT=$(docker compose -p $INFRAHUB_BUILD_NAME port server 8000 | cut -d: -f2) | |
echo "INFRAHUB_ADDRESS=http://localhost:${PORT}" >> $GITHUB_ENV | |
- name: Install frontend dependencies | |
run: npm install | |
- name: Install Playwright Browsers | |
run: npx playwright install chromium | |
# Make chromium ignore netlink messages by returning HandleMessage early | |
- name: Chrome path | |
run: echo CHROME_BIN_PATH="$(npx playwright install chromium --dry-run | grep Install | awk '{print $3}')/chrome-linux/chrome" >> $GITHUB_ENV | |
- name: Chrome func offset | |
run: echo FUNC_OFFSET="$(objdump -C --file-offsets --disassemble='net::internal::AddressTrackerLinux::HandleMessage(char const*, int, bool*, bool*, bool*)' $CHROME_BIN_PATH | grep 'File Offset' | sed -n 1p | sed -E 's/.*File Offset. (.*)\).*/\1/')" >> $GITHUB_ENV | |
- name: Patch chromium | |
run: printf '\xc3' | dd of=$CHROME_BIN_PATH bs=1 seek=$(($FUNC_OFFSET)) conv=notrunc | |
- name: Wait for artifacts to be generated before restarting infrahub | |
if: needs.files-changed.outputs.e2e_tests == 'true' | |
run: npx playwright test artifact | |
- name: Add response delay if required | |
if: needs.files-changed.outputs.e2e_tests == 'true' | |
run: echo "INFRAHUB_MISC_RESPONSE_DELAY=2" >> $GITHUB_ENV && invoke dev.start | |
env: | |
INFRAHUB_MISC_RESPONSE_DELAY: 2 | |
- name: Set infrahub address | |
if: needs.files-changed.outputs.e2e_tests == 'true' | |
run: | | |
PORT=$(docker compose -p $INFRAHUB_BUILD_NAME port server 8000 | cut -d: -f2) | |
echo "INFRAHUB_ADDRESS=http://localhost:${PORT}" >> $GITHUB_ENV | |
- name: Run Playwright tests | |
run: npm run ci:test:e2e | |
- name: Generate tracing spans | |
if: always() && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' | |
uses: inception-health/otel-upload-test-artifact-action@v1 | |
with: | |
jobName: "E2E-testing-playwright" | |
stepName: "Run Playwright tests" | |
path: "frontend/app/playwright-junit.xml" | |
type: "junit" | |
githubToken: ${{ secrets.GH_TRACING_REPO_TOKEN }} | |
- name: playwright-report | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.name }} | |
path: frontend/app/playwright-report/ | |
- name: Containers after tests | |
if: always() | |
run: docker ps -a | |
- name: Display server logs | |
if: always() | |
run: docker logs "${INFRAHUB_BUILD_NAME}-server-1" | |
- name: Display task worker 1 logs | |
if: always() | |
run: docker logs "${INFRAHUB_BUILD_NAME}-task-worker-1" | |
- name: Display task worker 2 logs | |
if: always() | |
run: docker logs "${INFRAHUB_BUILD_NAME}-task-worker-2" | |
- name: Display task manager logs | |
if: always() | |
run: docker logs "${INFRAHUB_BUILD_NAME}-task-manager-1" | |
- name: Display database logs | |
if: always() | |
run: docker logs "${INFRAHUB_BUILD_NAME}-database-1" | |
- name: Display message-queue logs | |
if: always() | |
run: docker logs "${INFRAHUB_BUILD_NAME}-message-queue-1" | |
- name: Display server status | |
if: always() | |
run: invoke demo.status | |
- name: "Clear docker environment and force vmagent to stop" | |
if: always() | |
run: docker compose -p $INFRAHUB_BUILD_NAME down -v --remove-orphans --rmi local | |
- name: "Wait for vmagent to push metrics" | |
if: always() | |
run: "sleep 10" | |
- name: "Show graph URL" | |
if: always() | |
run: 'echo "https://grafana-prod.tailc018d.ts.net/d/a4461039-bb27-4f57-9b2a-2c7f4e0a3459/e2e-tests?orgId=1&var-pr=$GITHUB_PR_NUMBER&var-job=$JOB_NAME&var-runner=$INFRAHUB_BUILD_NAME&from=$TEST_START_TIME&to=$(date +%s)000"' | |
# ------------------------------------------ E2E invoke demo ------------------------------------------------ | |
E2E-testing-invoke-demo-start: | |
needs: | |
- javascript-lint | |
- files-changed | |
- yaml-lint | |
- python-lint | |
if: | | |
always() && !cancelled() && | |
!contains(needs.*.result, 'failure') && | |
!contains(needs.*.result, 'cancelled') && | |
github.base_ref == 'develop' | |
runs-on: | |
group: huge-runners | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install Invoke | |
run: | | |
pip install toml invoke | |
- name: Set job name | |
run: echo JOB_NAME="$GITHUB_JOB" >> $GITHUB_ENV | |
- name: "Set environment variables" | |
run: echo INFRAHUB_BUILD_NAME=infrahub-${{ runner.name }} >> $GITHUB_ENV | |
- name: "Clear docker environment" | |
run: docker compose -p $INFRAHUB_BUILD_NAME down -v --remove-orphans --rmi local | |
- name: "Store start time" | |
run: echo TEST_START_TIME=$(date +%s)000 >> $GITHUB_ENV | |
- name: Run 'invoke demo' | |
run: | | |
unset INFRAHUB_IMAGE_VER | |
invoke demo.start demo.load-infra-schema demo.load-infra-data | |
- name: Display server logs | |
if: always() | |
run: docker logs "${INFRAHUB_BUILD_NAME}-server-1" | |
- name: Display task worker 1 logs | |
if: always() | |
run: docker logs "${INFRAHUB_BUILD_NAME}-infrahub-git-1" | |
- name: Display task worker 2 logs | |
if: always() | |
run: docker logs "${INFRAHUB_BUILD_NAME}-infrahub-git-2" | |
- name: Display task manager logs | |
if: always() | |
run: docker logs "${INFRAHUB_BUILD_NAME}-task-manager-1" | |
- name: Display database logs | |
if: always() | |
run: docker logs "${INFRAHUB_BUILD_NAME}-database-1" | |
- name: Display message-queue logs | |
if: always() | |
run: docker logs "${INFRAHUB_BUILD_NAME}-message-queue-1" | |
- name: "Clear docker environment and force vmagent to stop" | |
if: always() | |
run: docker compose -p $INFRAHUB_BUILD_NAME down -v --remove-orphans --rmi local | |
# ------------------------------------------ Benchmarks ------------------------------------------------ | |
backend-benchmark: | |
needs: | |
- javascript-lint | |
- files-changed | |
- yaml-lint | |
- python-lint | |
if: | | |
always() && !cancelled() && | |
!contains(needs.*.result, 'failure') && | |
!contains(needs.*.result, 'cancelled') && | |
needs.files-changed.outputs.backend == 'true' | |
runs-on: | |
group: huge-runners | |
env: | |
INFRAHUB_DB_TYPE: neo4j | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: "Setup git credentials" | |
run: "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: "Setup Python environment" | |
run: | | |
poetry config virtualenvs.create true --local | |
poetry env use 3.12 | |
- name: "Install dependencies" | |
run: "poetry install --no-interaction --no-ansi" | |
- name: Update PATH | |
run: "echo ~/.cargo/bin >> $GITHUB_PATH" | |
- name: Run benchmarks | |
uses: CodSpeedHQ/action@v3 | |
with: | |
token: ${{ secrets.CODSPEED_TOKEN }} | |
run: "poetry run pytest -v backend/tests/benchmark/ --codspeed" | |
# ------------------------------------------ Coverall Report ------------------------------------------ | |
coverall-report: | |
needs: | |
- backend-tests-integration | |
- backend-tests-unit | |
- frontend-tests | |
if: | | |
always() && !cancelled() | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
# # NOTE: The ref value should be different when triggered by pull_request event. | |
# # See: https://github.com/lewagon/wait-on-check-action/issues/25. | |
# - name: Wait on tests (PR) | |
# uses: lewagon/wait-on-check-action@e106e5c43e8ca1edea6383a39a01c5ca495fd812 | |
# if: github.event_name == 'pull_request' | |
# with: | |
# ref: ${{ github.event.pull_request.head.sha }} | |
# repo-token: ${{ secrets.GITHUB_TOKEN }} | |
# wait-interval: 10 | |
# running-workflow-name: report | |
# allowed-conclusions: success,skipped,cancelled,failure | |
# - name: Wait on tests (push) | |
# if: github.event_name != 'pull_request' | |
# uses: lewagon/wait-on-check-action@e106e5c43e8ca1edea6383a39a01c5ca495fd812 | |
# with: | |
# ref: ${{ github.sha }} | |
# repo-token: ${{ secrets.GITHUB_TOKEN }} | |
# wait-interval: 10 | |
# running-workflow-name: report | |
# allowed-conclusions: success,skipped,cancelled,failure | |
- uses: coverallsapp/github-action@v2 | |
continue-on-error: true | |
env: | |
COVERALLS_SERVICE_NUMBER: ${{ github.sha }} | |
with: | |
carryforward: "backend-unit,backend-integration,frontend-unit" | |
parallel-finished: true |