From 3dc45e4bb1d6f3016cda43338fb39d592327207c Mon Sep 17 00:00:00 2001 From: Matt Kaye Date: Fri, 28 Mar 2025 11:16:56 -0400 Subject: [PATCH] Fix: More Path Filters (#1443) * fix: add more path filters and remove check path action * feat: only run on changes to pyproject.toml / package.json * fix: try bumping golangci-lint * fix: golang ci config * fix: upgrade pre commit ver * Revert "fix: upgrade pre commit ver" This reverts commit 9cdbfc68da9417747d32fc3ffe26aab44c9f5058. * Revert "fix: golang ci config" This reverts commit 6b27c1abd03e7cdc1c5b75046178a284e6e57129. * Revert "fix: try bumping golangci-lint" This reverts commit f7bfcb696365eb0ae9bb930a1ec55781bcb87c0d. --- .github/actions/check-paths/action.yml | 90 -------------------------- .github/workflows/app.yml | 20 +----- .github/workflows/build.yml | 44 ------------- .github/workflows/docs.yml | 18 ------ .github/workflows/lint.yml | 18 ------ .github/workflows/sdk-python.yml | 2 +- .github/workflows/sdk-typescript.yml | 2 +- .github/workflows/test.yml | 24 ------- 8 files changed, 4 insertions(+), 214 deletions(-) delete mode 100644 .github/actions/check-paths/action.yml diff --git a/.github/actions/check-paths/action.yml b/.github/actions/check-paths/action.yml deleted file mode 100644 index abe8a1703..000000000 --- a/.github/actions/check-paths/action.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: 'Check Changed Paths' -description: 'Check if changed files match specified patterns' -inputs: - include_patterns: - description: 'Patterns to include, one per line' - required: false - default: '' - exclude_patterns: - description: 'Patterns to exclude, one per line' - required: false - default: '' - result_name: - description: 'Name for the output result' - required: false - default: 'match_only' -outputs: - match_result: - description: "true if all changed files match include patterns and don't match exclude patterns" - value: ${{ steps.check-paths.outputs.result }} -runs: - using: 'composite' - steps: - - name: Check changed paths - id: check-paths - shell: bash - run: | - # Get list of changed files - if [[ "${{ github.event_name }}" == "pull_request" || "${{ github.event_name }}" == "pull_request_target" ]]; then - echo "PR context detected, comparing against base branch" - # Fetch the base branch first to ensure we have history - git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1 - CHANGED_FILES=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }} ${{ github.sha }} || - git diff --name-only origin/${{ github.event.pull_request.base.ref }}..HEAD || - git diff --name-only HEAD) - else - echo "Non-PR context detected, comparing against previous commit" - # For push events, try to get changed files using more reliable methods - CHANGED_FILES=$(git diff --name-only HEAD^ || - git diff --name-only HEAD~1 || - git show --name-only --format="" || - echo "") - fi - - if [[ -z "$CHANGED_FILES" ]]; then - echo "Warning: Could not determine changed files. Treating all files as changed." - CHANGED_FILES=$(find . -type f -not -path "./.git/*" | sed 's|^./||') - fi - - echo "Changed files: $CHANGED_FILES" - - # Default to true - will change to false if any file doesn't match criteria - RESULT=true - - # Convert input patterns to arrays - IFS=$'\n' read -r -a INCLUDE_PATTERNS <<< "${{ inputs.include_patterns }}" - IFS=$'\n' read -r -a EXCLUDE_PATTERNS <<< "${{ inputs.exclude_patterns }}" - - # Process each changed file - for file in $CHANGED_FILES; do - # Check if file matches any include pattern (if provided) - if [[ ${#INCLUDE_PATTERNS[@]} -gt 0 ]]; then - INCLUDED=false - for pattern in "${INCLUDE_PATTERNS[@]}"; do - if [[ -n "$pattern" && "$file" =~ $pattern ]]; then - INCLUDED=true - break - fi - done - if [[ "$INCLUDED" == "false" ]]; then - echo "File '$file' doesn't match any include pattern" - RESULT=false - break - fi - fi - - # Check if file matches any exclude pattern (if provided) - if [[ ${#EXCLUDE_PATTERNS[@]} -gt 0 ]]; then - for pattern in "${EXCLUDE_PATTERNS[@]}"; do - if [[ -n "$pattern" && "$file" =~ $pattern ]]; then - echo "File '$file' matches exclude pattern: $pattern" - RESULT=false - break 2 - fi - done - fi - done - - echo "result=$RESULT" >> $GITHUB_OUTPUT - echo "${{ inputs.result_name }}=$RESULT" >> $GITHUB_OUTPUT - echo "Final result: $RESULT" diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index 99849876f..c3bc6b72e 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -1,26 +1,12 @@ name: "frontend / app" on: pull_request: + paths: + - "frontend/app/**" jobs: - check_path: - runs-on: ubuntu-latest - outputs: - sdk_only: ${{ steps.filter.outputs.sdk_only }} - steps: - - uses: actions/checkout@v4 - - name: Check if only SDK files changed - id: check-paths - uses: ./.github/actions/check-paths - with: - include_patterns: | - ^sdks/ - result_name: sdk_only - lint: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -42,9 +28,7 @@ jobs: run: npm run lint:check build: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea2c2ff46..75cb18097 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,24 +6,8 @@ on: - 'frontend/docs/**' jobs: - check_path: - runs-on: ubuntu-latest - outputs: - sdk_only: ${{ steps.filter.outputs.sdk_only }} - steps: - - uses: actions/checkout@v4 - - name: Check if only SDK files changed - id: check-paths - uses: ./.github/actions/check-paths - with: - include_patterns: | - ^sdks/ - result_name: sdk_only - frontend: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -31,9 +15,7 @@ jobs: run: docker build -f ./build/package/frontend.dockerfile . api: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -41,9 +23,7 @@ jobs: run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=api api-arm: - needs: check_path runs-on: hatchet-arm64-2 - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -51,9 +31,7 @@ jobs: run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=api engine: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -61,9 +39,7 @@ jobs: run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=engine engine-arm: - needs: check_path runs-on: hatchet-arm64-2 - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -71,9 +47,7 @@ jobs: run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=engine admin: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -81,9 +55,7 @@ jobs: run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=admin admin-arm: - needs: check_path runs-on: hatchet-arm64-2 - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -91,9 +63,7 @@ jobs: run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=admin migrate: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -101,9 +71,7 @@ jobs: run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=migrate migrate-arm: - needs: check_path runs-on: hatchet-arm64-2 - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -111,9 +79,7 @@ jobs: run: docker build -f ./build/package/servers.dockerfile . --build-arg SERVER_TARGET=migrate lite-arm: - needs: check_path runs-on: hatchet-arm64-2 - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -147,9 +113,7 @@ jobs: . lite-amd: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -183,9 +147,7 @@ jobs: . dashboard-arm: - needs: check_path runs-on: hatchet-arm64-2 - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -203,9 +165,7 @@ jobs: . dashboard-amd: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -223,9 +183,7 @@ jobs: . loadtest: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -233,9 +191,7 @@ jobs: run: docker build -f ./build/package/loadtest.dockerfile . loadtest-arm: - needs: check_path runs-on: hatchet-arm64-2 - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a8fcf0a0c..a4e4414af 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -5,24 +5,8 @@ on: - 'frontend/docs/**' jobs: - check_path: - runs-on: ubuntu-latest - outputs: - sdk_only: ${{ steps.filter.outputs.sdk_only }} - steps: - - uses: actions/checkout@v4 - - name: Check if only SDK files changed - id: check-paths - uses: ./.github/actions/check-paths - with: - include_patterns: | - ^sdks/ - result_name: sdk_only - lint: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 @@ -44,9 +28,7 @@ jobs: run: npm run lint:check build: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - name: Clone repository uses: actions/checkout@v4 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c2f8dd726..2f2b9cd17 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,26 +3,8 @@ on: pull_request: jobs: - check_path: - runs-on: ubuntu-latest - outputs: - sdk_only: ${{ steps.check-paths.outputs.sdk_only }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Need full history for comparing with base branch - - name: Check if only SDK files changed - id: check-paths - uses: ./.github/actions/check-paths - with: - include_patterns: | - ^sdks/ - result_name: sdk_only - lint: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 diff --git a/.github/workflows/sdk-python.yml b/.github/workflows/sdk-python.yml index 20afefe9f..fe9800ae6 100644 --- a/.github/workflows/sdk-python.yml +++ b/.github/workflows/sdk-python.yml @@ -11,7 +11,7 @@ on: branches: - main paths: - - 'sdks/python/**' + - 'sdks/python/pyproject.toml' defaults: run: diff --git a/.github/workflows/sdk-typescript.yml b/.github/workflows/sdk-typescript.yml index 9a281c1cd..906db32df 100644 --- a/.github/workflows/sdk-typescript.yml +++ b/.github/workflows/sdk-typescript.yml @@ -11,7 +11,7 @@ on: branches: - main paths: - - 'sdks/typescript/**' + - 'sdks/typescript/package.json' defaults: run: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a9ff0b1fe..58cdb77a6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,24 +6,8 @@ on: - 'frontend/docs/**' jobs: - check_path: - runs-on: ubuntu-latest - outputs: - sdk_only: ${{ steps.filter.outputs.sdk_only }} - steps: - - uses: actions/checkout@v4 - - name: Check if only SDK files changed - id: check-paths - uses: ./.github/actions/check-paths - with: - include_patterns: | - ^sdks/ - result_name: sdk_only - generate: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} env: DATABASE_URL: postgresql://hatchet:hatchet@127.0.0.1:5431/hatchet?sslmode=disable @@ -69,9 +53,7 @@ jobs: run: docker compose down unit: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} steps: - uses: actions/checkout@v4 - name: Setup Go @@ -89,9 +71,7 @@ jobs: run: go test ./... -v -failfast integration: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} env: DATABASE_URL: postgresql://hatchet:hatchet@127.0.0.1:5431/hatchet?sslmode=disable @@ -135,9 +115,7 @@ jobs: run: docker compose down e2e: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} timeout-minutes: 30 env: DATABASE_URL: postgresql://hatchet:hatchet@127.0.0.1:5431/hatchet?sslmode=disable @@ -224,9 +202,7 @@ jobs: run: docker compose down e2e-pgmq: - needs: check_path runs-on: ubuntu-latest - if: ${{ needs.check_path.outputs.sdk_only != 'true' }} timeout-minutes: 30 env: DATABASE_URL: postgresql://hatchet:hatchet@127.0.0.1:5431/hatchet?sslmode=disable