Skip to content

Commit a3e6016

Browse files
chore(ci): move pre-commit back to GHA (#249)
1 parent 59c24e3 commit a3e6016

File tree

4 files changed

+112
-114
lines changed

4 files changed

+112
-114
lines changed

.circleci/config.yml

Lines changed: 0 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,6 @@ commands:
117117
- ~/.cache/uv
118118
key: uv-cache-1-<<pipeline.parameters.python_version>>-{{ .Environment.CIRCLE_WORKING_DIRECTORY }}-{{ arch }}-{{ checksum "uv.lock" }}
119119
- setup-lfs
120-
setup-pre-commit:
121-
steps:
122-
- restore_cache:
123-
keys:
124-
- pre-commit-cache-<<pipeline.parameters.python_version>>-{{ checksum ".pre-commit-config.yaml" }}
125-
- run:
126-
command: uv run --frozen pre-commit install-hooks
127-
name: Install pre-commit hooks
128-
- save_cache:
129-
paths:
130-
- ~/.cache/pre-commit
131-
- ~/.cache/uv
132-
key: pre-commit-cache-<<pipeline.parameters.python_version>>-{{ checksum ".pre-commit-config.yaml" }}
133120
upload-tests:
134121
steps:
135122
- store_test_results:
@@ -319,17 +306,6 @@ jobs:
319306
channel: "alerts-parse-tests"
320307
template: basic_fail_1
321308

322-
pre-commit:
323-
executor: default_image
324-
resource_class: large
325-
steps:
326-
- setup-uv
327-
- node/install:
328-
use-nvm-cache: true
329-
- setup-pre-commit
330-
- run:
331-
command: uv run --frozen pre-commit run --all-files --show-diff-on-failure --color=always
332-
name: run pre-commit
333309
linux-wheels:
334310
parameters:
335311
resource_class:
@@ -396,99 +372,10 @@ jobs:
396372
channel: "release"
397373
template: success_tagged_deploy_1
398374
workflows:
399-
# develop-checks:
400-
# jobs:
401-
# - hold-parse-tests:
402-
# type: approval
403-
# filters:
404-
# branches:
405-
# ignore: develop
406-
# - parse-tests:
407-
# name: Manual-Parse-Tests
408-
# filters:
409-
# branches:
410-
# ignore: develop
411-
# context:
412-
# - GHE
413-
# requires:
414-
# - hold-parse-tests
415-
# matrix:
416-
# parameters:
417-
# extra_repos: [true, false]
418-
# - parse-tests:
419-
# context:
420-
# - GHE
421-
# - slack
422-
# filters:
423-
# branches:
424-
# only: develop
425-
# extra_repos: true
426-
# - parse-tests:
427-
# name: oss-parse-tests
428-
# context:
429-
# - GHE
430-
# - slack
431-
# filters:
432-
# branches:
433-
# only: develop
434-
# extra_repos: false
435-
# - oss-codemod-tests:
436-
# name: oss-codemod-tests
437-
# context:
438-
# - GHE
439-
# - slack
440-
# filters:
441-
# branches:
442-
# only: develop
443-
# matrix:
444-
# parameters:
445-
# sync_graph: [true, false]
446-
# size: [small, large]
447375
pr_checks:
448376
jobs:
449377
- unit-tests
450378
- integration-tests
451-
# - hold-codemod-tests:
452-
# type: approval
453-
# filters:
454-
# branches:
455-
# ignore: develop
456-
# - hold-large-oss-codemod-tests:
457-
# type: approval
458-
# filters:
459-
# branches:
460-
# ignore: develop
461-
# - codemod-tests:
462-
# context:
463-
# - GHE
464-
# - Codemod
465-
# - slack
466-
# requires:
467-
# - hold-codemod-tests
468-
- pre-commit
469-
# - doctests
470-
# - oss-codemod-tests:
471-
# filters:
472-
# branches:
473-
# ignore: develop
474-
# context:
475-
# - GHE
476-
# - slack
477-
# matrix:
478-
# parameters:
479-
# sync_graph: [true, false]
480-
# size: [small]
481-
# - oss-codemod-tests:
482-
# name: large-oss-codemod-tests
483-
# context:
484-
# - GHE
485-
# - slack
486-
# matrix:
487-
# parameters:
488-
# sync_graph: [true, false]
489-
# size: [large]
490-
# requires:
491-
# - hold-large-oss-codemod-tests
492379
publish-packages:
493380
jobs:
494381
- linux-wheels:

.github/workflows/cache-delete.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66

77
jobs:
88
cleanup:
9-
# changing the following value will significantly affect github's billing. Be careful and consult with the team before changing it.
109
runs-on: ubuntu-latest
1110
steps:
1211
- name: Cleanup

.github/workflows/cache-warm-up.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Cache Warm-Up
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- "develop"
8+
9+
jobs:
10+
11+
warm-up-cache-uv:
12+
strategy:
13+
matrix:
14+
os: [ ubuntu-latest, macos-latest ]
15+
runs-on: ${{ matrix.os }}
16+
17+
steps:
18+
- name: Check if on develop branch
19+
run: |
20+
if [ "${{ github.ref }}" != "refs/heads/develop" ]; then
21+
echo "Not on develop branch. Exiting."
22+
exit 1
23+
fi
24+
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
with:
28+
ref: develop # Ensure we're operating on the 'develop' branch
29+
30+
- name: Setup backend
31+
uses: ./.github/actions/setup-backend
32+
33+
warm-up-cache:
34+
runs-on: ubuntu-latest
35+
needs: [warm-up-cache-uv]
36+
steps:
37+
- name: Check if on develop branch
38+
run: |
39+
if [ "${{ github.ref }}" != "refs/heads/develop" ]; then
40+
echo "Not on develop branch. Exiting."
41+
exit 1
42+
fi
43+
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
with:
47+
ref: develop # Ensure we're operating on the 'develop' branch
48+
49+
- name: Setup backend
50+
uses: ./.github/actions/setup-backend
51+
52+
- name: Cache oss-repos
53+
uses: ./.github/actions/setup-oss-repos
54+
with:
55+
CODEGEN_BOT_GHE_TOKEN: ${{ secrets.CODEGEN_BOT_GHE_TOKEN }}
56+
57+
- name: Setup-pre-commit
58+
run: uv tool install pre-commit --with pre-commit-uv --force-reinstall
59+
60+
- uses: actions/cache@v4
61+
with:
62+
path: ~/.cache/pre-commit
63+
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
64+
65+
- run: pre-commit install-hooks
66+
shell: bash

.github/workflows/pre-commit.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "develop"
7+
8+
jobs:
9+
pre-commit:
10+
# changing the following value will significantly affect github's billing. Be careful and consult with the team before changing it.
11+
runs-on: ubuntu-latest-8
12+
timeout-minutes: 10
13+
permissions:
14+
# Give the default GITHUB_TOKEN write permission to commit and push the
15+
# added or changed files to the repository.
16+
contents: write
17+
18+
steps:
19+
- name: Check out the repo
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
repository: ${{ github.event.pull_request.head.repo.full_name }}
24+
ref: ${{ github.event.pull_request.head.ref }}
25+
token: ${{ secrets.REPO_SCOPED_TOKEN }}
26+
27+
- name: Setup backend
28+
uses: ./.github/actions/setup-backend
29+
30+
- name: Setup-pre-commit
31+
run: uv tool install pre-commit --with pre-commit-uv --force-reinstall
32+
33+
- uses: actions/cache@v4
34+
with:
35+
path: ~/.cache/pre-commit
36+
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
37+
38+
- run: uv run --frozen pre-commit run --show-diff-on-failure --color=always --all-files --source ${{ github.event.pull_request.base.sha }} --origin ${{github.event.pull_request.head.sha }} --show-diff-on-failure --color=always
39+
shell: bash
40+
41+
# TODO: add back in
42+
# - uses: stefanzweifel/git-auto-commit-action@v5
43+
# # Always commit changes even if pre-commit failed
44+
# if: always()
45+
# with:
46+
# commit_message: "Automated pre-commit update"

0 commit comments

Comments
 (0)