Skip to content

Commit 1f8ff09

Browse files
authored
Merge pull request #1 from stellarwp/feat/repo-set-up
Feat/repo set up
2 parents c7dc99a + 595877b commit 1f8ff09

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3022
-21
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = tab
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
10+
[*.md]
11+
trim_trailing_whitespace = true
12+
13+
[*.{neon,neon.dist}]
14+
indent_style = tab
15+
16+
[**.{jshintrc,json,scss-lint,yml}]
17+
indent_style = space
18+
indent_size = 2

.env.testing

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# This file will be consumed by both the CI and the tests.
2+
# Some environment variables might not apply to one but might apply to the other: modify with care.
3+
4+
# What version of WordPress we want to install and test against.
5+
# This has to be compatible with the `wp core download` command, see https://developer.wordpress.org/cli/commands/core/download/.
6+
WP_VERSION=latest
7+
8+
# This is where, in the context of the CI, we'll install and configure WordPress.
9+
# See `.travis.yml` for more information.
10+
WP_ROOT_FOLDER=/tmp/wordpress
11+
12+
# The WordPress installation will be served from the Docker container.
13+
# See `dev/docker/ci-compose.yml` for more information.
14+
WP_URL=http://localhost:8080
15+
WP_DOMAIN=localhost:8080
16+
17+
# The credentials that will be used to access the site in acceptance tests
18+
# in methods like `$I->loginAsAdmin();`.
19+
WP_ADMIN_USERNAME=admin
20+
WP_ADMIN_PASSWORD=password
21+
22+
WP_DB_PORT=4306
23+
24+
# The databse is served from the Docker `db` container.
25+
# See `dev/docker/ci-compose.yml` for more information.
26+
WP_TABLE_PREFIX=wp_
27+
WP_DB_HOST=127.0.0.1:4306
28+
WP_DB_NAME=wordpress
29+
WP_DB_USER=root
30+
WP_DB_PASSWORD=
31+
32+
# The test databse is served from the Docker `db` container.
33+
# See `dev/docker/ci-compose.yml` for more information.
34+
WP_TEST_DB_HOST=127.0.0.1:4306
35+
WP_TEST_DB_NAME=test
36+
WP_TEST_DB_USER=root
37+
WP_TEST_DB_PASSWORD=
38+
39+
# We're using Selenium and Chrome for acceptance testing.
40+
# In CI context we're starting a Docker container to handle that.
41+
# See the `dev/docker/ci-compose.yml` file.
42+
CHROMEDRIVER_HOST=localhost
43+
CHROMEDRIVER_PORT=4444
44+
45+
# The URL of the WordPress installation from the point of view of the Chromedriver container.
46+
# Why not just use `wordpress`? While Chrome will accept an `http://wordpress` address WordPress
47+
# will not, we call the WordPress container with a seemingly looking legit URL and leverage the
48+
# lines that, in the `wp-config.php` file, will make it so that WordPress will use as its home
49+
# URL whatever URL we reach it with.
50+
# See the `dev/docker/wp-config.php` template for more information.
51+
WP_CHROMEDRIVER_URL="wp.test"
52+
53+
# To run the tests let's force the background-processing lib to run in synchronous (single PHP thread) mode.
54+
TRIBE_NO_ASYNC=1
55+
56+
# We're using Docker to run the tests.
57+
USING_CONTAINERS=1

