Loading .gitlab-ci.yml +37 −38 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ cache: stages: - setup_and_format # A single stage to perform all modifications sequentially - lint # A stage for checks that don't modify code (like pylint) # - auto_commit # Optional stage for committing changes - auto_commit # Optional stage for committing changes # Job 1: Install Noctua and its dependencies install_noctua: Loading Loading @@ -149,43 +149,42 @@ apply_autopep8: # - when: manual # allow_failure: true # Allow manual trigger to not fail overall pipeline if desired # --- Optional: Auto Commit Job (Add if you want CI to commit changes) --- commit_formatted_code: stage: auto_commit tags: - git-run-ia2 needs: # - job: run_pylint # Must pass pylint - job: apply_autopep8 # Needs the final code state from formatting artifacts: true before_script: # Git and SSH setup (ensure SSH_DEPLOY_KEY CI/CD variable is set as File type) - apt-get update -y && apt-get install -y openssh-client git - eval $(ssh-agent -s) - mkdir -p ~/.ssh && chmod 700 ~/.ssh - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > ~/.ssh/id_ci_deploy && chmod 600 ~/.ssh/id_ci_deploy - ssh-add ~/.ssh/id_ci_deploy - ssh-keyscan -p ${CI_SERVER_PORT:-22} $CI_SERVER_HOST >> ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts - git config --global user.email "${GIT_USER_EMAIL}" - git config --global user.name "${GIT_USER_NAME}" # Ensure we are on the correct branch and have the latest files from artifacts - git checkout "$CI_COMMIT_BRANCH" script: - echo "Checking for formatting changes to commit..." - | # Add only the formatted targets to avoid committing other unintended changes git add "${FORMAT_TARGETS}" if ! git diff --cached --quiet HEAD; then # Check staged changes against HEAD echo "Code formatting changes applied. Committing to branch '${CI_COMMIT_BRANCH}'." # Option 1: Commit to a NEW branch (Safer) git checkout -B "${FORMATTED_BRANCH_NAME}" git commit -m "ci: Apply automated code formatting [skip ci]" git push -u origin "${FORMATTED_BRANCH_NAME}" -o ci.skip echo "Changes pushed to new branch '${FORMATTED_BRANCH_NAME}'. Please review and merge." else echo "No formatting changes to commit." fi #commit_formatted_code: # stage: auto_commit # tags: # - git-run-ia2 # needs: ## - job: run_pylint # Must pass pylint # - job: apply_autopep8 # Needs the final code state from formatting # artifacts: true # before_script: # # Git and SSH setup (ensure SSH_DEPLOY_KEY CI/CD variable is set as File type) # - apt-get update -y && apt-get install -y openssh-client git # - eval $(ssh-agent -s) # - mkdir -p ~/.ssh && chmod 700 ~/.ssh # - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > ~/.ssh/id_ci_deploy && chmod 600 ~/.ssh/id_ci_deploy # - ssh-add ~/.ssh/id_ci_deploy # - ssh-keyscan -p ${CI_SERVER_PORT:-22} $CI_SERVER_HOST >> ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts # - git config --global user.email "${GIT_USER_EMAIL}" # - git config --global user.name "${GIT_USER_NAME}" # # Ensure we are on the correct branch and have the latest files from artifacts # - git checkout "$CI_COMMIT_BRANCH" # script: # - echo "Checking for formatting changes to commit..." # - | # # Add only the formatted targets to avoid committing other unintended changes # git add "${FORMAT_TARGETS}" # # if ! git diff --cached --quiet HEAD; then # Check staged changes against HEAD # echo "Code formatting changes applied. Committing to branch '${CI_COMMIT_BRANCH}'." # # Option 1: Commit to a NEW branch (Safer) # git checkout -B "${FORMATTED_BRANCH_NAME}" # git commit -m "ci: Apply automated code formatting [skip ci]" # git push -u origin "${FORMATTED_BRANCH_NAME}" -o ci.skip # echo "Changes pushed to new branch '${FORMATTED_BRANCH_NAME}'. Please review and merge." # else # echo "No formatting changes to commit." # fi # rules: # # Example: Only run manually on the default branch after all checks pass # - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE != "schedule" # Avoid on schedules Loading Loading
.gitlab-ci.yml +37 −38 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ cache: stages: - setup_and_format # A single stage to perform all modifications sequentially - lint # A stage for checks that don't modify code (like pylint) # - auto_commit # Optional stage for committing changes - auto_commit # Optional stage for committing changes # Job 1: Install Noctua and its dependencies install_noctua: Loading Loading @@ -149,43 +149,42 @@ apply_autopep8: # - when: manual # allow_failure: true # Allow manual trigger to not fail overall pipeline if desired # --- Optional: Auto Commit Job (Add if you want CI to commit changes) --- commit_formatted_code: stage: auto_commit tags: - git-run-ia2 needs: # - job: run_pylint # Must pass pylint - job: apply_autopep8 # Needs the final code state from formatting artifacts: true before_script: # Git and SSH setup (ensure SSH_DEPLOY_KEY CI/CD variable is set as File type) - apt-get update -y && apt-get install -y openssh-client git - eval $(ssh-agent -s) - mkdir -p ~/.ssh && chmod 700 ~/.ssh - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > ~/.ssh/id_ci_deploy && chmod 600 ~/.ssh/id_ci_deploy - ssh-add ~/.ssh/id_ci_deploy - ssh-keyscan -p ${CI_SERVER_PORT:-22} $CI_SERVER_HOST >> ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts - git config --global user.email "${GIT_USER_EMAIL}" - git config --global user.name "${GIT_USER_NAME}" # Ensure we are on the correct branch and have the latest files from artifacts - git checkout "$CI_COMMIT_BRANCH" script: - echo "Checking for formatting changes to commit..." - | # Add only the formatted targets to avoid committing other unintended changes git add "${FORMAT_TARGETS}" if ! git diff --cached --quiet HEAD; then # Check staged changes against HEAD echo "Code formatting changes applied. Committing to branch '${CI_COMMIT_BRANCH}'." # Option 1: Commit to a NEW branch (Safer) git checkout -B "${FORMATTED_BRANCH_NAME}" git commit -m "ci: Apply automated code formatting [skip ci]" git push -u origin "${FORMATTED_BRANCH_NAME}" -o ci.skip echo "Changes pushed to new branch '${FORMATTED_BRANCH_NAME}'. Please review and merge." else echo "No formatting changes to commit." fi #commit_formatted_code: # stage: auto_commit # tags: # - git-run-ia2 # needs: ## - job: run_pylint # Must pass pylint # - job: apply_autopep8 # Needs the final code state from formatting # artifacts: true # before_script: # # Git and SSH setup (ensure SSH_DEPLOY_KEY CI/CD variable is set as File type) # - apt-get update -y && apt-get install -y openssh-client git # - eval $(ssh-agent -s) # - mkdir -p ~/.ssh && chmod 700 ~/.ssh # - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > ~/.ssh/id_ci_deploy && chmod 600 ~/.ssh/id_ci_deploy # - ssh-add ~/.ssh/id_ci_deploy # - ssh-keyscan -p ${CI_SERVER_PORT:-22} $CI_SERVER_HOST >> ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts # - git config --global user.email "${GIT_USER_EMAIL}" # - git config --global user.name "${GIT_USER_NAME}" # # Ensure we are on the correct branch and have the latest files from artifacts # - git checkout "$CI_COMMIT_BRANCH" # script: # - echo "Checking for formatting changes to commit..." # - | # # Add only the formatted targets to avoid committing other unintended changes # git add "${FORMAT_TARGETS}" # # if ! git diff --cached --quiet HEAD; then # Check staged changes against HEAD # echo "Code formatting changes applied. Committing to branch '${CI_COMMIT_BRANCH}'." # # Option 1: Commit to a NEW branch (Safer) # git checkout -B "${FORMATTED_BRANCH_NAME}" # git commit -m "ci: Apply automated code formatting [skip ci]" # git push -u origin "${FORMATTED_BRANCH_NAME}" -o ci.skip # echo "Changes pushed to new branch '${FORMATTED_BRANCH_NAME}'. Please review and merge." # else # echo "No formatting changes to commit." # fi # rules: # # Example: Only run manually on the default branch after all checks pass # - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE != "schedule" # Avoid on schedules Loading