From 245cf4a6763cd358a8d685fa22e425e0542c49e6 Mon Sep 17 00:00:00 2001 From: Denis Angell Date: Fri, 28 Mar 2025 10:44:18 +0100 Subject: [PATCH] refactor checkpatterns remove comments --- .github/workflows/xahau-ga-checkpatterns.yml | 26 +++++++ .github/workflows/xahau-ga-macos.yml | 25 +------ .github/workflows/xahau-ga-nix.yml | 72 ++------------------ 3 files changed, 33 insertions(+), 90 deletions(-) create mode 100644 .github/workflows/xahau-ga-checkpatterns.yml diff --git a/.github/workflows/xahau-ga-checkpatterns.yml b/.github/workflows/xahau-ga-checkpatterns.yml new file mode 100644 index 000000000..87f043a0d --- /dev/null +++ b/.github/workflows/xahau-ga-checkpatterns.yml @@ -0,0 +1,26 @@ +name: Nix - GA Runner + +on: + push: + branches-ignore: ["dev", "candidate", "release"] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + checkpatterns: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Check for suspicious patterns + run: | + if [ -f "suspicious_patterns.sh" ]; then + bash suspicious_patterns.sh + else + echo "Warning: suspicious_patterns.sh not found, skipping check" + # Still exit with success for compatibility with dependent jobs + exit 0 + fi \ No newline at end of file diff --git a/.github/workflows/xahau-ga-macos.yml b/.github/workflows/xahau-ga-macos.yml index 818973f95..a20a64e06 100644 --- a/.github/workflows/xahau-ga-macos.yml +++ b/.github/workflows/xahau-ga-macos.yml @@ -1,12 +1,9 @@ name: MacOS - GA Runner on: - # Use GA runners on pushes except for the branches which build by the sh runner push: branches-ignore: ["dev", "candidate", "release"] -# Concurrency control: Cancels older in-progress runs for the same branch (github.ref) -# when a new push occurs. This saves runner minutes on superseded commits. concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -14,46 +11,36 @@ concurrency: jobs: test: strategy: - # Matrix allows defining variations (e.g., different compilers, configs). - # Keys below are structured to support future matrix expansion. matrix: generator: - Ninja configuration: - Debug - # Use the specified macOS runner version runs-on: macos-15 env: - # Build directory relative to the workspace root build_dir: .build - # Manual cache version control. Bump this number to invalidate all caches globally. + # Bump this number to invalidate all caches globally. CACHE_VERSION: 1 - # Default branch name used for prioritizing ccache restores. Adjust if needed. - MAIN_BRANCH_NAME: jshooks + MAIN_BRANCH_NAME: dev steps: - # 1. Checkout Code - name: Checkout uses: actions/checkout@v4 - # 2. Install Build Dependencies via Homebrew - name: Install Conan run: | brew install conan@1 # Add Conan 1 to the PATH for this job echo "$(brew --prefix conan@1)/bin" >> $GITHUB_PATH - # 3. Install Coreutils (for 'nproc') - name: Install Coreutils run: | brew install coreutils echo "Num proc: $(nproc)" - # 4. Install Ninja (if needed by generator) - name: Install Ninja if: matrix.generator == 'Ninja' run: brew install ninja - # 5. Install Python (if needed) - name: Install Python run: | if which python3 > /dev/null 2>&1; then @@ -67,7 +54,6 @@ jobs: sudo ln -sf $(which python3) /usr/local/bin/python fi - # 6. Install CMake (if needed) - name: Install CMake run: | if which cmake > /dev/null 2>&1; then @@ -77,11 +63,9 @@ jobs: brew install cmake fi - # 7. Install ccache - name: Install ccache run: brew install ccache - # 8. Configure ccache (add this action) - name: Configure ccache uses: ./.github/actions/xahau-configure-ccache with: @@ -89,7 +73,6 @@ jobs: hash_dir: true compiler_check: content - # 9. Environment Verification (Optional but Recommended) - name: Check environment run: | echo "PATH:" @@ -102,13 +85,11 @@ jobs: echo "---- Full Environment ----" env - # 10. Configure Conan Profile - name: Configure Conan run: | conan profile new default --detect || true # Ignore error if profile exists conan profile update settings.compiler.cppstd=20 default - # 11. Install dependencies using the action - name: Install dependencies uses: ./.github/actions/xahau-ga-dependencies with: @@ -118,7 +99,6 @@ jobs: cache_version: ${{ env.CACHE_VERSION }} main_branch: ${{ env.MAIN_BRANCH_NAME }} - # 12. Build Project using the action - name: Build uses: ./.github/actions/xahau-ga-build with: @@ -129,7 +109,6 @@ jobs: cache_version: ${{ env.CACHE_VERSION }} main_branch: ${{ env.MAIN_BRANCH_NAME }} - # 13. Run Tests - name: Test run: | ${{ env.build_dir }}/rippled --unittest --unittest-jobs $(nproc) \ No newline at end of file diff --git a/.github/workflows/xahau-ga-nix.yml b/.github/workflows/xahau-ga-nix.yml index abe69b06b..b86db7a57 100644 --- a/.github/workflows/xahau-ga-nix.yml +++ b/.github/workflows/xahau-ga-nix.yml @@ -1,70 +1,37 @@ name: Nix - GA Runner on: - # Use GA runners on pushes except for the branches which build by the sh runner push: branches-ignore: ["dev", "candidate", "release"] -# Concurrency control: Cancels older in-progress runs for the same branch (github.ref) -# when a new push occurs. This saves runner minutes on superseded commits. concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - # 1. Initial Check Job (Optional Sanity Check) - checkpatterns: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Check for suspicious patterns - run: | - if [ -f "suspicious_patterns.sh" ]; then - bash suspicious_patterns.sh - else - echo "Warning: suspicious_patterns.sh not found, skipping check" - # Still exit with success for compatibility with dependent jobs - exit 0 - fi - - # 2. Main Build Job build-job: runs-on: ubuntu-latest - needs: checkpatterns # Depends on the initial check passing outputs: - # Output artifact name for potential downstream use artifact_name: ${{ steps.set-artifact-name.outputs.artifact_name }} strategy: fail-fast: false - # Matrix defines build variations. Keys are structured for this. matrix: - compiler: [gcc] # Example: Add 'clang' here later - configuration: [Debug] # Example: Add 'Release' here later + compiler: [gcc] + configuration: [Debug] include: - # Link compiler matrix variable to specific package names/paths - compiler: gcc cc: gcc-11 cxx: g++-11 compiler_id: gcc-11 - # - compiler: clang - # cc: clang-14 - # cxx: clang++-14 - # compiler_id: clang-14 env: - # Build directory relative to the workspace root build_dir: .build - # Manual cache version control. Bump this number to invalidate all caches globally. + # Bump this number to invalidate all caches globally. CACHE_VERSION: 1 - # Default branch name used for prioritizing ccache restores. Adjust if needed. - MAIN_BRANCH_NAME: jshooks + MAIN_BRANCH_NAME: dev steps: - # 2.1. Checkout Code - name: Checkout uses: actions/checkout@v4 - # 2.2. Install Build System Dependencies (apt) - name: Install build dependencies run: | sudo apt-get update @@ -72,7 +39,6 @@ jobs: # Install specific Conan version needed pip install --upgrade "conan<2" - # 2.3. Configure ccache - name: Configure ccache uses: ./.github/actions/xahau-configure-ccache with: @@ -80,8 +46,6 @@ jobs: hash_dir: true compiler_check: content - # 2.4. Configure Conan Profile - # Sets up the Conan profile specifically for the compiler specified in the matrix. - name: Configure Conan run: | conan profile new default --detect || true # Ignore error if profile exists @@ -101,7 +65,6 @@ jobs: # Display profile for verification conan profile show default - # 2.5. Environment Verification (Optional but Recommended) - name: Check environment run: | echo "PATH:" @@ -114,7 +77,6 @@ jobs: echo "---- Full Environment ----" env - # 2.6. Install Dependencies using the action - name: Install dependencies uses: ./.github/actions/xahau-ga-dependencies with: @@ -124,7 +86,6 @@ jobs: cache_version: ${{ env.CACHE_VERSION }} main_branch: ${{ env.MAIN_BRANCH_NAME }} - # 2.7. Build Project using the action - name: Build uses: ./.github/actions/xahau-ga-build with: @@ -137,7 +98,6 @@ jobs: cache_version: ${{ env.CACHE_VERSION }} main_branch: ${{ env.MAIN_BRANCH_NAME }} - # 2.8. Set Artifact Name (Based on Matrix) - name: Set artifact name id: set-artifact-name run: | @@ -145,13 +105,11 @@ jobs: echo "artifact_name=${ARTIFACT_NAME}" >> "$GITHUB_OUTPUT" echo "Using artifact name: ${ARTIFACT_NAME}" - # 2.9. Debug Build Directory Contents (Optional) - name: Debug build directory run: | echo "Checking build directory contents: ${{ env.build_dir }}" ls -la ${{ env.build_dir }} || echo "Build directory not found or empty" - # 2.10. Run Tests - name: Run tests run: | # Ensure the binary exists before trying to run @@ -160,24 +118,4 @@ jobs: else echo "Error: rippled executable not found in ${{ env.build_dir }}" exit 1 - fi - - # These are just here to conform with configured requirements - - # 3. Dummy Downstream Job (Build) - build: - runs-on: ubuntu-latest - needs: build-job # Depends on the matrix build finishing - steps: - - name: Dummy Build - run: | - echo "Dummy build step - relies upon build-job matrix completion." - - # 4. Dummy Downstream Job (Tests) - tests: - runs-on: ubuntu-latest - needs: build-job # Depends on the matrix build finishing - steps: - - name: Dummy Tests - run: | - echo "Dummy tests step - relies upon build-job matrix completion." \ No newline at end of file + fi \ No newline at end of file