|
49 | 49 | - run: clojure -X:dev:ee:ee-dev:drivers:drivers-dev:test:eastwood/test |
50 | 50 | name: Run Eastwood linter on our backend tests |
51 | 51 |
|
52 | | -<<<<<<< HEAD |
53 | | - be-linter-eastwood-test-changed: |
54 | | - # PR / merge queue: lint only the test namespaces touched by the diff. |
55 | | - if: ${{ !inputs.skip && (github.event_name == 'pull_request' || github.event_name == 'merge_group') }} |
56 | | - runs-on: ${{ vars.DEFAULT_RUNNER_KEY }} |
57 | | - timeout-minutes: 15 |
58 | | - name: Eastwood (changed tests only) |
59 | | - steps: |
60 | | - - uses: actions/checkout@v4 |
61 | | - with: |
62 | | - # Enough history for `git merge-base` on a typical PR. |
63 | | - fetch-depth: 200 |
64 | | - - name: Prepare back-end environment |
65 | | - uses: ./.github/actions/prepare-backend |
66 | | - - name: Compute changed test namespaces |
67 | | - id: changed |
68 | | - env: |
69 | | - BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }} |
70 | | - HEAD_SHA: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha || github.sha }} |
71 | | - run: | |
72 | | - set -euo pipefail |
73 | | -
|
74 | | - # Diff from the merge-base so changes that landed on the base branch after the PR was |
75 | | - # last synced don't widen our scope. Falls back to BASE_SHA if older than fetched depth. |
76 | | - git fetch --no-tags --depth=200 origin "$BASE_SHA" |
77 | | - DIFF_BASE=$(git merge-base "$BASE_SHA" "$HEAD_SHA" 2>/dev/null || echo "$BASE_SHA") |
78 | | - # Test roots we lint: core, EE, and each driver module's test tree. |
79 | | - # :eastwood/test derives matching :source-paths from the classpath, so any |
80 | | - # namespace we name here is reachable. Include renames (R) so a test that |
81 | | - # was just renamed still gets linted under its new name. |
82 | | - FILES=$(git diff --name-only --diff-filter=AMR "$DIFF_BASE" "$HEAD_SHA" \ |
83 | | - -- 'test/**/*.clj' 'test/**/*.cljc' \ |
84 | | - 'enterprise/backend/test/**/*.clj' 'enterprise/backend/test/**/*.cljc' \ |
85 | | - 'modules/drivers/**/test/**/*.clj' 'modules/drivers/**/test/**/*.cljc') |
86 | | -
|
87 | | - if [ -z "$FILES" ]; then |
88 | | - echo "No backend test files changed; skipping lint." |
89 | | - echo "namespaces=" >> "$GITHUB_OUTPUT" |
90 | | - exit 0 |
91 | | - fi |
92 | | -
|
93 | | - # Defence-in-depth: paths flow into a subsequent shell command via $GITHUB_OUTPUT. |
94 | | - if grep -Eqv '^[A-Za-z0-9_./-]+$' <<<"$FILES"; then |
95 | | - echo "Refusing to lint: unexpected characters in changed file paths:" >&2 |
96 | | - echo "$FILES" >&2 |
97 | | - exit 1 |
98 | | - fi |
99 | | -
|
100 | | - NS=$(sed -E 's#^(test/|enterprise/backend/test/|modules/drivers/[^/]+/test/)##; s#\.cljc?$##; s#/#.#g; s#_#-#g' <<<"$FILES" \ |
101 | | - | sort -u \ |
102 | | - | paste -sd' ' -) |
103 | | - echo "Changed test namespaces: $NS" |
104 | | - echo "namespaces=$NS" >> "$GITHUB_OUTPUT" |
105 | | - - name: Run Eastwood on changed test namespaces |
106 | | - if: steps.changed.outputs.namespaces != '' |
107 | | - env: |
108 | | - NAMESPACES: ${{ steps.changed.outputs.namespaces }} |
109 | | - run: clojure -X:dev:ee:ee-dev:drivers:drivers-dev:test:eastwood/test :namespaces "[$NAMESPACES]" |
110 | | - |
111 | | -||||||| 0a60f2436f |
112 | | -======= |
113 | 52 | be-linter-eastwood-test-changed: |
114 | 53 | # PR / merge queue: lint only the test namespaces touched by the diff. |
115 | 54 | if: ${{ !inputs.skip && (github.event_name == 'pull_request' || github.event_name == 'merge_group') }} |
@@ -168,7 +107,6 @@ jobs: |
168 | 107 | NAMESPACES: ${{ steps.changed.outputs.namespaces }} |
169 | 108 | run: clojure -X:dev:ee:ee-dev:drivers:drivers-dev:test:eastwood/test :namespaces "[$NAMESPACES]" |
170 | 109 |
|
171 | | ->>>>>>> v0.62.1 |
172 | 110 | be-tests: |
173 | 111 | if: ${{ !inputs.skip }} |
174 | 112 | runs-on: ${{ vars.DEFAULT_RUNNER_KEY }} |
|
0 commit comments