.env.testing.slic

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# This file will be consumed by both the CI and the tests.
2+
# Some environment variables might not apply to one but might apply to the other: modify with care.
3+
4+
# What version of WordPress we want to install and test against.
5+
# This has to be compatible with the `wp core download` command, see https://developer.wordpress.org/cli/commands/core/download/.
6+
WP_VERSION=latest
7+
8+
# This is where, in the context of the CI, we'll install and configure WordPress.
9+
# See `.travis.yml` for more information.
10+
WP_ROOT_FOLDER=/var/www/html
11+
12+
# The WordPress installation will be served from the Docker container.
13+
# See `dev/docker/ci-compose.yml` for more information.
14+
WP_URL=http://wordpress.test
15+
WP_DOMAIN=wordpress.test
16+
17+
# The credentials that will be used to access the site in acceptance tests
18+
# in methods like `$I->loginAsAdmin();`.
19+
WP_ADMIN_USERNAME=admin
20+
WP_ADMIN_PASSWORD=password
21+
22+
WP_DB_PORT=3306
23+
24+
# The databse is served from the Docker `db` container.
25+
# See `dev/docker/ci-compose.yml` for more information.
26+
WP_TABLE_PREFIX=wp_
27+
WP_DB_HOST=db
28+
WP_DB_NAME=test
29+
WP_DB_USER=root
30+
WP_DB_PASSWORD=password
31+
32+
# The test databse is served from the Docker `db` container.
33+
# See `dev/docker/ci-compose.yml` for more information.
34+
WP_TEST_DB_HOST=db
35+
WP_TEST_DB_NAME=test
36+
WP_TEST_DB_USER=root
37+
WP_TEST_DB_PASSWORD=password
38+
39+
# We're using Selenium and Chrome for acceptance testing.
40+
# In CI context we're starting a Docker container to handle that.
41+
# See the `dev/docker/ci-compose.yml` file.
42+
CHROMEDRIVER_HOST=chrome
43+
CHROMEDRIVER_PORT=4444
44+
45+
# The URL of the WordPress installation from the point of view of the Chromedriver container.
46+
# Why not just use `wordpress`? While Chrome will accept an `http://wordpress` address WordPress
47+
# will not, we call the WordPress container with a seemingly looking legit URL and leverage the
48+
# lines that, in the `wp-config.php` file, will make it so that WordPress will use as its home
49+
# URL whatever URL we reach it with.
50+
# See the `dev/docker/wp-config.php` template for more information.
51+
WP_CHROMEDRIVER_URL=http://wordpress.test
52+
53+
# To run the tests let's force the background-processing lib to run in synchronous (single PHP thread) mode.
54+
TRIBE_NO_ASYNC=1
55+
56+
# We're using Docker to run the tests.
57+
USING_CONTAINERS=1

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* text
2+
.* export-ignore
3+
composer.lock text -diff
4+
phpstan.* export-ignore
5+
phpunit.* export-ignore
6+
tests export-ignore
7+
codeception.* export-ignore
8+
phpcs.xml export-ignore
9+
phpstan.neon.dist export-ignore
10+
docs export-ignore
11+
schema-models.php export-ignore

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @dpanta94
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: PHP Compatibility
2+
on:
3+
pull_request:
4+
jobs:
5+
php-compatibility:
6+
name: PHP ${{ matrix.php-version }}
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
php-version: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Configure PHP environment
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: 7.4
19+
extensions: mbstring, intl
20+
coverage: none
21+
22+
- name: Get Composer Cache Directory
23+
id: composer-cache
24+
run: |
25+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
26+
27+
- uses: actions/cache@v4
28+
with:
29+
path: ${{ steps.composer-cache.outputs.dir }}
30+
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-composer-
33+
34+
- uses: ramsey/composer-install@v3
35+
with:
36+
composer-options: "--ignore-platform-reqs"
37+
dependency-versions: highest
38+
39+
- name: Run PHP Compatibility
40+
run: composer compatibility:php-${{ matrix.php-version }}

.github/workflows/phpcs.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 'PHPCS'
2+
on:
3+
pull_request:
4+
jobs:
5+
phpcs:
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
- uses: actions/checkout@v4
10+
with:
11+
fetch-depth: 0
12+
13+
- name: Composer install
14+
uses: php-actions/composer@v6
15+
with:
16+
php_version: 7.4
17+
php_extensions: zip mysqli
18+
args: --ignore-platform-reqs
19+
20+
- name: Fix and Push phpcbf issues
21+
continue-on-error: true
22+
run: |
23+
vendor/bin/phpcbf ./
24+
25+
- name: Commit & Push changes
26+
uses: actions-js/push@master
27+
continue-on-error: true
28+
with:
29+
github_token: ${{ secrets.GITHUB_TOKEN }}
30+
branch: ${{ github.head_ref }}
31+
32+
- name: PHP Code Sniffer
33+
run: |
34+
vendor/bin/phpcs ./ -s
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Static Analysis
2+
on:
3+
pull_request:
4+
jobs:
5+
phpstsan:
6+
name: phpstan
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v2
11+
- name: Configure PHP environment
12+
uses: shivammathur/setup-php@v2
13+
with:
14+
php-version: '8.0'
15+
extensions: mbstring, intl
16+
coverage: none
17+
- uses: ramsey/composer-install@v2
18+
with:
19+
composer-options: "--ignore-platform-reqs --optimize-autoloader"
20+
- name: Run PHPStan static analysis
21+
run: composer test:analysis

