Skip to content

Commit 3c665a8

Browse files
committed
Add back .gitattributes and .github/workflows
1 parent 14656d6 commit 3c665a8

19 files changed

+815
-0
lines changed

.gitattributes

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Directories
2+
/.git export-ignore
3+
/.github export-ignore
4+
/.husky export-ignore
5+
/.vscode export-ignore
6+
/bin export-ignore
7+
/docs export-ignore
8+
/wp-hooks-docs export-ignore
9+
/node_modules export-ignore
10+
/release export-ignore
11+
/src export-ignore
12+
/tests export-ignore
13+
# /vendor export-ignore # do not ignore.
14+
15+
# Files
16+
/.* export-ignore
17+
/CHANGELOG.md export-ignore
18+
/classifai.zip export-ignore
19+
/CODE_OF_CONDUCT.md export-ignore
20+
/composer.json export-ignore
21+
/composer.lock export-ignore
22+
/CONTRIBUTING.md export-ignore
23+
/CREDITS.md export-ignore
24+
/LICENSE.md export-ignore
25+
/package-lock.json export-ignore
26+
/package.json export-ignore
27+
/phpcs-compat.xml.dist export-ignore
28+
/phpcs.xml.dist export-ignore
29+
/phpstan.neon.dist export-ignore
30+
/phpunit.xml.dist export-ignore
31+
/README.md export-ignore
32+
/tsconfig.json export-ignore
33+
/webpack.config.js export-ignore
34+
/wp-hooks-doc.json export-ignore

.github/workflows/build-docs.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build Developer Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- trunk
7+
8+
jobs:
9+
release:
10+
name: Push (merge) to trunk
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16+
17+
- name: Setup proper PHP version
18+
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
19+
with:
20+
php-version: 8.3
21+
22+
- name: Setup node
23+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
24+
with:
25+
node-version-file: .nvmrc
26+
27+
- name: Install dependencies and build assets
28+
run: |
29+
npm install
30+
npm run build
31+
npm run makepot
32+
composer install --no-dev -o
33+
34+
- name: Build docs
35+
run: |
36+
npm run build:docs
37+
38+
- name: Deploy docs update
39+
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
40+
with:
41+
github_token: ${{ secrets.GITHUB_TOKEN }}
42+
publish_dir: './docs/build'
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build release zip
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
7+
jobs:
8+
build_zip:
9+
name: Build release zip
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
15+
16+
- name: Setup node
17+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
18+
with:
19+
cache: 'npm'
20+
node-version-file: .nvmrc
21+
22+
- name: Cache node_modules
23+
id: cache-node-modules
24+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
25+
env:
26+
cache-name: cache-node-modules
27+
with:
28+
path: node_modules
29+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
30+
31+
- name: Get composer cache directory
32+
id: composer-cache
33+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
34+
35+
- name: Cache dependencies
36+
id: cache-composer
37+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
38+
env:
39+
cache-name: cache-composer
40+
with:
41+
path: ${{ steps.composer-cache.outputs.dir }}
42+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }}
43+
44+
- name: Install node dependencies
45+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
46+
run: npm ci --no-optional
47+
48+
- name: Install composer dependencies
49+
run: composer install --no-dev -o
50+
51+
- name: Build
52+
run: |
53+
npm run build
54+
npm run makepot
55+
npm run archive
56+
57+
- name: Upload the ZIP file as an artifact
58+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
59+
with:
60+
name: ${{ github.event.repository.name }}
61+
path: release
62+
retention-days: 2
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: 'Close stale issues'
2+
3+
# **What it does**: Closes issues where the original author doesn't respond to a request for information.
4+
# **Why we have it**: To remove the need for maintainers to remember to check back on issues periodically to see if contributors have responded.
5+
6+
on:
7+
schedule:
8+
# Schedule for every day at 1:30am UTC
9+
- cron: '30 1 * * *'
10+
11+
permissions:
12+
issues: write
13+
14+
jobs:
15+
stale:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
19+
with:
20+
days-before-stale: 7
21+
days-before-close: 7
22+
stale-issue-message: >
23+
It has been 7 days since more information was requested from you in this issue and we have not heard back. This issue is now marked as stale and will be closed in 7 days, but if you have more information to add then please comment and the issue will stay open.
24+
close-issue-message: >
25+
This issue has been automatically closed because there has been no response
26+
to our request for more information. With only the
27+
information that is currently in the issue, we don't have enough information
28+
to take action. Please reach out if you have or find the answers we need so
29+
that we can investigate further. See [this blog post on bug reports and the
30+
importance of repro steps](https://www.lee-dohm.com/2015/01/04/writing-good-bug-reports/)
31+
for more information about the kind of information that may be helpful.
32+
stale-issue-label: 'stale'
33+
close-issue-reason: 'not_planned'
34+
any-of-labels: 'reporter feedback'
35+
remove-stale-when-updated: true
36+
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ develop, trunk ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ develop ]
20+
schedule:
21+
- cron: '24 4 * * 5'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'javascript' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3.28.11
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
52+
53+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54+
# If this step fails, then you should remove it and run the build manually (see below)
55+
- name: Autobuild
56+
uses: github/codeql-action/autobuild@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3.28.11
57+
58+
# ℹ️ Command-line programs to run using the OS shell.
59+
# 📚 https://git.io/JvXDl
60+
61+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62+
# and modify them (or add more) to build your code if your project
63+
# uses a compiled language
64+
65+
#- run: |
66+
# make bootstrap
67+
# make release
68+
69+
- name: Perform CodeQL Analysis
70+
uses: github/codeql-action/analyze@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3.28.11

