Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine the .circleci/config.yml by using dynamic config #517

Merged
merged 3 commits into from
Mar 30, 2024

Conversation

moonorange
Copy link
Contributor

@moonorange moonorange commented Mar 27, 2024

Description

Attempted to remove repetitive statements in ci by using dynamic config

Encountered problem

Use of setup workflows must be enabled in project settings (Project settings > Advanced -> Dynamic config using setup workflows)

I lack the necessary permissions to modify project settings. However, adjusting this setting is necessary for debugging the CI workflow effectively as I don't have an environment to run this locally.

Related Issue

#482

The Result of the shell script

sh generate_config.sh

version: 2.1
orbs:
  go: circleci/go@1.7.3
jobs:
  build:
    machine:
      image: ubuntu-2204:current
    resource_class: large
    parallelism: 3
    steps:
      - checkout
      - go/install:
          version: 1.21.0
      - run: # test ./go.mod
          name: Test .
          command: |
            list=$(go list ./... | circleci tests split --split-by=timings)
            echo "Test Packages: $list"
            for n in {1..5}; do
              ./dockertest.sh $list && break
            done
          no_output_timeout: 15m
      - run: # test ./mock/go.mod
          name: Test mock
          command: |
            cd "$CIRCLE_WORKING_DIRECTORY/mock"
            list=$(go list ./... | circleci tests split --split-by=timings)
            echo "Test Packages: $list"
            for n in {1..5}; do
              ../dockertest.sh $list && break
            done
          no_output_timeout: 15m
      - run: # test ./om/go.mod
          name: Test om
          command: |
            cd "$CIRCLE_WORKING_DIRECTORY/om"
            list=$(go list ./... | circleci tests split --split-by=timings)
            echo "Test Packages: $list"
            for n in {1..5}; do
              ../dockertest.sh $list && break
            done
          no_output_timeout: 15m
      - run: # test ./rueidisaside/go.mod
          name: Test rueidisaside
          command: |
            cd "$CIRCLE_WORKING_DIRECTORY/rueidisaside"
            list=$(go list ./... | circleci tests split --split-by=timings)
            echo "Test Packages: $list"
            for n in {1..5}; do
              ../dockertest.sh $list && break
            done
          no_output_timeout: 15m
      - run: # test ./rueidiscompat/go.mod
          name: Test rueidiscompat
          command: |
            cd "$CIRCLE_WORKING_DIRECTORY/rueidiscompat"
            list=$(go list ./... | circleci tests split --split-by=timings)
            echo "Test Packages: $list"
            for n in {1..5}; do
              ../dockertest.sh $list && break
            done
          no_output_timeout: 15m
      - run: # test ./rueidishook/go.mod
          name: Test rueidishook
          command: |
            cd "$CIRCLE_WORKING_DIRECTORY/rueidishook"
            list=$(go list ./... | circleci tests split --split-by=timings)
            echo "Test Packages: $list"
            for n in {1..5}; do
              ../dockertest.sh $list && break
            done
          no_output_timeout: 15m
      - run: # test ./rueidisotel/go.mod
          name: Test rueidisotel
          command: |
            cd "$CIRCLE_WORKING_DIRECTORY/rueidisotel"
            list=$(go list ./... | circleci tests split --split-by=timings)
            echo "Test Packages: $list"
            for n in {1..5}; do
              ../dockertest.sh $list && break
            done
          no_output_timeout: 15m
      - run: # test ./rueidisprob/go.mod
          name: Test rueidisprob
          command: |
            cd "$CIRCLE_WORKING_DIRECTORY/rueidisprob"
            list=$(go list ./... | circleci tests split --split-by=timings)
            echo "Test Packages: $list"
            for n in {1..5}; do
              ../dockertest.sh $list && break
            done
          no_output_timeout: 15m
      - store_test_results:
          path: .
      - run: curl -Os https://uploader.codecov.io/latest/linux/codecov && chmod +x codecov && ./codecov -t
     ```

Signed-off-by: moonorange <monoma632@gmail.com>
@moonorange moonorange changed the title feat: update circle ci to use dynamic config [WIP] Refine the .circleci/config.yml by using dynamic config Mar 27, 2024
list=\$(go list ./... | circleci tests split --split-by=timings)
echo "Test Packages: \$list"
for n in {1..5}; do
../dockertest.sh \$list && break
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need special handling here for the root module. The root module should use ./dockertest.sh instead of ../dockertest.sh.

@moonorange moonorange force-pushed the improve_circle_ci_test branch 6 times, most recently from e316773 to 8c17358 Compare March 28, 2024 00:57
Signed-off-by: moonorange <monoma632@gmail.com>
@moonorange moonorange force-pushed the improve_circle_ci_test branch from 8c17358 to 4455e48 Compare March 28, 2024 01:01
@codecov-commenter
Copy link

codecov-commenter commented Mar 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.60%. Comparing base (87afcd2) to head (2e9c449).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #517      +/-   ##
==========================================
+ Coverage   95.57%   95.60%   +0.03%     
==========================================
  Files          80       80              
  Lines       33178    33178              
==========================================
+ Hits        31710    31720      +10     
+ Misses       1267     1258       -9     
+ Partials      201      200       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@moonorange moonorange changed the title [WIP] Refine the .circleci/config.yml by using dynamic config Refine the .circleci/config.yml by using dynamic config Mar 28, 2024
@moonorange moonorange marked this pull request as ready for review March 28, 2024 01:22
@moonorange moonorange requested a review from rueian March 28, 2024 01:24
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @moonorange! LGTM and is it possible to move the generate_config.sh to the .circleci folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rueian Thank you for the quick review!
Moved the generate_config.sh to the .circleci folder

2e9c449

Signed-off-by: moonorange <monoma632@gmail.com>
@moonorange moonorange force-pushed the improve_circle_ci_test branch from 78d6697 to 2e9c449 Compare March 28, 2024 16:46
@rueian rueian merged commit a74b679 into redis:main Mar 30, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants