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

Update Build, test & measure workflow #7649

Merged
merged 26 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0827b10
Add setup-node composite action
thelovekesh Oct 29, 2023
d82e007
Add setup-php-composer composite action
thelovekesh Oct 29, 2023
b0b405b
Add determine-changed-files composite action
thelovekesh Oct 29, 2023
7c75ea6
Remove release-changelog script and draft-release action
thelovekesh Oct 29, 2023
108839f
Add steps to checkout in determine-file-counts composite action
thelovekesh Oct 29, 2023
04fbd20
Update build-test-measure.yml
thelovekesh Oct 29, 2023
1fa6cb4
Revert adding checkout to composite action
thelovekesh Oct 29, 2023
2ceff83
Add shell as bash in composite actions
thelovekesh Oct 29, 2023
70bb977
Fix determine-modified-files-count.php script path
thelovekesh Oct 29, 2023
38ce492
Fix markup in the PR comment for plugin builds
thelovekesh Oct 29, 2023
97da286
Fix cache path for composer files
thelovekesh Oct 29, 2023
b1835ff
Add compsite action to build and cache plugin assets
thelovekesh Oct 29, 2023
e79885e
Avoid caching npm packages as node_modules are being cached now
thelovekesh Oct 30, 2023
f1ab1bd
Add workflow to delete runner caches
thelovekesh Oct 30, 2023
cec2657
Update warning text for plugin builds
thelovekesh Oct 30, 2023
adc6d27
Update permissions on job levels; Use github-script action to interac…
thelovekesh Oct 30, 2023
a403b03
Fix unexpected EOF bash error
thelovekesh Oct 30, 2023
f8e7116
Update checks permission on lint:js job
thelovekesh Oct 30, 2023
3eecef9
Fix syntax error in github-script
thelovekesh Oct 30, 2023
286cde1
Update permissions on all workflows
thelovekesh Oct 30, 2023
45843e5
Fix code snippet rendering in GH markdown
thelovekesh Oct 30, 2023
87b98fa
Add security-events to write on CodeQL jobs
thelovekesh Oct 30, 2023
ae84b4e
Update cache key for assets dir in root only
thelovekesh Oct 30, 2023
fe38902
Update e2e tests job to run in matrix
thelovekesh Oct 30, 2023
6ae9f48
Remove runInBand from e2e tests command
thelovekesh Oct 30, 2023
c86bdb1
Update tools names
thelovekesh Oct 30, 2023
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
84 changes: 84 additions & 0 deletions .github/actions/determine-changed-files/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Determine count of changed files

description: Determine count of changed files based on the current branch and the base branch

outputs:
count:
description: The count of changed files
value: ${{ steps.determine-file-counts.outputs.count }}
php-count:
description: The count of changed PHP files
value: ${{ steps.determine-file-counts.outputs.php-count }}
css-count:
description: The count of changed CSS files
value: ${{ steps.determine-file-counts.outputs.css-count }}
js-count:
description: The count of changed JS files
value: ${{ steps.determine-file-counts.outputs.js-count }}
gha-workflow-count:
description: The count of changed GHA workflow files
value: ${{ steps.determine-file-counts.outputs.gha-workflow-count }}

runs:
using: 'composite'
steps:
- name: Fetch base branch
# Only fetch base ref if it's a PR.
if: ${{ github.base_ref != null }}
shell: bash
run: git fetch --depth=1 --no-tags origin ${{ github.base_ref }}

- name: Determine modified files for PR
if: ${{ github.base_ref != null }}
shell: bash
run: echo "MODIFIED_FILES=$(git diff --name-only FETCH_HEAD HEAD | base64 -w 0)" >> $GITHUB_ENV

- name: Determine modified files for commit
if: ${{ github.base_ref == null }}
shell: bash
run: echo "MODIFIED_FILES=$(git diff --name-only HEAD~1 HEAD | base64 -w 0)" >> $GITHUB_ENV

- name: Determine if modified files should make the workflow run continue
id: determine-file-counts
shell: bash
run: |
# Get modified files.
MODIFIED_FILES=$(echo "$MODIFIED_FILES" | base64 -d)

# Determine file counts.
FILE_COUNT=$(php -f ./.github/actions/determine-changed-files/determine-modified-files-count.php "$IGNORE_PATH_REGEX" "$MODIFIED_FILES" --invert)
PHP_FILE_COUNT=$(php -f ./.github/actions/determine-changed-files/determine-modified-files-count.php ".+\.php|composer\.(json|lock)|phpstan\.neon\.dist" "$MODIFIED_FILES")
CSS_FILE_COUNT=$(php -f ./.github/actions/determine-changed-files/determine-modified-files-count.php ".+\.s?css|package\.json|package-lock\.json" "$MODIFIED_FILES")
JS_FILE_COUNT=$(php -f ./.github/actions/determine-changed-files/determine-modified-files-count.php ".+\.(js|snap)|package\.json|package-lock\.json" "$MODIFIED_FILES")
GHA_WORKFLOW_COUNT=$(php -f ./.github/actions/determine-changed-files/determine-modified-files-count.php "(\.github\/workflows\/.+\.yml)" "$MODIFIED_FILES")

# Set output variables.
echo "count=$FILE_COUNT" >> $GITHUB_OUTPUT
echo "php-count=$PHP_FILE_COUNT" >> $GITHUB_OUTPUT
echo "css-count=$CSS_FILE_COUNT" >> $GITHUB_OUTPUT
echo "js-count=$JS_FILE_COUNT" >> $GITHUB_OUTPUT
echo "gha-workflow-count=$GHA_WORKFLOW_COUNT" >> $GITHUB_OUTPUT

# Add modified files summary.
echo "# Modified files summary" >> $GITHUB_STEP_SUMMARY
echo "## Modified files" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "$MODIFIED_FILES" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "## Modified files count" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "Total modified files: $FILE_COUNT" >> $GITHUB_STEP_SUMMARY
echo "PHP files: $PHP_FILE_COUNT" >> $GITHUB_STEP_SUMMARY
echo "CSS files: $CSS_FILE_COUNT" >> $GITHUB_STEP_SUMMARY
echo "JS files: $JS_FILE_COUNT" >> $GITHUB_STEP_SUMMARY
echo "GHA workflow files: $GHA_WORKFLOW_COUNT" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
env:
# Ignore Paths:
# - .github/
# - !.github/actions
# - !.github/workflows
# - .github/actions/draft-release/
# - .wordpress-org/
# - docs/
IGNORE_PATH_REGEX: \.github\/(?!actions|workflows)|\.wordpress-org\/|docs\/|\.github\/actions\/draft-release\/
23 changes: 0 additions & 23 deletions .github/actions/draft-release/.eslintrc

This file was deleted.

2 changes: 0 additions & 2 deletions .github/actions/draft-release/.gitattributes

This file was deleted.

25 changes: 0 additions & 25 deletions .github/actions/draft-release/README.md

This file was deleted.

15 changes: 0 additions & 15 deletions .github/actions/draft-release/action.yml

This file was deleted.

Loading
Loading