Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from WyriHaximus/update-ci-workflow-to-latest-gen
Update CI workflow to latest generation
- Loading branch information
Showing
15 changed files
with
275 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
github: WyriHaximus | ||
github: WyriHaximus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,180 @@ | ||
name: Continuous Integration | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'master' | ||
- 'refs/heads/v[0-9]+.[0-9]+.[0-9]+' | ||
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@v3 | ||
- 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@v3 | ||
- 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.generate-checks-strategy.outputs.check }} | ||
check: ${{ steps.supported-checks-matrix.outputs.check }} | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- id: generate-checks-strategy | ||
- uses: actions/checkout@v3 | ||
- 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) | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Lint Code Base | ||
uses: docker://github/super-linter:v2.2.0 | ||
composer-install: | ||
can-require: | ||
name: Test we can require "${{ matrix.package-name }}" on PHP ${{ matrix.php }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: ["8.0", 8.1] | ||
composer: [lowest, current, highest] | ||
needs: lint | ||
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-alpine-dev-root | ||
image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Cache composer packages | ||
uses: actions/cache@v1 | ||
- uses: actions/checkout@v2 | ||
with: | ||
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 -o | ||
if: matrix.composer == 'lowest' | ||
- name: Install Dependencies | ||
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 -o | ||
if: matrix.composer == 'highest' | ||
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: ["8.0", 8.1] | ||
composer: [lowest, current, highest] | ||
check: ${{ fromJson(needs.generate-checks-strategy.outputs.check) }} | ||
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }} | ||
composer: [lowest, locked, highest] | ||
check: ${{ fromJson(needs.supported-checks-matrix.outputs.check) }} | ||
needs: | ||
- composer-install | ||
- generate-checks-strategy | ||
- lint-yaml | ||
- lint-json | ||
- supported-checks-matrix | ||
- supported-versions-matrix | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-alpine-dev-root | ||
image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Cache composer packages | ||
uses: actions/cache@v1 | ||
- uses: actions/checkout@v3 | ||
- uses: ramsey/composer-install@v2 | ||
with: | ||
path: ./vendor/ | ||
key: ${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} | ||
- 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' | ||
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@v3 | ||
- 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@v3 | ||
- 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@v3 | ||
- name: json-syntax-check | ||
uses: limitusus/json-syntax-check@v1 | ||
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 "✔️" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
etc/qa/.phpunit.result.cache | ||
var/* | ||
!var/.gitkeep | ||
vendor/ | ||
etc/qa/.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.