Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2cad034
Restore old workflows
bagel897 Jan 28, 2025
61e17f4
Comment out line
bagel897 Jan 28, 2025
9957719
rearrange lfs
bagel897 Jan 28, 2025
ea4073b
Updates by ai
bagel897 Jan 28, 2025
973af24
Skip disallowed words
bagel897 Jan 28, 2025
ef99058
Update workflows/environments
bagel897 Jan 28, 2025
04db651
Merge branch 'develop' into eagarwal-cg-10568-restore-gha
bagel897 Jan 28, 2025
7ef8bf3
Merge branch 'develop' of github.com:codegen-sh/codegen-sdk into eaga…
bagel897 Feb 3, 2025
aa291b7
update workflows
bagel897 Feb 3, 2025
6b9ec97
Merge branch 'develop' of github.com:codegen-sh/codegen-sdk into eaga…
bagel897 Feb 3, 2025
b5b50ae
Update command
bagel897 Feb 3, 2025
0b41c8e
Restore token
bagel897 Feb 3, 2025
0765a7e
fix report location
bagel897 Feb 3, 2025
6cfde90
Fix args for pre-commit
bagel897 Feb 3, 2025
bc4bd02
Cleanup workflows
bagel897 Feb 3, 2025
00a0410
Bump version
bagel897 Feb 3, 2025
a2a219d
remove job param
bagel897 Feb 3, 2025
f4be0fc
move docs to integration tests
bagel897 Feb 3, 2025
1732001
Reformat
bagel897 Feb 3, 2025
856fe01
Fix test
bagel897 Feb 3, 2025
66e5e81
Update workflows
bagel897 Feb 3, 2025
21b19a5
Update shell
bagel897 Feb 3, 2025
56aaf77
Reduce timeout
bagel897 Feb 3, 2025
b77d444
move test
bagel897 Feb 3, 2025
da7dbca
Restore auto-commit
bagel897 Feb 3, 2025
71e1171
Add debugging comment
bagel897 Feb 3, 2025
158e78f
remove circleci hook
bagel897 Feb 3, 2025
64fc5c7
restore keys
bagel897 Feb 3, 2025
5a986b2
Revert "remove circleci hook"
bagel897 Feb 3, 2025
c6645a6
Revert "Fix test"
bagel897 Feb 3, 2025
ab5bbfa
skip circleci hook
bagel897 Feb 3, 2025
b3bdafa
bump to 32
bagel897 Feb 3, 2025
8dd49a6
move test
bagel897 Feb 3, 2025
e84650b
Don't use ATS for integration tests
bagel897 Feb 3, 2025
44a7049
update cibuildwheel
bagel897 Feb 3, 2025
54c2393
fix tests
bagel897 Feb 3, 2025
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
69 changes: 0 additions & 69 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,6 @@ commands:
paths:
- $GITHUB_WORKSPACE
key: repos-<<parameters.extra_repos>>
fetch-verified-codemods:
steps:
- run:
command: |
uv run --frozen python -m tests.shared.codemod.commands fetch-verified-codemods --cli-api-key ${PROD_CLI_API_KEY}
cache-verified-codemod-repos:
steps:
- restore_cache:
keys:
- v1-verified-codemod-repos-{{ checksum "tests/integration/verified_codemods/codemod_data/repo_commits.json" }}-{{.Environment.CIRCLE_NODE_INDEX}}-{{.Environment.CIRCLE_NODE_TOTAL}}
- run:
command: |
uv run --frozen python -m tests.shared.codemod.commands clone-repos --verified-codemod-repos --token ${CODEGEN_BOT_GHE_TOKEN}
- save_cache:
paths:
- $GITHUB_WORKSPACE
key: v1-verified-codemod-repos-{{ checksum "tests/integration/verified_codemods/codemod_data/repo_commits.json" }}-{{.Environment.CIRCLE_NODE_INDEX}}-{{.Environment.CIRCLE_NODE_TOTAL}}
build-wheels:
steps:
- install-uv
Expand Down Expand Up @@ -192,54 +175,6 @@ commands:
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/jobs-steps/#jobs-overview & https://circleci.com/docs/configuration-reference/#jobs
jobs:
unit-tests:
parallelism: 8
executor: default_image
resource_class: "xlarge"
steps:
- setup-uv
- node/install:
use-nvm-cache: true
- run_ats:
default_tests: "tests/unit"
collect_args: --timeout 50
integration-tests:
executor: default_image
resource_class: "large"
steps:
- setup-uv
- run:
command: |
uv run --frozen pytest -o junit_suite_name="${CIRCLE_JOB}" -n auto tests/integration/codegen
- upload-tests
doctests:
executor: default_image
steps:
- setup-uv
- run:
command: |
uv run --frozen pytest -o junit_suite_name="${CIRCLE_JOB}" -n auto docs
- upload-tests
codemod-tests:
parallelism: 8
executor: default_vm
resource_class: "2xlarge+"
steps:
- install-uv
- setup-uv
- fetch-verified-codemods
- cache-verified-codemod-repos
- run_ats:
default_tests: "tests/integration/codemod/test_verified_codemods.py"
codecov_flags: "smart-tests-codemod"
collect_args: --cli-api-key ${PROD_CLI_API_KEY} --token ${CODEGEN_BOT_GHE_TOKEN}
ats_collect_args: --cli-api-key=${PROD_CLI_API_KEY},--token=${CODEGEN_BOT_GHE_TOKEN},
split_tests: false
- slack/notify:
event: fail
branch_pattern: "develop"
channel: "alerts-codemod-tests"
template: basic_fail_1
oss-codemod-tests:
parameters:
sync_graph:
Expand Down Expand Up @@ -372,10 +307,6 @@ jobs:
channel: "release"
template: success_tagged_deploy_1
workflows:
pr_checks:
jobs:
- unit-tests
- integration-tests
publish-packages:
jobs:
- linux-wheels:
Expand Down
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**/expected_diff.txt filter=lfs diff=lfs merge=lfs -text
tests/integration/codemod/repos/extra/*.json filter=lfs diff=lfs merge=lfs -text
**/expected_diff.patch filter=lfs diff=lfs merge=lfs -text
**/test_codegen/expected_diff.patch filter=lfs diff=lfs merge=lfs -text
**/test_codegen/expected_diff.patch.skip filter=lfs diff=lfs merge=lfs -text
tests/integration/codemod/repos/repos.json filter=lfs diff=lfs merge=lfs -text
tests/integration/verified_codemods/** filter=lfs diff=lfs merge=lfs -text
.github/disallowed-words.txt filter=lfs diff=lfs merge=lfs -text
27 changes: 27 additions & 0 deletions .github/actions/report/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: report
description: "Publish Test Reports"
inputs:
flag:
required: true
description: "Relevant codecov flag"
codecov_token:
required: true
description: "Codecov token"
runs:
using: "composite"
steps:
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ inputs.codecov_token }}
files: build/test-results/test/TEST.xml
- name: Upload coverage reports to Codecov
if: (success() || failure()) # always upload coverage reports even if the tests fail
continue-on-error: true
uses: codecov/[email protected]
with:
token: ${{ inputs.codecov_token }}
files: coverage.xml
flags: ${{ inputs.flag }}
plugins: pycoverage,compress-pycoverage
61 changes: 61 additions & 0 deletions .github/actions/run_ats/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: 'Run ATS'
description: 'Run Automated Test Selection to determine which tests to run'

inputs:
default_tests:
description: 'Default test path to run'
required: true
codecov_static_token:
description: 'Codecov static token'
required: true
codecov_token:
description: 'Codecov token'
required: true
collect_args:
description: 'Additional arguments for test collection'
required: false
default: ''
ats_collect_args:
description: 'Additional arguments for ATS collection'
required: false
default: ''
codecov_flags:
description: 'Flags for codecov upload'
required: false
default: 'smart-tests'

runs:
using: "composite"
steps:
- name: Run ATS
shell: bash
env:
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
DEFAULT_TESTS: ${{ inputs.default_tests }}
CODECOV_STATIC_TOKEN: ${{ inputs.codecov_static_token }}
CODECOV_TOKEN: ${{ inputs.codecov_token }}
COLLECT_ARGS: ${{ inputs.collect_args }}
ATS_COLLECT_ARGS: ${{ inputs.ats_collect_args }}
run: |
uv run codecovcli create-commit -t ${{ inputs.codecov_token }}
uv run codecovcli create-report -t ${{ inputs.codecov_token }}
bash ./.circleci/ats.sh

- name: Run tests
shell: bash
run: |
echo "pwd: $(pwd)" # FIXME: for debugging
TESTS_TO_RUN=$(cat codecov_ats/tests_to_run.txt)
echo $TESTS_TO_RUN | xargs uv run pytest --cov \
-o junit_suite_name="${{ github.job }}" \
-n auto \
-vv \
--cov \
--cov-append \
--cov-report=xml \
${{ inputs.collect_args }}

- uses: ./.github/actions/report
with:
flag: ${{ inputs.codecov_flags }}
codecov_token: ${{ inputs.codecov_token }}
3 changes: 2 additions & 1 deletion .github/actions/setup-backend/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ runs:
enable-cache: true
prune-cache: false
python-version: ${{ inputs.python-version }}
version: '0.5.20'
version: '0.5.24'
cache-suffix: ${{inputs.python-version}}
- name: Install dependencies
shell: bash
Expand All @@ -31,6 +31,7 @@ runs:
shell: bash
run: |
uv tool install codecov-cli --python 3.10
uv tool update-shell
# - name: Configure AWS Credentials
# if: env.skip == '1'
# uses: aws-actions/configure-aws-credentials@v2
Expand Down
23 changes: 23 additions & 0 deletions .github/actions/setup-oss-repos/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
name: "Setup OSS repos"
description: "Setup OSS repos"
# TODO: add size filter
runs:
using: "composite"
steps:
- name: Cache oss-repos
id: cache-oss-repos
uses: actions/cache@v4
with:
path: oss_repos
key: ${{ runner.os }}-repo-cache-2-${{hashFiles('codegen-backend/codegen_tests/graph_sitter/codemod/repos/open_source/*.json')}}
- name: Populate oss-repos if the cache is empty
if: steps.cache-oss-repos.outputs.cache-hit != 'true'
shell: bash
run: |
uv run --frozen python -m tests.shared.codemod.commands clone-repos --clean-cache
env:
GITHUB_WORKSPACE: $GITHUB_WORKSPACE
- name: Verify cache contents
shell: bash
run: ls -la $GITHUB_WORKSPACE/oss_repos/
6 changes: 6 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ flag_management:
statuses:
- type: 'project'
- type: 'patch'
- name: smart-tests-integration-tests
carryforward: true
carryforward_mode: 'labels'
statuses:
- type: 'project'
- type: 'patch'
comment:
layout: "condensed_header, condensed_files"
hide_project_coverage: true
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Mypy Checks

on:
pull_request:
branches:
- "develop"

concurrency:
group: ${{ github.workflow_ref }}-${{ github.ref }}
cancel-in-progress: true

jobs:
mypy:
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]

- name: Filter Python files
id: filter-python
run: |
python_files=()
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ $file == *.py ]]; then
python_files+=("${file}")
fi
done
echo "python_files=${python_files[*]}" >> $GITHUB_ENV

- name: Add MyPy annotator
uses: pr-annotators/[email protected]

- name: Run mypy
if: ${{ env.python_files != '' }}
run: |
echo "Running mypy on changed files: ${{ env.python_files }}"
uv run mypy --no-pretty --show-absolute-path ${{ env.python_files }}
22 changes: 11 additions & 11 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
pull_request:
branches:
- "develop"
push:
branches:
- "develop"

jobs:
pre-commit:
Expand All @@ -23,26 +26,23 @@ jobs:
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
restore-keys: pre-commit
- 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 }}
shell: bash
env:
SKIP: disallowed-words-check
SKIP: disallowed-words-check,circleci_validate

# 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"
- 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
Loading