Skip to content

Commit

Permalink
Merge pull request #3 from 7rikazhexde/dev24-10-1
Browse files Browse the repository at this point in the history
✅Update workflows
  • Loading branch information
7rikazhexde authored Oct 20, 2024
2 parents 29a7a83 + 707b013 commit 3e72713
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 29 deletions.
21 changes: 21 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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
60 changes: 42 additions & 18 deletions .github/workflows/dependabot_prch.yml
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/prch_test_matrix_json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 3e72713

Please sign in to comment.