From 0555c7db24e936c1d359ead9087d2e24b9229d84 Mon Sep 17 00:00:00 2001 From: Nikita Menkovich Date: Thu, 4 Apr 2024 13:06:55 +0200 Subject: [PATCH] feature: add ability to run asan/tsan builds on top of regular one + fix grammar/spelling errors in docs (#881) * feature: add ability to run asan/tsan builds on top of regular one * chore: fix grammar mistakes --- .../workflows/build_and_test_on_demand.yaml | 13 ++++--- .github/workflows/pr.yaml | 38 +++++++++++++++++++ GITHUB.md | 17 +++++---- 3 files changed, 55 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build_and_test_on_demand.yaml b/.github/workflows/build_and_test_on_demand.yaml index a849d31a8f..4da1e8d370 100644 --- a/.github/workflows/build_and_test_on_demand.yaml +++ b/.github/workflows/build_and_test_on_demand.yaml @@ -66,6 +66,9 @@ on: build_preset: type: string default: "relwithdebinfo" + vm_name_suffix: + type: string + default: "" test_size: type: string default: "small,medium,large" @@ -101,7 +104,7 @@ on: jobs: provide-runner: - name: Start self-hosted runner + name: Start self-hosted runner (${{ inputs.build_preset }}) timeout-minutes: 60 if: always() runs-on: ubuntu-latest @@ -142,7 +145,7 @@ jobs: service_account_key: ${{ secrets.NEBIUS_SA_JSON_CREDENTIALS }} token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} vm_folder: bjeuq5o166dq4ukv3eec - vm_name: ${{ github.event.pull_request.number && format('pr-{0}', github.event.pull_request.number) || format('run-{0}-{1}', github.run_id, github.run_attempt) }} + vm_name: ${{ github.event.pull_request.number && format('pr-{0}{1}', github.event.pull_request.number, inputs.vm_name_suffix) || format('run-{0}-{1}', github.run_id, github.run_attempt) }} vm_zone: eu-north1-c vm_cpu: 60 vm_memory: 240 @@ -155,7 +158,7 @@ jobs: prepare-vm: - name: Prepare runner [id=${{ needs.provide-runner.outputs.instance-id }} local_ip=${{ needs.provide-runner.outputs.runner_local_ipv4 }} ip=${{ needs.provide-runner.outputs.runner_ipv4 }}] + name: Prepare runner (${{ inputs.build_preset }}) [id=${{ needs.provide-runner.outputs.instance-id }} local_ip=${{ needs.provide-runner.outputs.runner_local_ipv4 }} ip=${{ needs.provide-runner.outputs.runner_ipv4 }}] needs: provide-runner runs-on: [ self-hosted, "${{ needs.provide-runner.outputs.label }}" ] steps: @@ -181,7 +184,7 @@ jobs: uses: ./.github/actions/prepare build-and-test: - name: Build and test NBS [id=${{ needs.provide-runner.outputs.instance-id }} local_ip=${{ needs.provide-runner.outputs.runner_local_ipv4 }} ip=${{ needs.provide-runner.outputs.runner_ipv4 }}] + name: Build and test NBS (${{ inputs.build_preset }}) [id=${{ needs.provide-runner.outputs.instance-id }} local_ip=${{ needs.provide-runner.outputs.runner_local_ipv4 }} ip=${{ needs.provide-runner.outputs.runner_ipv4 }}] uses: ./.github/workflows/build_and_test_ya.yaml needs: - provide-runner @@ -219,7 +222,7 @@ jobs: run: sleep ${{ needs.build-and-test.outputs.sleep_after_tests }} release-runner: - name: Release self-hosted runner [id=${{ needs.provide-runner.outputs.instance-id }} local_ip=${{ needs.provide-runner.outputs.runner_local_ipv4 }} ip=${{ needs.provide-runner.outputs.runner_ipv4 }}] + name: Release self-hosted runner (${{ inputs.build_preset }}) [id=${{ needs.provide-runner.outputs.instance-id }} local_ip=${{ needs.provide-runner.outputs.runner_local_ipv4 }} ip=${{ needs.provide-runner.outputs.runner_ipv4 }}] needs: - provide-runner # required to get output from the start-runner job - build-and-test # required to wait when the main job is done diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 04a1bf92a7..b7c0b8a193 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -171,3 +171,41 @@ jobs: cache_update_tests: false sleep_after_tests: ${{ contains(github.event.pull_request.labels.*.name, 'sleep') && '7200' || '1' }} secrets: inherit + build_and_test_asan: + needs: + - check-running-allowed + - create-build-and-test-target-var + if: needs.check-running-allowed.outputs.result == 'true' && contains(github.event.pull_request.labels.*.name, 'asan') + name: Build and test (asan) + uses: ./.github/workflows/build_and_test_on_demand.yaml + with: + build_target: ${{ needs.create-build-and-test-target-var.outputs.build_target }} + test_target: ${{ needs.create-build-and-test-target-var.outputs.test_target }} + build_preset: release-asan + vm_name_suffix: "-asan" + test_size: ${{ contains(github.event.pull_request.labels.*.name, 'large-tests') && 'small,medium,large' || 'small,medium' }} + test_type: "unittest,clang_tidy,gtest,py3test,py2test,pytest,flake8,black,py2_flake8,go_test,gofmt" + run_tests: true + cache_update_build: false + cache_update_tests: false + sleep_after_tests: ${{ contains(github.event.pull_request.labels.*.name, 'sleep') && '7200' || '1' }} + secrets: inherit + build_and_test_tsan: + needs: + - check-running-allowed + - create-build-and-test-target-var + if: needs.check-running-allowed.outputs.result == 'true' && contains(github.event.pull_request.labels.*.name, 'tsan') + name: Build and test (tsan) + uses: ./.github/workflows/build_and_test_on_demand.yaml + with: + build_target: ${{ needs.create-build-and-test-target-var.outputs.build_target }} + test_target: ${{ needs.create-build-and-test-target-var.outputs.test_target }} + build_preset: release-tsan + vm_name_suffix: "-tsan" + test_size: ${{ contains(github.event.pull_request.labels.*.name, 'large-tests') && 'small,medium,large' || 'small,medium' }} + test_type: "unittest,clang_tidy,gtest,py3test,py2test,pytest,flake8,black,py2_flake8,go_test,gofmt" + run_tests: true + cache_update_build: false + cache_update_tests: false + sleep_after_tests: ${{ contains(github.event.pull_request.labels.*.name, 'sleep') && '7200' || '1' }} + secrets: inherit diff --git a/GITHUB.md b/GITHUB.md index 3409018075..6d95f199b9 100644 --- a/GITHUB.md +++ b/GITHUB.md @@ -7,28 +7,29 @@ There is also a list of labels that slightly alters how and which tests are run: 1. `large-tests` to launch large tests in PR. By default, we launch small and medium. 2. `blockstore`, `filestore`, `disk_manager`, and `tasks` to launch test ONLY for specified projects. You can specify more than one label. 3. `sleep` to add 7200s (2 hours) sleep to your run, if you want to debug it. +4. `asan` or `tsan` to add address sanitizer or thread sanitizer builds on top of the regular build. -Also, you can launch [ya make](https://github.com/ydb-platform/nbs/actions/workflows/build_and_test_on_demand.yaml) or [cmake](https://github.com/ydb-platform/nbs/actions/workflows/build_and_test_on_demand_cmake.yaml) builds on your branch with any timeout you want (but please do not do more than 12h, VMs are expensive). You can find the IP of the VM inside of the jobs. The first occurrence happens in the `Prepare runner` job in the `Configure NCP` step, later IP is set in the header of jobs. You must use your GitHub key for it. User `github`. Feature not available for non-members. +Also, you can launch [ya make](https://github.com/ydb-platform/nbs/actions/workflows/build_and_test_on_demand.yaml) or [cmake](https://github.com/ydb-platform/nbs/actions/workflows/build_and_test_on_demand_cmake.yaml) builds on your branch with any timeout you want (but please do not do more than 12 hours, VMs are expensive). You can find the IP of the VM inside of the jobs. The first occurrence happens in the `Prepare runner` job in the `Configure NCP` step, later IP is set in the header of jobs. You must use your GitHub key for it. User `github`. Feature not available for non-members. All build and test workflows provide some level of debug info available on our s3 website. -Example URL for the top-level directory is like this: https://github-actions-s3.website.nemax.nebius.cloud/ydb-platform/nbs/PR-check/8103221450/1/nebius-x86-64/ +The example URL for the top-level directory is like this: https://github-actions-s3.website.nemax.nebius.cloud/ydb-platform/nbs/PR-check/8103221450/1/nebius-x86-64/ -* `ydb-platform` - name of the organisation +* `ydb-platform` - name of the organization * `nbs` - name of the repo * `PR-check` - ID of the workflow * `8103221450` - ID of the workflow run (you can look it up in the `Actions` tab in your PR) -* `1` - number of the runs, if you restart workflow this number will increase. -* `nebius-x86-64` - nebius is the prefix and x86-64 an architecture, there also can be one of the suffixes: `-debug`, `-asan`,`-tsan` if you choose to build with debugging symbols or sanitizers. +* `1` - number of runs, if you restart the workflow this number will increase. +* `nebius-x86-64` - nebius is the prefix and x86-64 is an architecture, there also can be one of the suffixes: `-debug`, `-asan`,`-tsan` if you choose to build with debugging symbols or sanitizers. -For new runs, we generate index.html files only for the top level directories, not for directories lower. And every night we regenerate index files for the whole s3 bucket. +For new runs, we generate index.html files only for the top-level directories, not for directories lower. And every night we regenerate index files for the whole s3 bucket. -On the top level, you can expect adirectory structure like this: +On the top level, you can expect a directory structure like this: * `build_logs/` - well, ya make build logs * `logs/` - log of the tests, short version * `test_logs/` - logs of ya test -* `test_reports/` - junit report, debug data so you can more or less debug what happened during preparation of summary report. +* `test_reports/` - junit report, debug data so you can more or less debug what happened during the preparation of the summary report. * `summary/` - ya-test.html with results of the test run * `test_data/` - all test data except binaries, VM images, and everything like that, that take a lot of space on S3. Stored only for a week, while other directories are stored for a month.