Skip to content

chore(ci): move pre-commit back to GHA #249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 0 additions & 113 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,6 @@ commands:
- ~/.cache/uv
key: uv-cache-1-<<pipeline.parameters.python_version>>-{{ .Environment.CIRCLE_WORKING_DIRECTORY }}-{{ arch }}-{{ checksum "uv.lock" }}
- setup-lfs
setup-pre-commit:
steps:
- restore_cache:
keys:
- pre-commit-cache-<<pipeline.parameters.python_version>>-{{ checksum ".pre-commit-config.yaml" }}
- run:
command: uv run --frozen pre-commit install-hooks
name: Install pre-commit hooks
- save_cache:
paths:
- ~/.cache/pre-commit
- ~/.cache/uv
key: pre-commit-cache-<<pipeline.parameters.python_version>>-{{ checksum ".pre-commit-config.yaml" }}
upload-tests:
steps:
- store_test_results:
Expand Down Expand Up @@ -319,17 +306,6 @@ jobs:
channel: "alerts-parse-tests"
template: basic_fail_1

pre-commit:
executor: default_image
resource_class: large
steps:
- setup-uv
- node/install:
use-nvm-cache: true
- setup-pre-commit
- run:
command: uv run --frozen pre-commit run --all-files --show-diff-on-failure --color=always
name: run pre-commit
linux-wheels:
parameters:
resource_class:
Expand Down Expand Up @@ -396,99 +372,10 @@ jobs:
channel: "release"
template: success_tagged_deploy_1
workflows:
# develop-checks:
# jobs:
# - hold-parse-tests:
# type: approval
# filters:
# branches:
# ignore: develop
# - parse-tests:
# name: Manual-Parse-Tests
# filters:
# branches:
# ignore: develop
# context:
# - GHE
# requires:
# - hold-parse-tests
# matrix:
# parameters:
# extra_repos: [true, false]
# - parse-tests:
# context:
# - GHE
# - slack
# filters:
# branches:
# only: develop
# extra_repos: true
# - parse-tests:
# name: oss-parse-tests
# context:
# - GHE
# - slack
# filters:
# branches:
# only: develop
# extra_repos: false
# - oss-codemod-tests:
# name: oss-codemod-tests
# context:
# - GHE
# - slack
# filters:
# branches:
# only: develop
# matrix:
# parameters:
# sync_graph: [true, false]
# size: [small, large]
pr_checks:
jobs:
- unit-tests
- integration-tests
# - hold-codemod-tests:
# type: approval
# filters:
# branches:
# ignore: develop
# - hold-large-oss-codemod-tests:
# type: approval
# filters:
# branches:
# ignore: develop
# - codemod-tests:
# context:
# - GHE
# - Codemod
# - slack
# requires:
# - hold-codemod-tests
- pre-commit
# - doctests
# - oss-codemod-tests:
# filters:
# branches:
# ignore: develop
# context:
# - GHE
# - slack
# matrix:
# parameters:
# sync_graph: [true, false]
# size: [small]
# - oss-codemod-tests:
# name: large-oss-codemod-tests
# context:
# - GHE
# - slack
# matrix:
# parameters:
# sync_graph: [true, false]
# size: [large]
# requires:
# - hold-large-oss-codemod-tests
publish-packages:
jobs:
- linux-wheels:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/cache-delete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:

jobs:
cleanup:
# changing the following value will significantly affect github's billing. Be careful and consult with the team before changing it.
runs-on: ubuntu-latest
steps:
- name: Cleanup
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/cache-warm-up.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Cache Warm-Up

on:
workflow_dispatch:
push:
branches:
- "develop"

jobs:

warm-up-cache-uv:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}

steps:
- name: Check if on develop branch
run: |
if [ "${{ github.ref }}" != "refs/heads/develop" ]; then
echo "Not on develop branch. Exiting."
exit 1
fi

- name: Checkout code
uses: actions/checkout@v4
with:
ref: develop # Ensure we're operating on the 'develop' branch

- name: Setup backend
uses: ./.github/actions/setup-backend

warm-up-cache:
runs-on: ubuntu-latest
needs: [warm-up-cache-uv]
steps:
- name: Check if on develop branch
run: |
if [ "${{ github.ref }}" != "refs/heads/develop" ]; then
echo "Not on develop branch. Exiting."
exit 1
fi

- name: Checkout code
uses: actions/checkout@v4
with:
ref: develop # Ensure we're operating on the 'develop' branch

- name: Setup backend
uses: ./.github/actions/setup-backend

- name: Cache oss-repos
uses: ./.github/actions/setup-oss-repos
with:
CODEGEN_BOT_GHE_TOKEN: ${{ secrets.CODEGEN_BOT_GHE_TOKEN }}

- name: Setup-pre-commit
run: uv tool install pre-commit --with pre-commit-uv --force-reinstall

- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- run: pre-commit install-hooks
shell: bash
46 changes: 46 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: pre-commit

on:
pull_request:
branches:
- "develop"

jobs:
pre-commit:
# changing the following value will significantly affect github's billing. Be careful and consult with the team before changing it.
runs-on: ubuntu-latest-8
timeout-minutes: 10
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write

steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.REPO_SCOPED_TOKEN }}

- name: Setup backend
uses: ./.github/actions/setup-backend

- name: Setup-pre-commit
run: uv tool install pre-commit --with pre-commit-uv --force-reinstall

- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- 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
shell: bash

# TODO: add back in
# - uses: stefanzweifel/git-auto-commit-action@v5
# # Always commit changes even if pre-commit failed
# if: always()
# with:
# commit_message: "Automated pre-commit update"
Loading