From 707b0138447eb0b5af530b05e3267931de6e47b1 Mon Sep 17 00:00:00 2001 From: 7rikazhexde <7rikaz.h785.stat2ltas41lcijad@gmail.com> Date: Sun, 20 Oct 2024 18:04:53 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=85Update=20workflows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/dependabot.yml | 21 ++++++++ .github/workflows/dependabot_prch.yml | 60 ++++++++++++++------- .github/workflows/prch_test_matrix_json.yml | 19 +++---- 3 files changed, 71 insertions(+), 29 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..d8b18a4 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,21 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "daily" + groups: + dependencies: + patterns: + - "*" + open-pull-requests-limit: 10 + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + groups: + dependencies: + patterns: + - "*" + open-pull-requests-limit: 10 diff --git a/.github/workflows/dependabot_prch.yml b/.github/workflows/dependabot_prch.yml index e0ef86f..1b638ff 100644 --- a/.github/workflows/dependabot_prch.yml +++ b/.github/workflows/dependabot_prch.yml @@ -1,37 +1,61 @@ name: Dependabot PR Check # Workflow Processing Flow: -# 1. trigger condition: # - on pull request to main branch +# 1. trigger condition: # - On pull request to main branch # - Execution by Dependabot # - Commit message does not start with “Bump version”. # 2. job condition check: check for PR by Dependabot -# 3. setup environment for each OS (macos-13, ubuntu-latest, windows-latest) -# 4. setup Python environment (3.11, 3.12) -# 5. Set up your time zone (Asia/Tokyo) -# 6. Repository Checkout -# 7. Installing Poetry -# 8. Dependency cache -# 9. Install Project Dependencies -# 10. Test execution and coverage calculation -# 11. Check that coverage is at least 90%. -# 12. Generate test results and coverage reports -# 13. Check test results and display warnings -# 14. Creating Job Summaries -# 15. Confirmation of all test results -# 16. Sending LINE notifications +# 3. Set variables using 7rikazhexde/json2vars-setter action +# 4. Set up your time zone (Asia/Tokyo) +# 5. Repository Checkout +# 6. Installing Poetry +# 7. Dependency cache +# 8. Install Project Dependencies +# 9. Test execution and coverage calculation +# 10. Check that coverage is at least 90%. +# 11. Generate test results and coverage reports +# 12. Check test results and display warnings +# 13. Creating Job Summaries +# 14. Confirmation of all test results +# 15. Sending LINE notifications on: pull_request: branches: "main" jobs: - test: + set_variables: if: github.actor == 'dependabot[bot]' && !startsWith(github.event.pull_request.title, 'Bump version') + runs-on: ubuntu-latest + outputs: + os: ${{ steps.json2vars.outputs.os }} + versions_python: ${{ steps.json2vars.outputs.versions_python }} + ghpages_branch: ${{ steps.json2vars.outputs.ghpages_branch }} + steps: + - name: Checkout repository + uses: actions/checkout@v4.2.1 + with: + fetch-depth: 0 + + - name: Set variables from JSON + id: json2vars + uses: 7rikazhexde/json2vars-setter@main + with: + json-file: .github/workflows/matrix.json + + - name: Debug output values + run: | + echo "os: ${{ steps.json2vars.outputs.os }}" + echo "versions_python: ${{ steps.json2vars.outputs.versions_python }}" + echo "ghpages_branch: ${{ steps.json2vars.outputs.ghpages_branch }}" + + test: + needs: set_variables strategy: matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - python-version: ['3.10', '3.11', '3.12'] + os: ${{ fromJson(needs.set_variables.outputs.os) }} + python-version: ${{ fromJson(needs.set_variables.outputs.versions_python) }} runs-on: ${{ matrix.os }} env: TZ: 'Asia/Tokyo' diff --git a/.github/workflows/prch_test_matrix_json.yml b/.github/workflows/prch_test_matrix_json.yml index 842f927..375b5d0 100644 --- a/.github/workflows/prch_test_matrix_json.yml +++ b/.github/workflows/prch_test_matrix_json.yml @@ -5,7 +5,7 @@ on: branches: ["main"] jobs: - generate_matrix: + set_variables: if: github.actor != 'dependabot[bot]' && !startsWith(github.event.pull_request.title, 'Bump version') runs-on: ubuntu-latest outputs: @@ -20,10 +20,7 @@ jobs: - name: Set variables from JSON id: json2vars - # Temporarily specify local environment. - # Change to remote URL format after repository is published - uses: ./ - # uses: 7rikazhexde/json2vars-setter@main + uses: 7rikazhexde/json2vars-setter@main with: json-file: .github/workflows/matrix.json @@ -35,11 +32,11 @@ jobs: run_tests: - needs: generate_matrix + needs: set_variables strategy: matrix: - os: ${{ fromJson(needs.generate_matrix.outputs.os) }} - python-version: ${{ fromJson(needs.generate_matrix.outputs.versions_python) }} + os: ${{ fromJson(needs.set_variables.outputs.os) }} + python-version: ${{ fromJson(needs.set_variables.outputs.versions_python) }} runs-on: ${{ matrix.os }} steps: - name: Checkout repository @@ -80,11 +77,11 @@ jobs: shell: bash run: | # For list case - ghpages_branch=${{ needs.generate_matrix.outputs.ghpages_branch }} + ghpages_branch=${{ needs.set_variables.outputs.ghpages_branch }} # For lists, explicitly enclose the list in “” to make it a string. (Note that it is not ''.) - os='${{ needs.generate_matrix.outputs.os }}' - versions_python='${{ needs.generate_matrix.outputs.versions_python }}' + os='${{ needs.set_variables.outputs.os }}' + versions_python='${{ needs.set_variables.outputs.versions_python }}' echo "os: $os" echo "versions_python: $versions_python"