.github/workflows/cypress.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: E2E Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- trunk
8+
pull_request:
9+
branches:
10+
- develop
11+
12+
jobs:
13+
cypress:
14+
name: ${{ matrix.core.name }}
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
core:
19+
- {name: 'WP latest', version: 'latest'}
20+
- {name: 'WP minimum', version: 'WordPress/WordPress#6.7'}
21+
- {name: 'WP trunk', version: 'WordPress/WordPress#master'}
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
27+
- name: Install dependencies
28+
run: npm install
29+
30+
- name: Composer (optional)
31+
run: composer update -W
32+
continue-on-error: true
33+
34+
- name: Build (optional)
35+
run: npm run build
36+
continue-on-error: true
37+
38+
- name: Set the core version
39+
run: ./tests/bin/set-core-version.js ${{ matrix.core.version }}
40+
41+
- name: Set up WP environment
42+
run: npm run env:start
43+
44+
- name: Test
45+
run: npm run cypress:run
46+
47+
- name: Update summary
48+
run: |
49+
npx mochawesome-merge ./tests/cypress/reports/*.json -o tests/cypress/reports/mochawesome.json
50+
rm -rf ./tests/cypress/reports/mochawesome-*.json
51+
npx mochawesome-json-to-md -p ./tests/cypress/reports/mochawesome.json -o ./tests/cypress/reports/mochawesome.md -t ./tests/cypress/template.md
52+
npx mochawesome-report-generator tests/cypress/reports/mochawesome.json -o tests/cypress/reports/
53+
cat ./tests/cypress/reports/mochawesome.md >> $GITHUB_STEP_SUMMARY
54+
55+
- name: Upload artifacts
56+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
57+
if: failure()
58+
with:
59+
name: cypress-artifact-classifai
60+
retention-days: 7
61+
path: |
62+
${{ github.workspace }}/tests/cypress/screenshots/
63+
${{ github.workspace }}/tests/cypress/videos/
64+
${{ github.workspace }}/tests/cypress/logs/
65+
${{ github.workspace }}/tests/cypress/reports/
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Dependency Review Action
2+
#
3+
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
4+
#
5+
# Source repository: https://github.com/actions/dependency-review-action
6+
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
7+
name: 'Dependency Review'
8+
on: [pull_request]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
dependency-review:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: 'Checkout Repository'
18+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
20+
- name: Dependency Review
21+
uses: actions/dependency-review-action@72eb03d02c7872a771aacd928f3123ac62ad6d3a # v4.3.3
22+
with:
23+
license-check: true
24+
vulnerability-check: false
25+
config-file: 10up/.github/.github/dependency-review-config.yml@trunk

.github/workflows/eslint.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: JS Linting
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- trunk
8+
paths:
9+
- '**.js'
10+
- '**.json'
11+
pull_request:
12+
branches:
13+
- develop
14+
paths:
15+
- '**.js'
16+
- '**.json'
17+
18+
jobs:
19+
eslint:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
26+
- name: Setup node and npm cache
27+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
28+
with:
29+
node-version-file: .nvmrc
30+
cache: npm
31+
32+
- name: Install Node dependencies
33+
run: npm ci --omit=optional
34+
35+
- name: Get updated JS files
36+
id: changed-files
37+
uses: tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 # v46.0.1
38+
with:
39+
files: |
40+
**/*.js
41+
**/*.json
42+
43+
- name: Run JS linting
44+
run: |
45+
if [[ "${{ steps.changed-files.outputs.any_changed }}" == 'true' && "${{ github.event_name }}" == "pull_request" ]]; then
46+
npx wp-scripts lint-js ${{ steps.changed-files.outputs.all_changed_files }}
47+
elif [[ "${{ github.event_name }}" == "push" ]]; then
48+
npm run lint:js
49+
fi

0 commit comments

Comments
 (0)