From 1e40c37c8fac4b9a9a1e69bf8cf37e8a748c7611 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Thu, 6 Aug 2020 13:00:52 +0200 Subject: [PATCH] Github Config --- .dependabot/config.yml | 13 --- .github/CODEOWNERS | 1 + .github/FUNDING.yml | 2 +- .github/boring-cyborg.yml | 60 +++++++++++ .github/dependabot.yml | 11 ++ .github/settings.yml | 115 +++++++++++++++++++++ .github/workflows/ci.yml | 49 +++++++-- .github/workflows/craft-release.yaml | 56 ++++++++++ .github/workflows/label-sponsors.yml | 18 ++++ .github/workflows/set-milestone-on-pr.yaml | 70 +++++++++++++ 10 files changed, 373 insertions(+), 22 deletions(-) delete mode 100644 .dependabot/config.yml create mode 100644 .github/CODEOWNERS create mode 100644 .github/boring-cyborg.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/settings.yml create mode 100644 .github/workflows/craft-release.yaml create mode 100644 .github/workflows/label-sponsors.yml create mode 100644 .github/workflows/set-milestone-on-pr.yaml diff --git a/.dependabot/config.yml b/.dependabot/config.yml deleted file mode 100644 index c9f37fa..0000000 --- a/.dependabot/config.yml +++ /dev/null @@ -1,13 +0,0 @@ -version: 1 -update_configs: - - package_manager: "php:composer" - directory: "/" - update_schedule: "live" - default_labels: - - "Dependencies ๐Ÿ“ฆ" - - "PHP ๐Ÿ˜" - version_requirement_updates: "widen_ranges" - automerged_updates: - - match: - dependency_type: "all" - update_type: "semver:minor" diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..fbfd285 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @WyriHaximus diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 9c4f1ea..6396afc 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -github: WyriHaximus \ No newline at end of file +github: WyriHaximus diff --git a/.github/boring-cyborg.yml b/.github/boring-cyborg.yml new file mode 100644 index 0000000..80bcb6b --- /dev/null +++ b/.github/boring-cyborg.yml @@ -0,0 +1,60 @@ +labelPRBasedOnFilePath: + "Documentation ๐Ÿ“š": + - README.md + - CONTRIBUTING.md + "Dependencies ๐Ÿ“ฆ": + - Dockerfile* + - composer.* + - package.json + - package-lock.json + - yarn.lock + "Docker ๐Ÿณ": + - Dockerfile* + - .docker/**/* + "Image ๐Ÿ–ผ": + - "**/*.gif" + - "**/*.jpg" + - "**/*.jpeg" + - "**/*.png" + - "**/*.webp" + "CSS ๐Ÿ‘ฉโ€๐ŸŽจ": + - "**/*.css" + "HTML ๐Ÿ‘ทโ€โ™€๏ธ": + - "**/*.htm" + - "**/*.html" + "NEON ๐Ÿฆนโ€โ™‚๏ธ": + - "**/*.neon" + "MarkDown ๐Ÿ“": + - "**/*.md" + "YAML ๐Ÿ„": + - "**/*.yml" + - "**/*.yaml" + "JSON ๐Ÿ‘จโ€๐Ÿ’ผ": + - "**/*.json" + "Go ๐Ÿน": + - "**/*.go" + "JavaScript ๐Ÿฆ": + - "**/*.js" + - package.json + - package-lock.json + - yarn.lock + "PHP ๐Ÿ˜": + - "**/*.php" + - composer.* + "Configuration โš™": + - .github/* + "CI ๐Ÿšง": + - .github/workflows/* + - .scrutinizer.yml + "Templates ๐ŸŒฒ": + - "**/*.twig" + - "**/*.tpl" + "Helm โ˜ธ": + - .helm/**/* + "Tests ๐Ÿงช": + - tests/**/* + "Source ๐Ÿ”ฎ": + - src/**/* + +labelerFlags: + labelOnPRUpdates: true diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..c4b1374 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "daily" + labels: + - "Dependencies ๐Ÿ“ฆ" + - "PHP ๐Ÿ˜" + versioning-strategy: "widen" + open-pull-requests-limit: 1 diff --git a/.github/settings.yml b/.github/settings.yml new file mode 100644 index 0000000..67ba9d3 --- /dev/null +++ b/.github/settings.yml @@ -0,0 +1,115 @@ +repository: + private: false + has_issues: true + has_wiki: false + has_downloads: true + default_branch: master + allow_squash_merge: false + allow_merge_commit: true + allow_rebase_merge: false + +# Labels: define labels for Issues and Pull Requests +labels: + - name: "Dependencies ๐Ÿ“ฆ" + color: 0025ff + description: "Pull requests that update a dependency file" + - name: "Image ๐Ÿ–ผ" + color: 00ffff + - name: "HTML ๐Ÿ‘ทโ€โ™€๏ธ" + color: ffffff + - name: "CSS ๐Ÿ‘ฉโ€๐ŸŽจ" + color: b3b3b3 + - name: "JavaScript ๐Ÿฆ" + color: ffff00 + - name: "Go ๐Ÿน" + color: 00ADD8 + - name: "JSON ๐Ÿ‘จโ€๐Ÿ’ผ" + color: 00ADD8 + - name: "NEON ๐Ÿฆนโ€โ™‚๏ธ" + color: CE3262 + - name: "MarkDown ๐Ÿ“" + color: 000000 + - name: "YAML ๐Ÿ„" + color: ff1aff + - name: "Templates ๐ŸŒฒ" + color: 009933 + - name: "Helm โ˜ธ" + color: 091C84 + - name: "Tests ๐Ÿงช" + color: ffe6e6 + - name: "Source ๐Ÿ”ฎ" + color: e6ffe6 + - name: "Configuration โš™" + color: b3b3cc + - name: "PHP ๐Ÿ˜" + color: 8892BF + description: "Hypertext Pre Processor" + - name: "Docker ๐Ÿณ" + color: 0db7ed + description: "Pull requests that relate to Docker" + - name: "CI ๐Ÿšง" + color: ffff00 + - name: "Feature ๐Ÿ—" + color: 66ff99 + - name: "Documentation ๐Ÿ“š" + color: 6666ff + - name: "Security ๐Ÿ•ต๏ธโ€โ™€๏ธ" + color: ff0000 + - name: "Hacktoberfest ๐ŸŽƒ" + color: 152347 + - name: "Bug ๐Ÿž" + color: d73a4a + description: "Something isn't working" + oldname: bug + - name: "Duplicate โ™Š" + color: cfd3d7 + description: "This issue or pull request already exists" + oldname: duplicate + - name: "Enhancement โœจ" + color: a2eeef + description: "New feature or request" + oldname: enhancement + - name: "Good First Issue" + color: 7057ff + description: "Good for newcomers" + oldname: "good first issue" + - name: "Help Wanted" + color: 008672 + description: "Extra attention is needed" + oldname: "help wanted" + - name: Invalid + color: e4e669 + description: "This doesn't seem right" + oldname: invalid + - name: "Question โ“" + color: d876e3 + description: "Further information is requested" + oldname: question + - name: "Will not be fixed ๐Ÿ›‘" + color: ffffff + description: "This will not be worked on" + oldname: wontfix + - name: "Sponsor Request โค๏ธ" + color: fedbf0 + description: "Issue/PR opened by sponsor" + +branches: + - name: master + protection: + required_pull_request_reviews: + required_approving_review_count: 1 + dismiss_stale_reviews: true + require_code_owner_reviews: true + # Required. Require status checks to pass before merging. Set to null to disable + required_status_checks: + # Required. Require branches to be up to date before merging. + strict: true + # Required. The list of status checks to require in order to merge into this branch + contexts: [] + # Required. Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable. + enforce_admins: true + # Required. Restrict who can push to this branch. Team and user restrictions are only available for organization-owned repositories. Set to null to disable. + restrictions: + apps: [] + users: [] + teams: [] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4fea97..dd8904a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,14 +3,32 @@ on: push: pull_request: jobs: + generate-checks-strategy: + name: Generate Checks + runs-on: ubuntu-latest + outputs: + check: ${{ steps.generate-checks-strategy.outputs.check }} + steps: + - uses: actions/checkout@v1 + - id: generate-checks-strategy + name: Generate check + run: | + printf "Checks found: %s\r\n" $(make task-list-ci) + printf "::set-output name=check::%s" $(make task-list-ci) + lint: + runs-on: ubuntu-latest + steps: + - name: Lint Code Base + uses: docker://github/super-linter:v2.2.0 composer-install: strategy: + fail-fast: false matrix: php: [7.4] composer: [lowest, current, highest] runs-on: ubuntu-latest container: - image: wyrihaximusnet/php:${{ matrix.php }}-zts-alpine3.10-dev-root + image: wyrihaximusnet/php:${{ matrix.php }}-zts-alpine3.12-dev-root steps: - uses: actions/checkout@v1 - name: Cache composer packages @@ -19,24 +37,27 @@ jobs: path: ./vendor/ key: ${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} - name: Install Dependencies - run: composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist + run: composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o if: matrix.composer == 'lowest' - name: Install Dependencies - run: composer install --ansi --no-progress --no-interaction --prefer-dist + run: composer install --ansi --no-progress --no-interaction --prefer-dist -o if: matrix.composer == 'current' - name: Install Dependencies - run: composer update --ansi --no-progress --no-interaction --prefer-dist + run: composer update --ansi --no-progress --no-interaction --prefer-dist -o if: matrix.composer == 'highest' qa: strategy: + fail-fast: false matrix: php: [7.4] composer: [lowest, current, highest] - qa: [lint, cs, stan, psalm, unit-ci, infection, composer-require-checker, composer-unused] - needs: composer-install + check: ${{ fromJson(needs.generate-checks-strategy.outputs.check) }} + needs: + - composer-install + - generate-checks-strategy runs-on: ubuntu-latest container: - image: wyrihaximusnet/php:${{ matrix.php }}-zts-alpine3.10-dev-root + image: wyrihaximusnet/php:${{ matrix.php }}-zts-alpine3.12-dev-root steps: - uses: actions/checkout@v1 - name: Cache composer packages @@ -44,4 +65,16 @@ jobs: with: path: ./vendor/ key: ${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} - - run: make ${{ matrix.qa }} + - name: Install Dependencies + run: (test -f vendor && true ) || composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o + if: matrix.composer == 'lowest' + - name: Install Dependencies + run: (test -f vendor && true ) || composer install --ansi --no-progress --no-interaction --prefer-dist -o + if: matrix.composer == 'current' + - name: Install Dependencies + run: (test -f vendor && true ) || composer update --ansi --no-progress --no-interaction --prefer-dist -o + if: matrix.composer == 'highest' + - name: Fetch Tags + run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true + if: matrix.check == 'backward-compatibility-check' + - run: make ${{ matrix.check }} diff --git a/.github/workflows/craft-release.yaml b/.github/workflows/craft-release.yaml new file mode 100644 index 0000000..9b14210 --- /dev/null +++ b/.github/workflows/craft-release.yaml @@ -0,0 +1,56 @@ +name: Create Release +env: + MILESTONE: ${{ github.event.milestone.title }} +on: + milestone: + types: + - closed +jobs: + generate-changelog: + name: Generate Changelog + runs-on: ubuntu-latest + outputs: + changelog: ${{ steps.changelog.outputs.changelog }} + steps: + - name: Generate changelog + uses: WyriHaximus/github-action-jwage-changelog-generator@v1 + id: changelog + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + milestone: ${{ env.MILESTONE }} + - name: Show changelog + run: echo "${CHANGELOG}" + env: + CHANGELOG: ${{ steps.changelog.outputs.changelog }} + create-release: + name: Create Release + needs: + - generate-changelog + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + env: + CHANGELOG: ${{ needs.generate-changelog.outputs.changelog }} + - run: | + echo -e "${MILESTONE_DESCRIPTION}\r\n\r\n${CHANGELOG}" > release-${{ env.MILESTONE }}-release-message.md + cat release-${{ env.MILESTONE }}-release-message.md + release_message=$(cat release-${{ env.MILESTONE }}-release-message.md) + release_message="${release_message//'%'/'%25'}" + release_message="${release_message//$'\n'/'%0A'}" + release_message="${release_message//$'\r'/'%0D'}" + echo "::set-output name=release_message::$release_message" + id: releasemessage + env: + MILESTONE_DESCRIPTION: ${{ github.event.milestone.description }} + CHANGELOG: ${{ needs.generate-changelog.outputs.changelog }} + - name: Create Reference Release with Changelog + uses: fleskesvor/create-release@feature/support-target-commitish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.MILESTONE }} + release_name: ${{ env.MILESTONE }} + body: ${{ steps.releasemessage.outputs.release_message }} + draft: false + prerelease: false diff --git a/.github/workflows/label-sponsors.yml b/.github/workflows/label-sponsors.yml new file mode 100644 index 0000000..37b050f --- /dev/null +++ b/.github/workflows/label-sponsors.yml @@ -0,0 +1,18 @@ +name: Label sponsors โค๏ธ +on: + pull_request: + types: + - opened + issues: + types: + - opened +jobs: + sponsor-label: + name: Label sponsors โค๏ธ + runs-on: ubuntu-latest + steps: + - uses: JasonEtco/is-sponsor-label-action@v1 + with: + label: Sponsor Request โค๏ธ + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/set-milestone-on-pr.yaml b/.github/workflows/set-milestone-on-pr.yaml new file mode 100644 index 0000000..571f5ce --- /dev/null +++ b/.github/workflows/set-milestone-on-pr.yaml @@ -0,0 +1,70 @@ +name: Set Milestone +on: + pull_request: + types: + - assigned + - opened + - synchronize + - reopened + - edited + - ready_for_review + - review_requested +jobs: + set-milestone: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + if: github.event.pull_request.milestone == null + - name: 'Get Previous tag' + if: github.event.pull_request.milestone == null + id: previoustag + uses: "WyriHaximus/github-action-get-previous-tag@master" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: 'Get next minor version' + if: github.event.pull_request.milestone == null + id: semvers + uses: "WyriHaximus/github-action-next-semvers@master" + with: + version: ${{ steps.previoustag.outputs.tag }} + - name: 'Get Milestones' + if: github.event.pull_request.milestone == null + uses: "WyriHaximus/github-action-get-milestones@master" + id: milestones + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - run: printf "::set-output name=number::%s" $(printenv MILESTONES | jq --arg MILESTONE $(printenv MILESTONE) '.[] | select(.title == $MILESTONE) | .number') + if: github.event.pull_request.milestone == null + id: querymilestone + env: + MILESTONES: ${{ steps.milestones.outputs.milestones }} + MILESTONE: ${{ steps.semvers.outputs.minor }} + - name: 'Create Milestone' + if: github.event.pull_request.milestone == null && steps.querymilestone.outputs.number == '' + id: createmilestone + uses: "WyriHaximus/github-action-create-milestone@master" + with: + title: ${{ steps.semvers.outputs.minor }} + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: 'Select found or created Milestone' + if: github.event.pull_request.milestone == null + id: selectmilestone + run: | + if [ $(echo ${QUERY_NUMBER} | wc -c) -eq 1 ] ; then + printf "::set-output name=number::%s" "${CREATED_NUMBER}" + exit 0 + fi + + printf "::set-output name=number::%s" "${QUERY_NUMBER}" + env: + CREATED_NUMBER: ${{ steps.createmilestone.outputs.number }} + QUERY_NUMBER: ${{ steps.querymilestone.outputs.number }} + - name: 'Set Milestone' + if: github.event.pull_request.milestone == null + uses: "WyriHaximus/github-action-set-milestone@master" + with: + issue_number: ${{ github.event.pull_request.number }} + milestone_number: ${{ steps.selectmilestone.outputs.number }} + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"