Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next Gen GitHub Workflows #31

Merged
merged 1 commit into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 89 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,58 @@ on:
push:
pull_request:
jobs:
generate-checks-strategy:
name: Generate Checks
package-name:
name: Package Name
runs-on: ubuntu-latest
needs:
- lint-json
outputs:
package-name: ${{ steps.package-name.outputs.package-name }}
steps:
- uses: actions/checkout@v1
- id: package-name
run: |
printf "::set-output name=package-name::[\"%s\"]" $(docker run --rm -v "`pwd`:`pwd`" jess/jq jq -r -c '.name' "${GITHUB_WORKSPACE}/composer.json")
supported-versions-matrix:
name: Supported Versions Matrix
runs-on: ubuntu-latest
needs:
- lint-yaml
- lint-json
outputs:
version: ${{ steps.supported-versions-matrix.outputs.version }}
steps:
- uses: actions/checkout@v1
- id: supported-versions-matrix
uses: WyriHaximus/github-action-composer-php-versions-in-range@v1
supported-checks-matrix:
name: Supported Checks Matrix
runs-on: ubuntu-latest
needs:
- lint-yaml
- composer-install
outputs:
check: ${{ steps.generate-checks-strategy.outputs.check }}
check: ${{ steps.supported-checks-matrix.outputs.check }}
steps:
- uses: actions/checkout@v1
- id: generate-checks-strategy
- id: supported-checks-matrix
name: Generate check
run: |
printf "Checks found: %s\r\n" $(make task-list-ci)
printf "::set-output name=check::%s\r\n" $(make task-list-ci)
lint:
runs-on: ubuntu-latest
steps:
- name: Lint Code Base
uses: docker://github/super-linter:v2.2.0
printf "::set-output name=check::%s" $(make task-list-ci)
composer-install:
strategy:
fail-fast: false
matrix:
php: [7.4]
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
composer: [lowest, current, highest]
needs: lint
needs:
- lint-yaml
- lint-json
- supported-versions-matrix
runs-on: ubuntu-latest
container:
image: wyrihaximusnet/php:${{ matrix.php }}-zts-alpine3.12-dev-root
image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root
steps:
- uses: actions/checkout@v1
- name: Cache composer packages
Expand All @@ -50,15 +75,26 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.4]
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
composer: [lowest, current, highest]
check: ${{ fromJson(needs.generate-checks-strategy.outputs.check) }}
check: ${{ fromJson(needs.supported-checks-matrix.outputs.check) }}
needs:
- lint-yaml
- lint-json
- composer-install
- generate-checks-strategy
- supported-checks-matrix
- supported-versions-matrix
runs-on: ubuntu-latest
container:
image: wyrihaximusnet/php:${{ matrix.php }}-zts-alpine3.12-dev-root
image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 1s
--health-timeout 5s
--health-retries 50
steps:
- uses: actions/checkout@v1
- name: Cache composer packages
Expand All @@ -79,3 +115,39 @@ jobs:
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
if: matrix.check == 'backward-compatibility-check'
- run: make ${{ matrix.check }}
env:
REDIS_DSN: redis://redis:6379/6
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }}
lint-yaml:
name: Lint YAML
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: yaml-lint
uses: ibiqlik/action-yamllint@v3
with:
config_data: |
extends: default
rules:
line-length: disable
document-start: disable
truthy: disable
lint-json:
name: Lint JSON
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: json-syntax-check
uses: limitusus/json-syntax-check@v1
with:
pattern: "\\.json$"
check-mark:
name: ✔️
needs:
- lint-yaml
- lint-json
- qa
runs-on: ubuntu-latest
steps:
- run: echo "✔️"
30 changes: 15 additions & 15 deletions .github/workflows/label-sponsors.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Label sponsors ❤️
on:
pull_request:
types:
- opened
issues:
types:
- opened
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 }}
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 }}
64 changes: 13 additions & 51 deletions .github/workflows/set-milestone-on-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,60 +9,22 @@ on:
- edited
- ready_for_review
- review_requested
env:
INITIAL_TAG: 1.0.0
FALLBACK_TAG: not_found
DEPENDABOT_APP_ID: 49699333
jobs:
set-milestone:
name: Set Milestone
if: github.event.pull_request.milestone == null
runs-on: ubuntu-latest
outputs:
check: ${{ steps.generate-checks-strategy.outputs.check }}
steps:
- uses: actions/checkout@v1
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: ${{ env.FALLBACK_TAG }}
- name: 'Get next versions'
uses: "WyriHaximus/github-action-get-previous-tag@master"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: 'Get next minor version'
id: semvers
if: steps.previoustag.outputs.tag != env.FALLBACK_TAG
uses: "WyriHaximus/github-action-next-semvers@v1"
uses: "WyriHaximus/github-action-next-semvers@master"
with:
version: ${{ steps.previoustag.outputs.tag }}
- name: 'Decide which version fits this PR'
id: decidedversion
run: |
if [ "${PREVIOUS_TAG}" = "${FALLBACK_TAG}" ]; then
printf "::set-output name=version::%s" "${INITIAL_TAG}"
exit 0
fi

if [ "$(jq '.sender.id' -r ${GITHUB_EVENT_PATH})" = "${DEPENDABOT_APP_ID}" ]; then
printf "::set-output name=version::%s" "${PATCH}"
exit 0
fi

composer install --no-progress --ansi --no-interaction --prefer-dist -o -q

if ! (./vendor/bin/roave-backward-compatibility-check); then
printf "::set-output name=version::%s" "${MAJOR}"
exit 0
fi

printf "::set-output name=version::%s" "${MINOR}"
env:
PREVIOUS_TAG: ${{ steps.previoustag.outputs.tag }}
MAJOR: ${{ steps.semvers.outputs.major }}
MINOR: ${{ steps.semvers.outputs.minor }}
PATCH: ${{ steps.semvers.outputs.patch }}
- name: 'Set Milestone through Chores.Dev'
uses: "chores-dev/set-milestone-action@main"
with:
milestone: ${{ steps.decidedversion.outputs.version }}
- name: 'Get Milestones'
uses: "WyriHaximus/github-action-get-milestones@master"
id: milestones
Expand All @@ -72,24 +34,24 @@ jobs:
id: querymilestone
env:
MILESTONES: ${{ steps.milestones.outputs.milestones }}
MILESTONE: ${{ steps.decidedversion.outputs.version }}
MILESTONE: ${{ steps.semvers.outputs.minor }}
- name: 'Create Milestone'
if: steps.querymilestone.outputs.number == ''
id: createmilestone
uses: "WyriHaximus/github-action-create-milestone@v1"
uses: "WyriHaximus/github-action-create-milestone@master"
with:
title: ${{ steps.decidedversion.outputs.version }}
title: ${{ steps.semvers.outputs.minor }}
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: 'Select found or created Milestone'
id: selectmilestone
run: |
if [ $(echo ${QUERY_NUMBER} | wc -c) -eq 1 ] ; then
printf "::set-output name=number::%s" "${CREATED_NUMBER}"
exit 0
fi
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}"
printf "::set-output name=number::%s" "${QUERY_NUMBER}"
env:
CREATED_NUMBER: ${{ steps.createmilestone.outputs.number }}
QUERY_NUMBER: ${{ steps.querymilestone.outputs.number }}
Expand Down