-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5519 from alexv-smirnov/bumpwf-stable-24-1
bumpwf stable 24 1
- Loading branch information
Showing
17 changed files
with
522 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
name: Ya-Build-and-Test | ||
inputs: | ||
build_target: | ||
type: string | ||
default: "ydb/" | ||
description: "limit build and test to specific target" | ||
build_preset: | ||
type: string | ||
run_build: | ||
type: boolean | ||
default: true | ||
description: "run build" | ||
run_tests: | ||
type: boolean | ||
default: true | ||
description: "run tests" | ||
run_tests_if_build_fails: | ||
default: "true" | ||
description: "run tests if build fails" | ||
test_threads: | ||
type: string | ||
default: 28 | ||
description: "Test threads count" | ||
link_threads: | ||
type: string | ||
default: 8 | ||
description: "link threads count" | ||
test_size: | ||
type: string | ||
default: "small,medium,large" | ||
test_type: | ||
type: string | ||
default: "unittest,py3test,py2test,pytest" | ||
increment: | ||
type: boolean | ||
required: true | ||
description: If true, compares build graphs between the current and previous commits to find a list of test suites to run. Otherwise, runs all tests. | ||
folder_prefix: | ||
type: string | ||
default: "ya-" | ||
put_build_results_to_cache: | ||
type: boolean | ||
default: true | ||
secs: | ||
type: string | ||
default: "" | ||
vars: | ||
type: string | ||
default: "" | ||
defaults: | ||
run: | ||
shell: bash | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: comment-build-start | ||
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' | ||
shell: bash | ||
env: | ||
BUILD_PRESET: ${{ inputs.build_preset }} | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: | | ||
jobs_url="https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs" | ||
# tricky: we are searching job with name that contains build_preset | ||
check_url=$(curl -s $jobs_url | jq --arg n "$BUILD_PRESET" -r '.jobs[] | select(.name | contains($n)) | .html_url') | ||
echo "Pre-commit [check]($check_url) for $(git rev-parse HEAD) has started." | .github/scripts/tests/comment-pr.py --rewrite | ||
- name: Prepare s3cmd | ||
uses: ./.github/actions/s3cmd | ||
with: | ||
s3_bucket: ${{ fromJSON( inputs.vars ).AWS_BUCKET }} | ||
s3_endpoint: ${{ fromJSON( inputs.vars ).AWS_ENDPOINT }} | ||
s3_key_id: ${{ fromJSON( inputs.secs ).AWS_KEY_ID }} | ||
s3_key_secret: ${{ fromJSON( inputs.secs ).AWS_KEY_VALUE }} | ||
folder_prefix: ya- | ||
build_preset: ${{ inputs.build_preset }} | ||
|
||
- name: Build | ||
uses: ./.github/actions/build_ya | ||
id: build | ||
if: ${{ inputs.run_build == 'true' }} | ||
with: | ||
build_target: ${{ inputs.build_target }} | ||
build_preset: ${{ inputs.build_preset }} | ||
bazel_remote_uri: ${{ fromJSON( inputs.vars ).REMOTE_CACHE_URL || '' }} | ||
bazel_remote_username: ${{ inputs.put_build_results_to_cache && fromJSON( inputs.secs ).REMOTE_CACHE_USERNAME || '' }} | ||
bazel_remote_password: ${{ inputs.put_build_results_to_cache && fromJSON( inputs.secs ).REMOTE_CACHE_PASSWORD || '' }} | ||
link_threads: ${{ inputs.link_threads }} | ||
|
||
- name: Generate ya.make with affected test suites list | ||
if: inputs.run_tests == 'true' && inputs.increment == 'true' | ||
uses: ./.github/actions/graph_compare | ||
|
||
- name: Check if there's a list of tests to run | ||
id: test_run_choice | ||
shell: bash | ||
run: | | ||
if [ -f ya.make ];then | ||
echo "target='.'" >> $GITHUB_OUTPUT | ||
echo "Listed test targets: " | ||
cat ya.make | ||
else | ||
echo "target=${{ inputs.build_target }}" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Run tests | ||
uses: ./.github/actions/test_ya | ||
if: ${{ inputs.run_tests == 'true' && (steps.build.outputs.success == 'true' || inputs.run_tests_if_build_fails == 'true') }} | ||
with: | ||
build_target: ${{ steps.test_run_choice.outputs.target }} | ||
build_preset: ${{ inputs.build_preset }} | ||
test_size: ${{ inputs.test_size }} | ||
testman_token: ${{ fromJSON( inputs.secs ).TESTMO_TOKEN }} | ||
testman_url: ${{ fromJSON( inputs.vars ).TESTMO_URL }} | ||
testman_project_id: ${{ fromJSON( inputs.vars ).TESTMO_PROJECT_ID }} | ||
link_threads: ${{ inputs.link_threads }} | ||
test_threads: ${{ inputs.test_threads }} | ||
|
||
- name: Notify about failed build | ||
if: ${{ steps.build.outputs.success != 'true' && inputs.run_tests == 'true' && inputs.run_tests_if_build_fails == 'false' }} | ||
shell: bash | ||
run: | | ||
echo 'Build failed. See the [build log](${{ steps.build.outputs.log_url }}).' >> $GITHUB_STEP_SUMMARY | ||
if [[ "$GITHUB_EVENT_NAME" =~ ^pull_request ]]; then | ||
echo "Tests run skipped." | .github/scripts/tests/comment-pr.py --fail | ||
fi | ||
exit 1 | ||
- name: comment-if-cancel | ||
shell: bash | ||
if: cancelled() && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') | ||
env: | ||
BUILD_PRESET: ${{ inputs.build_preset }} | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: echo "Check cancelled" | .github/scripts/tests/comment-pr.py --color black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: graph_compare | ||
description: Compare graphs between current and previous commits (merge commit base in case of a merge commit), and list affected tests in ya.make | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: original_ref | ||
id: oref | ||
shell: bash | ||
run: | | ||
echo "value=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | ||
- name: generate_ya_make | ||
shell: bash | ||
run: | | ||
./.github/scripts/graph_compare.sh ${{ steps.oref.outputs.value }}~1 ${{ steps.oref.outputs.value }} | ||
- name: restore_ref | ||
shell: bash | ||
run: | | ||
git checkout ${{ steps.oref.outputs.value }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.