diff --git a/.github/actions/consul-start/action.yml b/.github/actions/consul-start/action.yml new file mode 100644 index 0000000..f627212 --- /dev/null +++ b/.github/actions/consul-start/action.yml @@ -0,0 +1,13 @@ +name: "Start Consul" +runs: + using: "composite" + steps: + - uses: nahsi/setup-hashi-tool@v1 + if: github.repository == 'ordo-one/package-consul' || github.repository == 'ordo-one/package-distributed-system' + with: + name: consul + - name: Start consul + if: github.repository == 'ordo-one/package-consul' || github.repository == 'ordo-one/package-distributed-system' + shell: bash + run: | + consul agent -dev -log-level=warn & diff --git a/.github/workflows/semantic-release.yml b/.github/workflows/semantic-release.yml index 212452e..6050415 100644 --- a/.github/workflows/semantic-release.yml +++ b/.github/workflows/semantic-release.yml @@ -9,7 +9,7 @@ jobs: semantic-release: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -52,14 +52,14 @@ jobs: failTitle: false" > .releaserc.yml - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: "lts/*" + node-version: '20' - name: Install semantic-release run: | - npm install semantic-release conventional-changelog-conventionalcommits -D - + npm install semantic-release@v24 conventional-changelog-conventionalcommits@v8 -D + npm list - name: Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/swift-benchmark-delta.yml b/.github/workflows/swift-benchmark-delta.yml index e724c5e..b840196 100644 --- a/.github/workflows/swift-benchmark-delta.yml +++ b/.github/workflows/swift-benchmark-delta.yml @@ -7,41 +7,41 @@ on: jobs: benchmark-delta: - + timeout-minutes: 30 runs-on: ${{ matrix.os }} - continue-on-error: true strategy: matrix: - #os: [[Linux, benchmark-swift-latest, self-hosted]] os: [ubuntu-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Homebrew Mac if: ${{ runner.os == 'Macos' }} run: | echo "/opt/homebrew/bin:/usr/local/bin" >> $GITHUB_PATH brew install jemalloc - - name: Ubuntu deps if: ${{ runner.os == 'Linux' }} run: | sudo apt-get install -y libjemalloc-dev - + - name: Start consul + uses: ./.github/actions/consul-start - name: Git URL token override and misc run: | #git config --global url."https://ordo-ci:${{ secrets.CI_MACHINE_PAT }}@github.com".insteadOf "https://github.com" #/usr/bin/ordo-performance [ -d Benchmarks ] && echo "hasBenchmark=1" >> $GITHUB_ENV + [ -f Benchmarks/Package.swift ] && echo "BENCHMARK_PACKAGE_PATH=--package-path Benchmarks" >> $GITHUB_ENV + echo "BENCHMARK_RUN_URL=https://github.com/ordo-one/${{ github.event.repository.name }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV echo "/opt/homebrew/bin:/usr/local/bin" >> $GITHUB_PATH - name: Run benchmarks for PR branch if: ${{ env.hasBenchmark == '1' }} run: | - swift package --allow-writing-to-directory .benchmarkBaselines/ benchmark baseline update pull_request --no-progress --quiet + echo "exitStatus=1" >> $GITHUB_ENV + swift package ${BENCHMARK_PACKAGE_PATH} --disable-sandbox benchmark baseline update pull_request --no-progress - name: Switch to branch 'main' if: ${{ env.hasBenchmark == '1' }} run: | @@ -50,39 +50,52 @@ jobs: - name: Run benchmarks for branch 'main' if: ${{ env.hasBenchmark == '1' }} run: | - swift package --allow-writing-to-directory .benchmarkBaselines/ benchmark baseline update main --no-progress --quiet + swift package ${BENCHMARK_PACKAGE_PATH} --disable-sandbox benchmark baseline update main --no-progress - name: Compare PR and main if: ${{ env.hasBenchmark == '1' }} id: benchmark + continue-on-error: true run: | echo $(date) >> $GITHUB_STEP_SUMMARY - echo "exitStatus=1" >> $GITHUB_ENV - swift package benchmark baseline check main pull_request --format markdown >> $GITHUB_STEP_SUMMARY - echo "exitStatus=0" >> $GITHUB_ENV - continue-on-error: true + swift package ${BENCHMARK_PACKAGE_PATH} benchmark baseline check main pull_request --format markdown >> $GITHUB_STEP_SUMMARY + echo "exitStatus=$?" >> $GITHUB_ENV - if: ${{ env.exitStatus == '0' }} - name: Pull request comment text success - id: prtestsuccess + name: Pull request comment text same run: | - echo 'PRTEST<> $GITHUB_ENV - echo "[Pull request benchmark comparison [${{ matrix.os }}] with 'main' run at $(date -Iseconds)](https://github.com/ordo-one/${{ github.event.repository.name }}/actions/runs/${{ github.run_id }})" >> $GITHUB_ENV - echo 'EOF' >> $GITHUB_ENV + { + echo "_Pull request is the same as baseline_" + echo "[Pull request benchmark comparison [${{ matrix.os }}] with 'main' run at $(date -Iseconds)]($BENCHMARK_RUN_URL)" + } > benchmark_comment - if: ${{ env.exitStatus == '1' }} name: Pull request comment text failure - id: prtestfailure run: | - echo 'PRTEST<> $GITHUB_ENV - echo "[Pull request benchmark comparison [${{ matrix.os }}] with 'main' run at $(date -Iseconds)](https://github.com/ordo-one/${{ github.event.repository.name }}/actions/runs/${{ github.run_id }})" >> $GITHUB_ENV - echo "_Pull request had performance regressions_" >> $GITHUB_ENV - echo 'EOF' >> $GITHUB_ENV + { + echo "_Pull request had an unknown failure_" + echo "[Pull request benchmark comparison [${{ matrix.os }}] with 'main' run at $(date -Iseconds)]($BENCHMARK_RUN_URL)" + } > benchmark_comment + - if: ${{ env.exitStatus == '2' }} + name: Pull request comment text regression + run: | + { + echo "_Pull request had a regression_" + echo "[Pull request benchmark comparison [${{ matrix.os }}] with 'main' run at $(date -Iseconds)]($BENCHMARK_RUN_URL)" + } > benchmark_comment + - if: ${{ env.exitStatus == '4' }} + name: Pull request comment text improvement + run: | + { + echo "_Pull request had a performance improvement_" + echo "[Pull request benchmark comparison [${{ matrix.os }}] with 'main' run at $(date -Iseconds)]($BENCHMARK_RUN_URL)" + } > benchmark_comment - name: Comment PR if: ${{ env.hasBenchmark == '1' }} - uses: thollander/actions-comment-pull-request@v1 + uses: thollander/actions-comment-pull-request@v3 with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - message: ${{ env.PRTEST }} - comment_includes: "Pull request benchmark comparison [${{ matrix.os }}] with" + github-token: ${{ secrets.GITHUB_TOKEN }} + file-path: benchmark_comment + comment-tag: 'Pull request benchmark comparison [${{ matrix.os }}] with' - name: Exit with correct status + if: ${{ success() || failure() }} run: | #/usr/bin/ordo-performance powersave exit ${{ env.exitStatus }} diff --git a/.github/workflows/swift-check-api-breaks.yml b/.github/workflows/swift-check-api-breaks.yml index f14378e..40a20a9 100644 --- a/.github/workflows/swift-check-api-breaks.yml +++ b/.github/workflows/swift-check-api-breaks.yml @@ -12,7 +12,7 @@ jobs: timeout-minutes: 30 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Ubuntu deps diff --git a/.github/workflows/swift-code-coverage.yml b/.github/workflows/swift-code-coverage.yml index d60e2c8..6fad12f 100644 --- a/.github/workflows/swift-code-coverage.yml +++ b/.github/workflows/swift-code-coverage.yml @@ -5,18 +5,26 @@ on: push: branches: [ main ] pull_request: - branches: [ main ] + branches: [ main, next ] jobs: test-code-coverage: runs-on: [ubuntu-22.04] timeout-minutes: 60 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Ubuntu deps if: ${{ runner.os == 'Linux' }} run: | - sudo apt-get install -y libjemalloc-dev llvm-15 + sudo apt-get install -y libjemalloc-dev + + - uses: khlopko/setup-swift@bfd61cbd14eeef55a27afc45138b61ced7174839 + + - name: Swift version + run: swift --version + + - name: Start consul + uses: ./.github/actions/consul-start - name: Run tests continue-on-error: true @@ -32,12 +40,12 @@ jobs: fi if [ -f ${xctest_binary} ]; then - llvm-cov-15 export -format="lcov" ${xctest_binary} -instr-profile .build/debug/codecov/default.profdata > info.lcov + llvm-cov export -format="lcov" ${xctest_binary} -instr-profile .build/debug/codecov/default.profdata > info.lcov fi - name: Upload codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v4 with: - token: ${{ secrets.CODECOV_REPO_TOKEN }} + token: ${{ secrets.CODECOV_REPO_TOKEN }} files: info.lcov fail_ci_if_error: true diff --git a/.github/workflows/swift-lint.yml b/.github/workflows/swift-lint.yml index 210183b..331f74c 100644 --- a/.github/workflows/swift-lint.yml +++ b/.github/workflows/swift-lint.yml @@ -13,7 +13,7 @@ jobs: timeout-minutes: 60 runs-on: [ubuntu-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: GitHub Action for SwiftLint with --strict uses: norio-nomura/action-swiftlint@3.2.1 with: diff --git a/.github/workflows/swift-linux-build.yml b/.github/workflows/swift-linux-build.yml index c189e5f..96f2a65 100644 --- a/.github/workflows/swift-linux-build.yml +++ b/.github/workflows/swift-linux-build.yml @@ -1,11 +1,11 @@ -name: Swift Linux build +name: Linux build on: workflow_dispatch: push: branches: [ main ] pull_request: - branches: [ main ] + branches: [ main, next ] jobs: build-linux: @@ -14,17 +14,20 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - swift: ["5.7", "5.8"] - +# swift: [ "5.10", "6.0" ] runs-on: ${{ matrix.os }} steps: - - uses: fwal/setup-swift@v1.23.0 + - uses: swift-actions/setup-swift@v2 + if: ${{ false }} with: swift-version: ${{ matrix.swift }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + + - name: Start consul + uses: ./.github/actions/consul-start - name: Ubuntu deps if: ${{ runner.os == 'Linux' }} @@ -39,4 +42,6 @@ jobs: - name: Run tests run: | - [ -d Tests ] && swift test --parallel + if [ -d Tests ]; then + swift test --parallel + fi diff --git a/.github/workflows/swift-macos-build.yml b/.github/workflows/swift-macos-build.yml index 9e5dac6..87fcaba 100644 --- a/.github/workflows/swift-macos-build.yml +++ b/.github/workflows/swift-macos-build.yml @@ -1,11 +1,11 @@ -name: Swift macOS build +name: macOS build on: workflow_dispatch: push: branches: [ main ] pull_request: - branches: [ main ] + branches: [ main, next ] jobs: build-macos: @@ -13,13 +13,16 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-13] - swift: ["5.7", "5.8"] + os: [macos-15] +# swift: [ "5.10", "6.0" ] runs-on: ${{ matrix.os }} +# env: +# DEVELOPER_DIR: /Applications/Xcode_16.1.app/Contents/Developer steps: - - uses: fwal/setup-swift@v1.24.0 + - uses: swift-actions/setup-swift@v2 + if: ${{ false }} with: swift-version: ${{ matrix.swift }} @@ -29,7 +32,16 @@ jobs: echo "/opt/homebrew/bin:/usr/local/bin" >> $GITHUB_PATH echo BENCHMARK_DISABLE_JEMALLOC=true >> $GITHUB_ENV brew install jemalloc - - uses: actions/checkout@v3 + + - uses: actions/checkout@v4 + + - name: Start consul + uses: ./.github/actions/consul-start + + - name: GH auth + run: | + echo "machine api.github.com login ${{ secrets.GITHUB_TOKEN }} password x-oauth-basic" > $HOME/.netrc + cat ~/.netrc - name: Swift version run: swift --version - name: Build diff --git a/.github/workflows/swift-outdated-dependencies.yml b/.github/workflows/swift-outdated-dependencies.yml index 8d45ba5..8ed989e 100644 --- a/.github/workflows/swift-outdated-dependencies.yml +++ b/.github/workflows/swift-outdated-dependencies.yml @@ -10,16 +10,16 @@ jobs: runs-on: [ubuntu-latest] timeout-minutes: 60 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check Swift package dependencies id: spm-dep-check - uses: MarcoEidinger/swift-package-dependencies-check@2.3.4 + uses: MarcoEidinger/swift-package-dependencies-check@2.5.0 with: isMutating: true failWhenOutdated: false - name: Create Pull Request if: steps.spm-dep-check.outputs.outdatedDependencies == 'true' - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v7 with: commit-message: 'chore: update package dependencies' branch: updatePackageDepedencies diff --git a/.github/workflows/swift-sanitizer-address.yml b/.github/workflows/swift-sanitizer-address.yml index 82217a2..f811bce 100644 --- a/.github/workflows/swift-sanitizer-address.yml +++ b/.github/workflows/swift-sanitizer-address.yml @@ -5,14 +5,14 @@ on: push: branches: [ main ] pull_request: - branches: [ main ] + branches: [ main, next ] jobs: address-sanitizer: strategy: fail-fast: false matrix: - os: [ubuntu-latest] + os: [macos-15] runs-on: ${{ matrix.os }} timeout-minutes: 60 @@ -29,7 +29,10 @@ jobs: run: | sudo apt-get install -y libjemalloc-dev - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + + - name: Start consul + uses: ./.github/actions/consul-start - name: Swift version run: swift --version diff --git a/.github/workflows/swift-sanitizer-thread.yml b/.github/workflows/swift-sanitizer-thread.yml index c187150..932fba9 100644 --- a/.github/workflows/swift-sanitizer-thread.yml +++ b/.github/workflows/swift-sanitizer-thread.yml @@ -5,7 +5,7 @@ on: push: branches: [ main ] pull_request: - branches: [ main ] + branches: [ main, next ] jobs: thread-sanitizer: @@ -30,7 +30,10 @@ jobs: sudo apt-get install -y libjemalloc-dev echo BENCHMARK_DISABLE_JEMALLOC=true >> $GITHUB_ENV - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + + - name: Start consul + uses: ./.github/actions/consul-start - name: Swift version run: swift --version diff --git a/.swiftlint.yml b/.swiftlint.yml index 347c8e5..b71da5a 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,93 +1,2 @@ -#################################################################### -# DO NOT EDIT THIS FILE -# This is a master file maintained in https://github.com/ordo-one/public-repository-templates -# -# Add overrides into `swiftlint_refinement.yml` in the directory it self or -# .swiftlint.yml under the specific directory where the code is located -# -# Documentation is under https://github.com/realm/SwiftLint -#################################################################### - -included: - - Benchmarks - - Sources - - Tests -excluded: -analyzer_rules: - - unused_import -opt_in_rules: - - array_init - - attributes - - closure_end_indentation - - closure_spacing - - collection_alignment - - contains_over_filter_count - - contains_over_filter_is_empty - - contains_over_first_not_nil - - contains_over_range_nil_comparison - - discouraged_none_name - - discouraged_object_literal - - empty_collection_literal - - empty_count - - empty_string - - empty_xctest_method - - enum_case_associated_values_count - - explicit_init - - extension_access_modifier - - fallthrough - - fatal_error_message - - file_name - - first_where - - flatmap_over_map_reduce - - identical_operands - - joined_default_parameter - - last_where - - legacy_multiple - - literal_expression_end_indentation - - lower_acl_than_parent - - modifier_order - - nimble_operator - - nslocalizedstring_key - - number_separator - - object_literal - - operator_usage_whitespace - - overridden_super_call - - override_in_extension - - pattern_matching_keywords - - prefer_self_in_static_references - - prefer_self_type_over_type_of_self - - private_action - - private_outlet - - prohibited_interface_builder - - prohibited_super_call - - quick_discouraged_call - - quick_discouraged_focused_test - - quick_discouraged_pending_test - - reduce_into - - redundant_nil_coalescing - - redundant_type_annotation - - single_test_class - - sorted_first_last - - sorted_imports - - static_operator - - strong_iboutlet - - test_case_accessibility - - toggle_bool - - unavailable_function - - unneeded_parentheses_in_closure_argument - - unowned_variable_capture - - untyped_error_in_catch - - vertical_parameter_alignment_on_call - - vertical_whitespace_closing_braces - - vertical_whitespace_opening_braces - - xct_specific_matcher - - yoda_condition -line_length: - warning: 140 - error: 140 - ignores_comments: true - ignores_urls: true - ignores_function_declarations: true - ignores_interpolated_strings: true -identifier_name: - excluded: [id, i, j, k] +child_config: .swiftlint_refinement.yml +parent_config: .swiftlint_base.yml diff --git a/.swiftlint_base.yml b/.swiftlint_base.yml new file mode 100644 index 0000000..347c8e5 --- /dev/null +++ b/.swiftlint_base.yml @@ -0,0 +1,93 @@ +#################################################################### +# DO NOT EDIT THIS FILE +# This is a master file maintained in https://github.com/ordo-one/public-repository-templates +# +# Add overrides into `swiftlint_refinement.yml` in the directory it self or +# .swiftlint.yml under the specific directory where the code is located +# +# Documentation is under https://github.com/realm/SwiftLint +#################################################################### + +included: + - Benchmarks + - Sources + - Tests +excluded: +analyzer_rules: + - unused_import +opt_in_rules: + - array_init + - attributes + - closure_end_indentation + - closure_spacing + - collection_alignment + - contains_over_filter_count + - contains_over_filter_is_empty + - contains_over_first_not_nil + - contains_over_range_nil_comparison + - discouraged_none_name + - discouraged_object_literal + - empty_collection_literal + - empty_count + - empty_string + - empty_xctest_method + - enum_case_associated_values_count + - explicit_init + - extension_access_modifier + - fallthrough + - fatal_error_message + - file_name + - first_where + - flatmap_over_map_reduce + - identical_operands + - joined_default_parameter + - last_where + - legacy_multiple + - literal_expression_end_indentation + - lower_acl_than_parent + - modifier_order + - nimble_operator + - nslocalizedstring_key + - number_separator + - object_literal + - operator_usage_whitespace + - overridden_super_call + - override_in_extension + - pattern_matching_keywords + - prefer_self_in_static_references + - prefer_self_type_over_type_of_self + - private_action + - private_outlet + - prohibited_interface_builder + - prohibited_super_call + - quick_discouraged_call + - quick_discouraged_focused_test + - quick_discouraged_pending_test + - reduce_into + - redundant_nil_coalescing + - redundant_type_annotation + - single_test_class + - sorted_first_last + - sorted_imports + - static_operator + - strong_iboutlet + - test_case_accessibility + - toggle_bool + - unavailable_function + - unneeded_parentheses_in_closure_argument + - unowned_variable_capture + - untyped_error_in_catch + - vertical_parameter_alignment_on_call + - vertical_whitespace_closing_braces + - vertical_whitespace_opening_braces + - xct_specific_matcher + - yoda_condition +line_length: + warning: 140 + error: 140 + ignores_comments: true + ignores_urls: true + ignores_function_declarations: true + ignores_interpolated_strings: true +identifier_name: + excluded: [id, i, j, k] diff --git a/.swiftlint_refinement.yml b/.swiftlint_refinement.yml new file mode 100644 index 0000000..65ed8fb --- /dev/null +++ b/.swiftlint_refinement.yml @@ -0,0 +1 @@ +excluded: