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

Use centralize GitHub Actions Workflows #47

Merged
merged 1 commit into from
Apr 2, 2024
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
179 changes: 8 additions & 171 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,175 +6,12 @@ on:
- 'master'
- 'refs/heads/v[0-9]+.[0-9]+.[0-9]+'
pull_request:
## This workflow needs the `pull-request` permissions to work for the package diffing
## Refs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
permissions:
pull-requests: write
contents: read
jobs:
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@v4
- 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 }}
upcoming: ${{ steps.supported-versions-matrix.outputs.upcoming }}
steps:
- uses: actions/checkout@v4
- id: supported-versions-matrix
uses: WyriHaximus/github-action-composer-php-versions-in-range@v1
with:
upcomingReleases: true
supported-checks-matrix:
name: Supported Checks Matrix
runs-on: ubuntu-latest
needs:
- lint-yaml
outputs:
check: ${{ steps.supported-checks-matrix.outputs.check }}
steps:
- uses: actions/checkout@v4
- id: supported-checks-matrix
name: Generate check
run: |
printf "Checks found: %s\r\n" $(make task-list-ci)
printf "::set-output name=check::%s" $(make task-list-ci)
can-require:
name: Test we can require "${{ matrix.package-name }}" on PHP ${{ matrix.php }}
strategy:
fail-fast: false
matrix:
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
package-name: ${{ fromJson(needs.package-name.outputs.package-name) }}
needs:
- lint-yaml
- lint-json
- package-name
- supported-versions-matrix
runs-on: ubuntu-latest
container:
image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root
steps:
- uses: actions/checkout@v4
with:
path: checked_out_package
- name: Set Up composer.json
run: |
echo "{\"repositories\": [{\"name\": \"${{ matrix.package-name }}\",\"type\": \"path\",\"url\": \"./checked_out_package\"}]}" > composer.json
- name: Require package
if: needs.supported-versions-matrix.outputs.upcoming != matrix.php
run: |
composer require "${{ matrix.package-name }}:dev-${GITHUB_SHA}" --no-progress --ansi --no-interaction --prefer-dist -o || composer require "${{ matrix.package-name }}:dev-${GITHUB_REF_NAME}" --no-progress --ansi --no-interaction --prefer-dist -o
qa:
name: Run ${{ matrix.check }} on PHP ${{ matrix.php }} with ${{ matrix.composer }} dependency preference
strategy:
fail-fast: false
matrix:
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
composer: [lowest, locked, highest]
check: ${{ fromJson(needs.supported-checks-matrix.outputs.check) }}
needs:
- lint-yaml
- lint-json
- supported-checks-matrix
- supported-versions-matrix
runs-on: ubuntu-latest
container:
image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root
steps:
- uses: actions/checkout@v4
- uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.composer }}
- name: Fetch Tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
if: matrix.check == 'backward-compatibility-check'
- run: make ${{ matrix.check }} || true
if: needs.supported-versions-matrix.outputs.upcoming == matrix.php
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }}
- run: make ${{ matrix.check }}
if: needs.supported-versions-matrix.outputs.upcoming != matrix.php
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }}
tests-directly-on-os:
name: Run tests on PHP ${{ matrix.php }} with ${{ matrix.composer }} dependency preference (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
composer: [lowest, locked, highest]
needs:
- lint-yaml
- lint-json
- supported-checks-matrix
- supported-versions-matrix
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: pcov
extensions: intl, sodium
- uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.composer }}
- run: make unit-testing-raw || true
if: needs.supported-versions-matrix.outputs.upcoming == matrix.php
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }}
- run: make unit-testing-raw
if: needs.supported-versions-matrix.outputs.upcoming != matrix.php
env:
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@v4
- name: yaml-lint
uses: ibiqlik/action-yamllint@v3
with:
config_data: |
extends: default
ignore: |
/.git/
rules:
line-length: disable
document-start: disable
truthy: disable
lint-json:
name: Lint JSON
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: json-syntax-check
uses: limitusus/json-syntax-check@v2
with:
pattern: "\\.json$"
check-mark:
name: ✔️
needs:
- lint-yaml
- lint-json
- can-require
- qa
- tests-directly-on-os
runs-on: ubuntu-latest
steps:
- run: echo "✔️"
ci:
name: Continuous Integration
uses: WyriHaximus/github-workflows/.github/workflows/package.yaml@main
31 changes: 0 additions & 31 deletions .github/workflows/composer-diff.yaml

This file was deleted.

55 changes: 0 additions & 55 deletions .github/workflows/craft-release.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/markdown-check-links.yaml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/release-managment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release Management
on:
pull_request:
types:
- opened
- labeled
- unlabeled
- synchronize
- reopened
- milestoned
- demilestoned
- ready_for_review
milestone:
types:
- closed
permissions:
contents: write
issues: write
pull-requests: write
jobs:
release-managment:
name: Create Release
uses: WyriHaximus/github-workflows/.github/workflows/package-release-managment.yaml@main
with:
milestone: ${{ github.event.milestone.title }}
description: ${{ github.event.milestone.title }}
Loading
Loading