diff --git a/.github/workflows/callable_pytests.yml b/.github/workflows/callable_pytests.yml deleted file mode 100644 index b89a47e..0000000 --- a/.github/workflows/callable_pytests.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: callable_pytests - -on: - workflow_call: - -jobs: - callable_pytests: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.11", "3.12", "3.13"] - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Install uv # https://eed-solutions.atlassian.net/wiki/spaces/ES/pages/782434388/Best+Practice+uv+package+management#Github-Actions - uses: astral-sh/setup-uv@v4 - with: - enable-cache: true - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - uv sync - - name: Run pytests - run: | - uv run pytest tests diff --git a/.github/workflows/callable_ruff.yml b/.github/workflows/callable_ruff.yml deleted file mode 100644 index 289b746..0000000 --- a/.github/workflows/callable_ruff.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: callable_ruff - -on: - workflow_call: - -jobs: - callable_ruff: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: echo environment - run: echo ${{ github.ref }} && echo ${{ github.base_ref }} && echo ${{ github.head_ref }} - - name: if base is main - if: ${{ github.ref == 'refs/heads/main' }} - run: echo hat geklappt - - name: Install uv # https://eed-solutions.atlassian.net/wiki/spaces/ES/pages/782434388/Best+Practice+uv+package+management#Github-Actions - uses: astral-sh/setup-uv@v4 - with: - enable-cache: true - - name: set up ruff - uses: astral-sh/ruff-action@v3 - - name: Run Ruff - run: uv run ruff check --output-format=github diff --git a/.github/workflows/callable_update_eed_basic_utils.yml b/.github/workflows/callable_update_eed_basic_utils.yml deleted file mode 100644 index a428f31..0000000 --- a/.github/workflows/callable_update_eed_basic_utils.yml +++ /dev/null @@ -1,127 +0,0 @@ -name: callable_update_eed_basic_utils - -on: - workflow_call: - inputs: - package_name: - required: true - type: string - secrets: - GH_PAT: - required: true - -jobs: - callable_update_eed_basic_utils: - runs-on: ubuntu-latest - steps: - - name: Get triggering user login - id: get_user - run: | - trigger_user="${{ github.triggering_actor }}" - echo "trigger_user=$trigger_user" >> $GITHUB_OUTPUT - echo "Workflow triggered by: trigger_user" - - name: Get base branch name - id: get_base_branch - run: | - base_branch=${GITHUB_REF_NAME} - echo "base_branch=$base_branch" >> $GITHUB_OUTPUT - echo "base_branch=$base_branch" - - name: Set package variable - id: define_package_name - run: | - package="${{ inputs.package_name }}" - echo "package=$package" >> $GITHUB_OUTPUT - echo "package=$package" - - name: Set branch variable - id: define_branch_name - run: | - branch="update_eed_packages" - echo "branch=$branch" >> $GITHUB_OUTPUT - echo "branch=$branch" - - name: Checkout repository - uses: actions/checkout@v4 - with: - token: ${{ secrets.GH_PAT }} - - name: Set up git user - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - - name: Fetch and list all branches - run: | - git fetch --all - git branch --list - - name: Check if branch exists - id: branch_check - run: | - branch="${{ steps.define_branch_name.outputs.branch }}" - if git ls-remote --heads origin $branch | grep -q $branch ; then - branch_exists=true - else - branch_exists=false - fi - echo "branch_exists=$branch_exists" >> $GITHUB_OUTPUT - echo "branch_exists=$branch_exists" - - - name: Checkout or create branch - run: | - branch="${{ steps.define_branch_name.outputs.branch }}" - if [ "${{ steps.branch_check.outputs.branch_exists }}" = "true" ]; then - git switch $branch && git pull - else - git switch -c $branch - fi - commit_id=$(git rev-parse HEAD) - echo "commit_id = $commit_id" - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version-file: .python-version - - name: Install dependencies - run: | - pip install uv - python -m pip install --upgrade pip - uv sync - - name: Update ${{ steps.define_package_name.outputs.package }} using uv - run: uv add "${{ steps.define_package_name.outputs.package }}" --upgrade-package "${{ steps.define_package_name.outputs.package }}" - - - name: Check for changes - id: changes - run: | - if git status --porcelain | grep .; then - echo "changed=true" >> $GITHUB_OUTPUT - else - echo "changed=false" >> $GITHUB_OUTPUT - fi - - - name: Commit and push changes - if: steps.changes.outputs.changed == 'true' - run: | - branch="${{ steps.define_branch_name.outputs.branch }}" - git add . - git commit -m "Update ${{ steps.define_package_name.outputs.package }}" - git push origin $branch - - - name: Check for existing open PR - id: pr_check - env: - GH_TOKEN: ${{ secrets.GH_PAT }} - run: | - branch="${{ steps.define_branch_name.outputs.branch }}" - pr_number=$(gh pr list --head "$branch" --state open --json number --jq '.[0].number') - if [ -n "$pr_number" ]; then - pr_exists=true - else - pr_exists=false - fi - echo "pr_exists=$pr_exists" >> $GITHUB_OUTPUT - echo "pr_exists=$pr_exists" - - name: create pull request - if: steps.changes.outputs.changed == 'true' && steps.pr_check.outputs.pr_exists == 'false' - env: - GH_TOKEN: ${{ secrets.GH_PAT }} - run: | - base_branch="${{ steps.get_base_branch.outputs.base_branch }}" - pr_title="${{ steps.define_branch_name.outputs.branch }}" - user="${{ steps.get_user.outputs.trigger_user }}" - pr_url=$(gh pr create --title "$pr_title" --body "$pr_title" --base "$base_branch" --assignee "$user" --reviewer "$user") - echo "Created PR: $pr_url" diff --git a/.github/workflows/pytests.yml b/.github/workflows/pytests.yml index 8d1b55a..1935597 100644 --- a/.github/workflows/pytests.yml +++ b/.github/workflows/pytests.yml @@ -5,4 +5,4 @@ on: workflow_dispatch: jobs: pytests: - uses: ./.github/workflows/callable_pytests.yml + uses: EED-Solutions/eed_gha_workflows/.github/workflows/callable_pytests.yml@main diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 6f1a937..b9d7e7e 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -6,4 +6,4 @@ on: jobs: ruff: - uses: ./.github/workflows/callable_ruff.yml + uses: EED-Solutions/eed_gha_workflows/.github/workflows/callable_ruff.yml@main diff --git a/.github/workflows/update_eed_basic_utils.yml b/.github/workflows/update_eed_basic_utils.yml index 1529383..85062e0 100644 --- a/.github/workflows/update_eed_basic_utils.yml +++ b/.github/workflows/update_eed_basic_utils.yml @@ -5,7 +5,7 @@ on: jobs: update_eed_basic_utils: - uses: ./.github/workflows/callable_update_eed_basic_utils.yml + uses: EED-Solutions/eed_gha_workflows/.github/workflows/callable_update_eed_basic_utils.yml@main with: package_name: eed_basic_utils secrets: