diff --git a/.circleci/config.yml b/.circleci/config.yml index 1d552656c..7aa07b2dc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -117,19 +117,6 @@ commands: - ~/.cache/uv key: uv-cache-1-<>-{{ .Environment.CIRCLE_WORKING_DIRECTORY }}-{{ arch }}-{{ checksum "uv.lock" }} - setup-lfs - setup-pre-commit: - steps: - - restore_cache: - keys: - - pre-commit-cache-<>-{{ 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-<>-{{ checksum ".pre-commit-config.yaml" }} upload-tests: steps: - store_test_results: @@ -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: @@ -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: diff --git a/.github/workflows/cache-delete.yml b/.github/workflows/cache-delete.yml index 0273beb91..6c229d1a0 100644 --- a/.github/workflows/cache-delete.yml +++ b/.github/workflows/cache-delete.yml @@ -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 diff --git a/.github/workflows/cache-warm-up.yml b/.github/workflows/cache-warm-up.yml new file mode 100644 index 000000000..7b080a86e --- /dev/null +++ b/.github/workflows/cache-warm-up.yml @@ -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 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 000000000..5868c7b18 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -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"