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

Test process optimization #219

Merged
merged 3 commits into from
Jan 23, 2025
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
14 changes: 13 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
dependencies:
name: Dependencies checks
runs-on: ubuntu-latest
if: ${{ github.event_name != 'schedule' }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -67,6 +68,7 @@ jobs:
matrix:
package: ${{ fromJson(needs.settings.outputs.packages-names) }}
runs-on: ubuntu-latest
if: ${{ github.event_name != 'schedule' }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -112,6 +114,7 @@ jobs:
phpcs:
name: PHP CodeSniffer
runs-on: ubuntu-latest
if: ${{ github.event_name != 'schedule' }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -141,7 +144,14 @@ jobs:
name: Tests
uses: ./.github/workflows/phpunit.yml
with:
runs-on: '["ubuntu-latest", "windows-latest"]'
fast: ${{ github.event_name == 'schedule' }}

phpunit-windows:
name: Windows tests
uses: ./.github/workflows/phpunit.yml
with:
fast: true
runs-on: '["windows-latest"]'

phpunit-package:
name: Package tests
Expand All @@ -154,13 +164,15 @@ jobs:
package: ${{ fromJson(needs.settings.outputs.packages-names) }}
uses: ./.github/workflows/phpunit.yml
with:
fast: ${{ github.event_name == 'schedule' }}
package: ${{ matrix.package }}
packages-names: ${{ needs.settings.outputs.packages-names }}
packages-directory: ${{ needs.settings.outputs.packages-directory }}

markdownlint:
name: Markdownlint
runs-on: ubuntu-latest
if: ${{ github.event_name != 'schedule' }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
23 changes: 19 additions & 4 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ on:
required: false
type: string
default: '["ubuntu-latest"]'
fast:
description: "Run only for latest (default `false`)"
required: false
type: boolean
default: false

permissions:
contents: read
Expand Down Expand Up @@ -55,12 +60,18 @@ jobs:
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
# PHP
echo "php-versions=$(jq '.require."php" | split("|") | map(sub("^[^\\d]+"; "")) | sort' -c composer.json)" >> $GITHUB_OUTPUT
PHP_VERSIONS="$(jq '.require."php" | split("|") | map(sub("^[^\\d]+"; "")) | sort' -c composer.json)"

if [[ "${{ inputs.fast }}" = true ]]; then
PHP_VERSIONS="$(jq '. | sort[-1:]' -c <<< $PHP_VERSIONS)"
fi

echo "php-versions=$PHP_VERSIONS" >> $GITHUB_OUTPUT

# Dependencies
DEPS_HIGHEST="highest"
DEPS_LOCKED="$(if [ ! "${{ github.event_name }}" == "schedule" ] && [ -f "composer.lock" ]; then echo "locked"; fi)"
DEPS_LOWEST="$(if [ ! "${{ github.event_name }}" == "schedule" ]; then echo "lowest"; fi)"
DEPS_LOCKED="$(if [ ! "${{ inputs.fast }}" = true ] && [ -f "composer.lock" ]; then echo "locked"; fi)"
DEPS_LOWEST="$(if [ ! "${{ inputs.fast }}" = true ]; then echo "lowest"; fi)"

echo "dependencies=$(echo "[\"$DEPS_HIGHEST\", \"$DEPS_LOCKED\", \"$DEPS_LOWEST\"]" | jq "[.[] | select(length > 0)]" -r -c)" >> $GITHUB_OUTPUT

Expand All @@ -69,7 +80,11 @@ jobs:
echo "laravel-packages=$(jq '.require + ."require-dev" | to_entries | map(select( (.key | startswith("illuminate/")) or (.key == "laravel/framework "))) | map( .key ) | flatten | unique | sort ' -c composer.json)" >> $GITHUB_OUTPUT

# Optional packages
echo "optional-packages=$(jq '([((."extra"."lara-asp"."ci"."optional-packages" // ["null"]) | flatten | unique | sort | join(","))] + ["null"]) | unique' -r -c composer.json)" >> $GITHUB_OUTPUT
if [[ "${{ inputs.fast }}" = true ]]; then
echo "optional-packages=[\"null\"]" >> $GITHUB_OUTPUT
else
echo "optional-packages=$(jq '([((."extra"."lara-asp"."ci"."optional-packages" // ["null"]) | flatten | unique | sort | join(","))] + ["null"]) | unique' -r -c composer.json)" >> $GITHUB_OUTPUT
fi

run:
# Only 28 characters are visible on UI :(
Expand Down
Loading