From b3adf9c462fe586e3c9a03b34e7f0d8c8ccecf25 Mon Sep 17 00:00:00 2001 From: Gokhan Gulbiz Date: Mon, 7 Aug 2023 15:47:22 +0300 Subject: [PATCH] Reorganize env variables and inputs. --- .github/actions/configure/action.yml | 3 +- .github/actions/install_extension/action.yml | 4 +- .github/actions/parallelization/action.yml | 23 +++++ .../actions/save_logs_and_results/action.yml | 37 +++++++- .github/actions/save_regressions/action.yml | 9 +- .github/workflows/flaky_test_debugging.yml | 89 ++++++++++++------- ci/build-citus.sh | 5 +- 7 files changed, 131 insertions(+), 39 deletions(-) create mode 100644 .github/actions/parallelization/action.yml diff --git a/.github/actions/configure/action.yml b/.github/actions/configure/action.yml index 03f4e4f5f..7fa5924fb 100644 --- a/.github/actions/configure/action.yml +++ b/.github/actions/configure/action.yml @@ -5,5 +5,6 @@ runs: - name: Configure run: |- chown -R circleci . + git config --global --add safe.directory ${GITHUB_WORKSPACE} gosu circleci ./configure --without-pg-version-check - shell: bash \ No newline at end of file + shell: bash diff --git a/.github/actions/install_extension/action.yml b/.github/actions/install_extension/action.yml index df7ee7fd5..f85bf332b 100644 --- a/.github/actions/install_extension/action.yml +++ b/.github/actions/install_extension/action.yml @@ -6,5 +6,5 @@ runs: using: composite steps: - name: Install Extension - run: tar xfv "${{ github.workspace }}/install-${{ inputs.pg_major }}.tar" --directory / - shell: bash \ No newline at end of file + run: tar xfv "artifact/install-${{ inputs.pg_major }}.tar" --directory / + shell: bash diff --git a/.github/actions/parallelization/action.yml b/.github/actions/parallelization/action.yml new file mode 100644 index 000000000..1f7d00202 --- /dev/null +++ b/.github/actions/parallelization/action.yml @@ -0,0 +1,23 @@ +name: 'Parallelization matrix' +inputs: + count: + required: false + default: 32 +outputs: + json: + value: ${{ steps.generate_matrix.outputs.json }} +runs: + using: "composite" + steps: + - name: Generate parallelization matrix + id: generate_matrix + shell: bash + run: |- + json_array="{\"include\": [" + for ((i = 1; i <= ${{ inputs.count }}; i++)); do + json_array+="{\"id\":\"$i\"}," + done + json_array=${json_array%,} + json_array+=" ]}" + echo "json=$json_array" >> "$GITHUB_OUTPUT" + echo "json=$json_array" diff --git a/.github/actions/save_logs_and_results/action.yml b/.github/actions/save_logs_and_results/action.yml index 238eaacce..ad37a7a0f 100644 --- a/.github/actions/save_logs_and_results/action.yml +++ b/.github/actions/save_logs_and_results/action.yml @@ -3,17 +3,52 @@ runs: using: composite steps: - uses: actions/upload-artifact@v3.1.1 + if: ${{ matrix.id == '' }} with: + name: proxy.output path: src/test/regress/proxy.output - uses: actions/upload-artifact@v3.1.1 + if: ${{ matrix.id == '' }} with: + name: regress path: src/test/regress/results/ - uses: actions/upload-artifact@v3.1.1 + if: ${{ matrix.id == '' }} with: + name: master.log path: src/test/regress/tmp_check/master/log - uses: actions/upload-artifact@v3.1.1 + if: ${{ matrix.id == '' }} with: + name: worker.57637.log path: src/test/regress/tmp_check/worker.57637/log - uses: actions/upload-artifact@v3.1.1 + if: ${{ matrix.id == '' }} with: - path: src/test/regress/tmp_check/worker.57638/log \ No newline at end of file + name: worker.57638.log + path: src/test/regress/tmp_check/worker.57638/log + - uses: actions/upload-artifact@v3.1.1 + if: ${{ matrix.id != '' }} + with: + name: proxy_${{ matrix.id }}.output + path: src/test/regress/proxy.output + - uses: actions/upload-artifact@v3.1.1 + if: ${{ matrix.id != '' }} + with: + name: regress_${{ matrix.id }} + path: src/test/regress/results/ + - uses: actions/upload-artifact@v3.1.1 + if: ${{ matrix.id != '' }} + with: + name: master_${{ matrix.id }}.log + path: src/test/regress/tmp_check/master/log + - uses: actions/upload-artifact@v3.1.1 + if: ${{ matrix.id != '' }} + with: + name: worker_${{ matrix.id }}.57637.log + path: src/test/regress/tmp_check/worker.57637/log + - uses: actions/upload-artifact@v3.1.1 + if: ${{ matrix.id != '' }} + with: + name: worker_${{ matrix.id }}.57638.log + path: src/test/regress/tmp_check/worker.57638/log diff --git a/.github/actions/save_regressions/action.yml b/.github/actions/save_regressions/action.yml index 03b5a759c..718cbffc4 100644 --- a/.github/actions/save_regressions/action.yml +++ b/.github/actions/save_regressions/action.yml @@ -11,5 +11,12 @@ runs: if: failure() shell: bash - uses: actions/upload-artifact@v3.1.1 + if: ${{ matrix.id == '' }} with: - path: src/test/regress/regression.diffs \ No newline at end of file + name: regression.diffs + path: src/test/regress/regression.diffs + - uses: actions/upload-artifact@v3.1.1 + if: ${{ matrix.id != '' }} + with: + path: src/test/regress/regression.diffs + name: regression_${{ matrix.id }}.diffs diff --git a/.github/workflows/flaky_test_debugging.yml b/.github/workflows/flaky_test_debugging.yml index 146652d67..5b091cd33 100644 --- a/.github/workflows/flaky_test_debugging.yml +++ b/.github/workflows/flaky_test_debugging.yml @@ -1,38 +1,49 @@ -name: citusdata/citus/flaky_test_debugging +name: Flaky test detector +run-name: Flaky test detector - ${{ inputs.flaky_test }} (${{ inputs.flaky_test_runs_per_job }}x${{ inputs.flaky_test_parallel_jobs }}) on: workflow_dispatch: inputs: flaky_test: required: true + type: string + description: Test to run flaky_test_runs_per_job: required: false - default: 50 + default: 8 type: number - image_suffix: + description: Number of times to run the test + flaky_test_parallel_jobs: required: false - default: "-vbab548a" - pg14_version: - required: false - default: '14.8' - pg15_version: - required: false - default: '15.3' - upgrade_pg_versions: - required: false - default: 14.8-15.3 - style_checker_tools_version: - required: false - default: 0.8.18 + default: 32 + type: number + description: Number of parallel jobs to run +env: + pg_major: 15 + image_suffix: -v1b94240 + pg15_version: 15.4 + build_image_name: citus/extbuilder + test_image_name: citus/failtester jobs: - build: - if: ${{ inputs.flaky_test }} + set_image_names: + name: Set CI image names runs-on: ubuntu-latest + outputs: + build_image: ${{ steps.set_build_image_name.outputs.image }} + test_image: ${{ steps.set_test_image_name.outputs.image }} + steps: + - id: set_build_image_name + run: | + echo "image=${{ env.build_image_name }}:${{ env.pg15_version }}${{ env.image_suffix }}" >> "$GITHUB_OUTPUT" + - id: set_test_image_name + run: | + echo "image=${{ env.test_image_name }}:${{ env.pg15_version }}${{ env.image_suffix }}" >> "$GITHUB_OUTPUT" + build: + name: Build Citus + runs-on: ubuntu-latest + needs: set_image_names container: - image: "${{ vars.image }}" - env: - pg_major: 15 - image: citus/extbuilder - image_tag: "${{ inputs.pg15_version }}" + image: ${{ needs.set_image_names.outputs.build_image }} + options: --user root steps: - uses: actions/checkout@v3.5.0 - name: Configure, Build, and Install @@ -42,20 +53,33 @@ jobs: path: |- ./build-${{ env.pg_major }}/* ./install-${{ env.pg_major }}.tar - test-flakyness: + prepare_parallelization_matrix: + name: Prepare parallelization matrix + runs-on: ubuntu-latest + outputs: + json: ${{ steps.parallelization.outputs.json }} + steps: + - uses: actions/checkout@v3.5.0 + - uses: "./.github/actions/parallelization" + id: parallelization + with: + count: ${{ inputs.flaky_test_parallel_jobs }} + test_flakyness: + name: Test flakyness if: ${{ inputs.flaky_test }} runs-on: ubuntu-latest container: - image: '${{ vars.image }}:${{ vars.image_tag }}${{ vars.image_suffix }}' + image: ${{ needs.set_image_names.outputs.test_image }} + options: --user root needs: - - build + [set_image_names, build, prepare_parallelization_matrix] env: - pg_major: 15 - image: citus/failtester - image_tag: "${{ inputs.pg15_version }}" test: "${{ inputs.flaky_test }}" runs: "${{ inputs.flaky_test_runs_per_job }}" skip: false + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.prepare_parallelization_matrix.outputs.json) }} steps: - uses: actions/checkout@v3.5.0 - uses: actions/download-artifact@v3.0.1 @@ -73,7 +97,8 @@ jobs: fi if [ -z "$tests" ]; then echo "No test found." - circleci-agent step halt + gh run cancel ${{ github.run_id }} + gh run watch ${{ github.run_id }} else echo "Detected tests " $tests fi @@ -91,6 +116,10 @@ jobs: test_name=$(echo "$test" | sed -r "s/.+\/(.+)\..+/\1/") gosu circleci src/test/regress/citus_tests/run_test.py $test_name --repeat ${{ env.runs }} --use-base-schedule --use-whole-schedule-line done + shell: bash - uses: "./.github/actions/save_logs_and_results" + if: always() - uses: "./.github/actions/save_regressions" + if: always() - uses: "./.github/actions/stack_trace" + if: always() diff --git a/ci/build-citus.sh b/ci/build-citus.sh index 49f92e691..678fd515c 100755 --- a/ci/build-citus.sh +++ b/ci/build-citus.sh @@ -15,9 +15,6 @@ PG_MAJOR=${PG_MAJOR:?please provide the postgres major version} codename=${VERSION#*(} codename=${codename%)*} -# get project from argument -project="${CIRCLE_PROJECT_REPONAME}" - # we'll do everything with absolute paths basedir="$(pwd)" @@ -28,7 +25,7 @@ build_ext() { pg_major="$1" builddir="${basedir}/build-${pg_major}" - echo "Beginning build of ${project} for PostgreSQL ${pg_major}..." >&2 + echo "Beginning build for PostgreSQL ${pg_major}..." >&2 # do everything in a subdirectory to avoid clutter in current directory mkdir -p "${builddir}" && cd "${builddir}"