.github/workflows/tests-php.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: 'Tests'
2+
on:
3+
pull_request:
4+
jobs:
5+
test:
6+
strategy:
7+
matrix:
8+
suite:
9+
- wpunit
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout the repository
13+
uses: actions/checkout@v4
14+
# ------------------------------------------------------------------------------
15+
# Set up PHP to run slic
16+
# ------------------------------------------------------------------------------
17+
- name: Configure PHP environment
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: 7.4
21+
# ------------------------------------------------------------------------------
22+
# Checkout slic
23+
# ------------------------------------------------------------------------------
24+
- name: Checkout slic
25+
uses: actions/checkout@v4
26+
with:
27+
repository: stellarwp/slic
28+
ref: main
29+
path: slic
30+
fetch-depth: 1
31+
# ------------------------------------------------------------------------------
32+
# Prepare our composer cache directory
33+
# ------------------------------------------------------------------------------
34+
- name: Get Composer Cache Directory
35+
id: get-composer-cache-dir
36+
run: |
37+
echo "::set-output name=dir::$(composer config cache-files-dir)"
38+
- uses: actions/cache@v4
39+
id: composer-cache
40+
with:
41+
path: ${{ steps.get-composer-cache-dir.outputs.dir }}
42+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
43+
restore-keys: |
44+
${{ runner.os }}-composer-
45+
# ------------------------------------------------------------------------------
46+
# Initialize slic
47+
# ------------------------------------------------------------------------------
48+
- name: Set up slic env vars
49+
run: |
50+
echo "SLIC_BIN=${GITHUB_WORKSPACE}/slic/slic" >> $GITHUB_ENV
51+
echo "SLIC_WP_DIR=${GITHUB_WORKSPACE}/slic/_wordpress" >> $GITHUB_ENV
52+
echo "SLIC_WORDPRESS_DOCKERFILE=Dockerfile.base" >> $GITHUB_ENV
53+
- name: Set run context for slic
54+
run: echo "SLIC=1" >> $GITHUB_ENV && echo "CI=1" >> $GITHUB_ENV
55+
- name: Start ssh-agent
56+
run: |
57+
mkdir -p "${HOME}/.ssh";
58+
ssh-agent -a /tmp/ssh_agent.sock;
59+
- name: Export SSH_AUTH_SOCK env var
60+
run: echo "SSH_AUTH_SOCK=/tmp/ssh_agent.sock" >> $GITHUB_ENV
61+
- name: Set up slic for CI
62+
run: |
63+
cd ${GITHUB_WORKSPACE}/..
64+
${SLIC_BIN} here
65+
${SLIC_BIN} interactive off
66+
${SLIC_BIN} build-prompt off
67+
${SLIC_BIN} build-subdir off
68+
${SLIC_BIN} xdebug off
69+
${SLIC_BIN} debug on
70+
${SLIC_BIN} info
71+
${SLIC_BIN} config
72+
- name: Start the Chrome container
73+
run: ${SLIC_BIN} up chrome
74+
- name: Set up StellarWP Schema Models
75+
run: |
76+
${SLIC_BIN} use schema-models
77+
${SLIC_BIN} composer install
78+
- name: Init the WordPress container
79+
run: |
80+
${SLIC_BIN} up wordpress
81+
${SLIC_BIN} wp core version
82+
${SLIC_BIN} wp core update --force --version=6.7
83+
${SLIC_BIN} wp core version
84+
- name: Ensure Kadence is installed
85+
run: |
86+
${SLIC_BIN} wp theme install kadence --activate
87+
- name: Run suites
88+
run: ${SLIC_BIN} run ${{ matrix.suite }} --ext DotReporter

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
composer.lock
2+
vendor/
3+
tests/_support/_generated
4+
5+
# Dev tools
6+
.buildpath
7+
*.iml
8+
.project
9+
.idea/
10+
.vscode/
11+
12+
# Third party dependencies
13+
vendor/
14+
15+
# Tests
16+
codeception.yml
17+
tests/_output/*
18+
tests/*.suite.yml
19+
!tests/_data/*.sql
20+
tests/*.pem
21+
tests/*.cert
22+
tests/*.key
23+
24+
.DS_Store
25+
DOCKER_ENV
26+
Dockerfile-*
27+
output.log
28+
docker_tag

0 commit comments

Comments
 (0)