diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..cce48b8 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,254 @@ +# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference +version: 2 + +updates: + # ---------------- GitHub Actions ---------------- + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + day: monday + time: "04:00" + timezone: Asia/Tokyo + open-pull-requests-limit: 5 + labels: + - dependencies + - ci + commit-message: + prefix: chore + include: scope + cooldown: + default-days: 3 + groups: + github-actions: + patterns: + - "*" + update-types: + - minor + - patch + + # ---------------- Go ---------------- + - package-ecosystem: gomod + directory: /golang + schedule: + interval: weekly + day: monday + time: "04:00" + timezone: Asia/Tokyo + open-pull-requests-limit: 5 + labels: + - dependencies + - golang + commit-message: + prefix: chore + include: scope + cooldown: + default-days: 3 + groups: + golang: + patterns: + - "*" + update-types: + - minor + - patch + + # ---------------- Java 17 ---------------- + - package-ecosystem: maven + directory: /java17 + schedule: + interval: weekly + day: monday + time: "04:00" + timezone: Asia/Tokyo + open-pull-requests-limit: 5 + labels: + - dependencies + - java17 + commit-message: + prefix: chore + include: scope + cooldown: + default-days: 3 + groups: + java17: + patterns: + - "*" + update-types: + - minor + - patch + + # ---------------- Java 8 ---------------- + - package-ecosystem: maven + directory: /java8 + schedule: + interval: weekly + day: monday + time: "04:00" + timezone: Asia/Tokyo + open-pull-requests-limit: 5 + labels: + - dependencies + - java8 + commit-message: + prefix: chore + include: scope + cooldown: + default-days: 3 + groups: + java8: + patterns: + - "*" + update-types: + - minor + - patch + + # ---------------- PHP ---------------- + - package-ecosystem: composer + directory: /php + schedule: + interval: weekly + day: monday + time: "04:00" + timezone: Asia/Tokyo + open-pull-requests-limit: 5 + labels: + - dependencies + - php + commit-message: + prefix: chore + include: scope + cooldown: + default-days: 3 + ignore: + # PHP 本体の major は自動で上げない + - dependency-name: php + update-types: + - version-update:semver-major + groups: + php: + patterns: + - "*" + update-types: + - minor + - patch + + # ---------------- Python ---------------- + - package-ecosystem: pip + directory: /python + schedule: + interval: weekly + day: monday + time: "04:00" + timezone: Asia/Tokyo + open-pull-requests-limit: 5 + labels: + - dependencies + - python + commit-message: + prefix: chore + include: scope + cooldown: + default-days: 3 + groups: + python: + patterns: + - "*" + update-types: + - minor + - patch + + # ---------------- Ruby ---------------- + - package-ecosystem: bundler + directory: /ruby + schedule: + interval: weekly + day: monday + time: "04:00" + timezone: Asia/Tokyo + open-pull-requests-limit: 5 + labels: + - dependencies + - ruby + commit-message: + prefix: chore + include: scope + cooldown: + default-days: 3 + groups: + ruby: + patterns: + - "*" + update-types: + - minor + - patch + + # ---------------- Scala ---------------- + - package-ecosystem: sbt + directory: /scala + schedule: + interval: weekly + day: monday + time: "04:00" + timezone: Asia/Tokyo + open-pull-requests-limit: 5 + labels: + - dependencies + - scala + commit-message: + prefix: chore + include: scope + cooldown: + default-days: 3 + ignore: + # Scala / sbt 本体の major は自動で上げない + # Dependabot は build.sbt の scalaVersion を scala(3)-library として、 + # project/build.properties の sbt.version を org.scala-sbt:sbt として扱う + - dependency-name: org.scala-lang:scala3-library_3 + update-types: + - version-update:semver-major + - dependency-name: org.scala-lang:scala-library + update-types: + - version-update:semver-major + - dependency-name: org.scala-sbt:sbt + update-types: + - version-update:semver-major + groups: + scala: + patterns: + - "*" + update-types: + - minor + - patch + + # ---------------- TypeScript ---------------- + - package-ecosystem: npm + directory: /typescript + schedule: + interval: weekly + day: monday + time: "04:00" + timezone: Asia/Tokyo + open-pull-requests-limit: 5 + labels: + - dependencies + - typescript + commit-message: + prefix: chore + include: scope + cooldown: + default-days: 3 + ignore: + # TypeScript / Node.js 本体の major は自動で上げない + - dependency-name: typescript + update-types: + - version-update:semver-major + - dependency-name: "@types/node" + update-types: + - version-update:semver-major + groups: + typescript: + patterns: + - "*" + update-types: + - minor + - patch diff --git a/.github/renovate.json5 b/.github/renovate.json5 deleted file mode 100644 index 79f97e8..0000000 --- a/.github/renovate.json5 +++ /dev/null @@ -1,31 +0,0 @@ -{ - extends: [ - "config:best-practices", - "schedule:earlyMondays", - "group:allNonMajor", - ], - automerge: true, - platformAutomerge: true, - dependencyDashboard: false, - labels: ["dependencies"], - postUpdateOptions: ["gomodTidy", "gomodUpdateImportPaths"], - prHourlyLimit: 0, - prConcurrentLimit: 5, - lockFileMaintenance: { - enabled: true, - schedule: ["before 3am on sunday"], - }, - vulnerabilityAlerts: { - enabled: true, - labels: ["security"], - }, - packageRules: [ - { - # disable language major version upgrades - matchCategories: ["python", "node", "golang", "php", "typescript", "java", "scala", "ruby"], - matchUpdateTypes: ["major"], - enabled: false, - }, - ], - minimumReleaseAge: "7 days", -} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1fc8a69 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,189 @@ +name: CI + +# 各言語のテストをここから呼び出し、最後に status を集約する。 +# branch protection / ruleset の required status checks には +# このワークフローの "CI / All checks passed" だけを登録すればよい。 +on: + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +permissions: + contents: read + +jobs: + changes: + runs-on: ubuntu-latest + name: Detect changes + timeout-minutes: 5 + permissions: + contents: read + pull-requests: read + outputs: + golang: ${{ steps.filter.outputs.golang }} + java17: ${{ steps.filter.outputs.java17 }} + java8: ${{ steps.filter.outputs.java8 }} + php: ${{ steps.filter.outputs.php }} + python: ${{ steps.filter.outputs.python }} + ruby: ${{ steps.filter.outputs.ruby }} + scala: ${{ steps.filter.outputs.scala }} + typescript: ${{ steps.filter.outputs.typescript }} + steps: + - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 + id: filter + with: + filters: | + shared: &shared + - '.github/workflows/ci.yml' + - '.github/scripts/expect-order-scenario-failure.sh' + golang: + - *shared + - '.github/workflows/test-go.yml' + - 'golang/**.go' + - 'golang/go.mod' + - 'golang/go.sum' + java17: + - *shared + - '.github/workflows/test-java17.yml' + - 'java17/src/**' + - 'java17/pom.xml' + java8: + - *shared + - '.github/workflows/test-java8.yml' + - 'java8/src/**' + - 'java8/pom.xml' + php: + - *shared + - '.github/workflows/test-php.yml' + - 'php/src/**' + - 'php/tests/**' + - 'php/composer.json' + python: + - *shared + - '.github/workflows/test-python.yml' + - 'python/src/**' + - 'python/tests/**' + - 'python/pyproject.toml' + ruby: + - *shared + - '.github/workflows/test-ruby.yml' + - 'ruby/lib/**' + - 'ruby/spec/**' + - 'ruby/Gemfile' + - 'ruby/Gemfile.lock' + scala: + - *shared + - '.github/workflows/test-scala.yml' + - 'scala/src/**' + - 'scala/build.sbt' + - 'scala/project/**' + typescript: + - *shared + - '.github/workflows/test-typescript.yml' + - 'typescript/src/**' + - 'typescript/tests/**' + - 'typescript/package.json' + - 'typescript/package-lock.json' + - 'typescript/tsconfig.json' + + golang: + needs: changes + if: needs.changes.outputs.golang == 'true' + name: Go + uses: ./.github/workflows/test-go.yml + permissions: + contents: read + + java17: + needs: changes + if: needs.changes.outputs.java17 == 'true' + name: Java 17 + uses: ./.github/workflows/test-java17.yml + permissions: + contents: read + + java8: + needs: changes + if: needs.changes.outputs.java8 == 'true' + name: Java 8 + uses: ./.github/workflows/test-java8.yml + permissions: + contents: read + + php: + needs: changes + if: needs.changes.outputs.php == 'true' + name: PHP + uses: ./.github/workflows/test-php.yml + permissions: + contents: read + + python: + needs: changes + if: needs.changes.outputs.python == 'true' + name: Python + uses: ./.github/workflows/test-python.yml + permissions: + contents: read + + ruby: + needs: changes + if: needs.changes.outputs.ruby == 'true' + name: Ruby + uses: ./.github/workflows/test-ruby.yml + permissions: + contents: read + + scala: + needs: changes + if: needs.changes.outputs.scala == 'true' + name: Scala + uses: ./.github/workflows/test-scala.yml + permissions: + contents: read + + typescript: + needs: changes + if: needs.changes.outputs.typescript == 'true' + name: TypeScript + uses: ./.github/workflows/test-typescript.yml + permissions: + contents: read + + # required status check にはこのジョブだけを指定する。 + # skip された言語は success 扱い、1 つでも失敗すればここで落ちる。 + all-checks: + if: always() + needs: + - changes + - golang + - java17 + - java8 + - php + - python + - ruby + - scala + - typescript + runs-on: ubuntu-latest + name: All checks passed + timeout-minutes: 5 + permissions: + contents: read + steps: + - name: Fail if any job did not succeed + run: | + failed="$(echo "${NEEDS}" | jq -r ' + to_entries[] + | select(.value.result != "success" and .value.result != "skipped") + | "\(.key): \(.value.result)" + ')" + if [ -n "${failed}" ]; then + echo "::error::following jobs did not succeed" + echo "${failed}" + exit 1 + fi + echo "all jobs succeeded or were skipped" + env: + NEEDS: ${{ toJSON(needs) }} diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml new file mode 100644 index 0000000..0cea498 --- /dev/null +++ b/.github/workflows/dependabot-auto-merge.yml @@ -0,0 +1,32 @@ +name: Dependabot Auto Merge + +on: + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +permissions: + contents: read + +jobs: + auto-merge: + if: github.event.pull_request.user.login == 'dependabot[bot]' + runs-on: ubuntu-latest + name: Enable auto merge + timeout-minutes: 5 + permissions: + contents: write + pull-requests: write + steps: + - uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0 + id: metadata + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + # major は人間がレビューする + - if: steps.metadata.outputs.update-type != 'version-update:semver-major' + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test-go.yml b/.github/workflows/test-go.yml index 4bd976a..befbde5 100644 --- a/.github/workflows/test-go.yml +++ b/.github/workflows/test-go.yml @@ -1,16 +1,7 @@ name: Go on: - pull_request: - paths: - - '.github/workflows/test-go.yml' - - 'golang/**.go' - - 'golang/go.mod' - - '.github/scripts/expect-order-scenario-failure.sh' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + workflow_call: permissions: contents: read diff --git a/.github/workflows/test-java17.yml b/.github/workflows/test-java17.yml index d631c47..7c2984f 100644 --- a/.github/workflows/test-java17.yml +++ b/.github/workflows/test-java17.yml @@ -1,16 +1,7 @@ name: Java 17 on: - pull_request: - paths: - - '.github/workflows/test-java17.yml' - - 'java17/src/**' - - 'java17/pom.xml' - - '.github/scripts/expect-order-scenario-failure.sh' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + workflow_call: permissions: contents: read diff --git a/.github/workflows/test-java8.yml b/.github/workflows/test-java8.yml index f944011..abd2226 100644 --- a/.github/workflows/test-java8.yml +++ b/.github/workflows/test-java8.yml @@ -1,16 +1,7 @@ name: Java 8 on: - pull_request: - paths: - - '.github/workflows/test-java8.yml' - - 'java8/src/**' - - 'java8/pom.xml' - - '.github/scripts/expect-order-scenario-failure.sh' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + workflow_call: permissions: contents: read diff --git a/.github/workflows/test-php.yml b/.github/workflows/test-php.yml index 6bb8a41..ee4f368 100644 --- a/.github/workflows/test-php.yml +++ b/.github/workflows/test-php.yml @@ -1,16 +1,7 @@ name: PHP on: - pull_request: - paths: - - '.github/workflows/test-php.yml' - - 'php/src/**' - - 'php/composer.json' - - '.github/scripts/expect-order-scenario-failure.sh' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + workflow_call: permissions: contents: read diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 5e6a0e5..e806006 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -1,16 +1,7 @@ name: Python on: - pull_request: - paths: - - '.github/workflows/test-python.yml' - - 'python/src/**' - - 'python/pyproject.toml' - - '.github/scripts/expect-order-scenario-failure.sh' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + workflow_call: permissions: contents: read diff --git a/.github/workflows/test-ruby.yml b/.github/workflows/test-ruby.yml index de00e2e..078810d 100644 --- a/.github/workflows/test-ruby.yml +++ b/.github/workflows/test-ruby.yml @@ -1,18 +1,7 @@ name: Ruby on: - pull_request: - paths: - - '.github/workflows/test-ruby.yml' - - 'ruby/lib/**' - - 'ruby/spec/**' - - 'ruby/Gemfile' - - 'ruby/Gemfile.lock' - - '.github/scripts/expect-order-scenario-failure.sh' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + workflow_call: permissions: contents: read diff --git a/.github/workflows/test-scala.yml b/.github/workflows/test-scala.yml index 9fce94a..cff03c6 100644 --- a/.github/workflows/test-scala.yml +++ b/.github/workflows/test-scala.yml @@ -1,17 +1,7 @@ name: Scala on: - pull_request: - paths: - - '.github/workflows/test-scala.yml' - - 'scala/src/**' - - 'scala/build.sbt' - - 'scala/project/**' - - '.github/scripts/expect-order-scenario-failure.sh' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + workflow_call: permissions: contents: read diff --git a/.github/workflows/test-typescript.yml b/.github/workflows/test-typescript.yml index 5df5fb6..64fd31e 100644 --- a/.github/workflows/test-typescript.yml +++ b/.github/workflows/test-typescript.yml @@ -1,18 +1,7 @@ name: TypeScript on: - pull_request: - paths: - - '.github/workflows/test-typescript.yml' - - 'typescript/src/**' - - 'typescript/package.json' - - 'typescript/tests/**' - - 'typescript/tsconfig.json' - - '.github/scripts/expect-order-scenario-failure.sh' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + workflow_call: permissions: contents: read