Skip to content

Commit ed35b18

Browse files
committed
Add GitHub workflows
1 parent 60c8372 commit ed35b18

6 files changed

Lines changed: 192 additions & 37 deletions

File tree

.github/workflows/linter.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Linter
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
10+
jobs:
11+
linter:
12+
runs-on: ubuntu-latest
13+
name: Super-Linter
14+
steps:
15+
- name: Checkout changes
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Run Super-Linter
21+
uses: github/super-linter@v4
22+
env:
23+
DEFAULT_BRANCH: main
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
VALIDATE_YAML: true
26+
VALIDATE_JSON: true
27+
VALIDATE_MARKDOWN: true
28+
VALIDATE_PHP_BUILTIN: true

.github/workflows/tests.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
name: Tests
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
10+
jobs:
11+
phpUnitTests:
12+
runs-on: ubuntu-latest
13+
name: Unit Tests / PHP ${{ matrix.phpVersion }} / Winter ${{ matrix.winterRelease }}
14+
strategy:
15+
max-parallel: 6
16+
matrix:
17+
phpVersion: ['8.1', '8.2', '8.3']
18+
winterRelease: ['develop']
19+
winterReleaseDir: ['develop']
20+
fail-fast: false
21+
env:
22+
phpExtensions: mbstring, intl, gd, xml, sqlite
23+
cacheKey: ext-cache-v1
24+
winterCmsRelease: develop
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
steps:
27+
- name: Checkout changes
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Move files to a fundamentals-plugin directory
33+
run: mkdir fundamentals-plugin && find . -mindepth 1 -maxdepth 1 ! -name 'fundamentals-plugin' -exec mv -t fundamentals-plugin -- {} +
34+
35+
- name: Setup cache environment
36+
id: extcache
37+
uses: shivammathur/cache-extensions@v1
38+
with:
39+
php-version: ${{ matrix.phpVersion }}
40+
extensions: ${{ env.phpExtensions }}
41+
key: ${{ env.cacheKey }}
42+
43+
- name: Cache extensions
44+
uses: actions/cache@v4
45+
with:
46+
path: ${{ steps.extcache.outputs.dir }}
47+
key: ${{ steps.extcache.outputs.key }}
48+
restore-keys: ${{ steps.extcache.outputs.key }}
49+
50+
- name: Install PHP and extensions
51+
uses: shivammathur/setup-php@v2
52+
with:
53+
php-version: ${{ matrix.phpVersion }}
54+
extensions: ${{ env.phpExtensions }}
55+
56+
- name: Install Winter CMS
57+
run: |
58+
wget https://github.com/wintercms/winter/archive/${{ matrix.winterRelease }}.zip
59+
unzip ${{ matrix.winterRelease }}.zip
60+
rm ${{ matrix.winterRelease }}.zip
61+
shopt -s dotglob
62+
mv winter-${{ matrix.winterReleaseDir }}/* ./
63+
rmdir winter-${{ matrix.winterReleaseDir }}
64+
shopt -u dotglob
65+
cp config/cms.php config/testing/cms.php
66+
mkdir -p plugins/numencode
67+
mv fundamentals-plugin plugins/numencode/fundamentals
68+
69+
- name: Get Composer cache directory
70+
id: composercache
71+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_ENV
72+
73+
- name: Cache dependencies
74+
uses: actions/cache@v4
75+
with:
76+
path: ${{ env.dir }}
77+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
78+
restore-keys: ${{ runner.os }}-composer-
79+
80+
- name: Install Composer dependencies
81+
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist
82+
83+
- name: Run unit tests
84+
run: php artisan winter:test -p NumenCode.Fundamentals --configuration=plugins/numencode/fundamentals/phpunit.xml

CHANGELOG.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
- Initial release of the **SyncOps Plugin**.
1111
- Features:
12-
- Support for Winter CMS.
13-
- Deployment of projects to remote servers via SSH and Git.
14-
- Remote database synchronization (pull from production to local).
15-
- Project backup and archive creation with timestamped filenames.
16-
- File and media synchronization between environments.
17-
- Configurable permissions handling for `root_user` and `web_user`.
18-
- Fully compatible with Winter CMS version `1.2.7`.
12+
- Support for Winter CMS.
13+
- Deployment of projects to remote servers via SSH and Git.
14+
- Remote database synchronization (pull from production to local).
15+
- Project backup and archive creation with timestamped filenames.
16+
- File and media synchronization between environments.
17+
- Configurable permissions handling for `root_user` and `web_user`.
18+
- Fully compatible with Winter CMS version `1.2.7`.
1919

2020
---
2121

README.md

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -462,19 +462,19 @@ details from this configuration to connect to the remote host.
462462
#### Behavior
463463
464464
* Checks if the remote working directory is **clean**:
465-
- If not, the process is aborted, and you will be prompted to run `syncops:project-pull`.
465+
- If not, the process is aborted, and you will be prompted to run `syncops:project-pull`.
466466
* Two deployment modes are supported:
467-
- **Full deploy (default)**: Puts the app in maintenance mode, clears caches,
467+
- **Full deploy (default)**: Puts the app in maintenance mode, clears caches,
468468
updates via Git, rebuilds caches, and brings the app back up.
469-
- **Fast deploy (`--fast`)**: Skips cache clearing/rebuilding, updates via Git directly.
469+
- **Fast deploy (`--fast`)**: Skips cache clearing/rebuilding, updates via Git directly.
470470
* **Deployment strategies**:
471-
- **Pull mode** (`branch_main` set to `false` in config): Runs `git pull`.
472-
- **Merge mode** (`branch_main` set to a branch name): Runs `git fetch` and `git merge origin/{branch}`.
473-
- If `branch` or `branch_prod` is configured, the remote branch is pushed back to origin after a successful merge.
471+
- **Pull mode** (`branch_main` set to `false` in config): Runs `git pull`.
472+
- **Merge mode** (`branch_main` set to a branch name): Runs `git fetch` and `git merge origin/{branch}`.
473+
- If `branch` or `branch_prod` is configured, the remote branch is pushed back to origin after a successful merge.
474474
* **Post-deploy steps**:
475-
- Runs Composer install (with `--no-dev` option) if `--composer` is specified or if `composer.lock` changed.
476-
- Runs migrations if `--migrate` is specified.
477-
- Adjusts file/folder ownership according to `permissions` config.
475+
- Runs Composer install (with `--no-dev` option) if `--composer` is specified or if `composer.lock` changed.
476+
- Runs migrations if `--migrate` is specified.
477+
- Adjusts file/folder ownership according to `permissions` config.
478478
479479
---
480480
@@ -487,10 +487,10 @@ made in the backend (pages, layouts, etc.) are saved as static `.htm` files.
487487
488488
This command performs the following actions:
489489
490-
1. Checks for and commits any untracked changes on the remote server.
491-
2. **Optionally** executes a `git pull` on the remote to ensure it's up-to-date before pushing.
492-
3. Pushes the committed changes from the remote server to your Git repository.
493-
4. **Optionally** fetches the changes and merges them into your current local branch.
490+
1. Checks for and commits any untracked changes on the remote server.
491+
2. **Optionally** executes a `git pull` on the remote to ensure it's up-to-date before pushing.
492+
3. Pushes the committed changes from the remote server to your Git repository.
493+
4. **Optionally** fetches the changes and merges them into your current local branch.
494494
495495
This streamlined workflow ensures you can quickly and safely retrieve and integrate content updates made directly
496496
on your production site, without manual intervention.
@@ -509,13 +509,13 @@ Before using this command, ensure your remote servers are properly configured in
509509
Laravel application's `config/syncops.php` file. The command will use the SSH connection
510510
details from this configuration to connect to the remote host.
511511
512-
### Arguments
512+
#### Arguments
513513
514514
| Argument | Description |
515515
|----------|--------------------------------------------------------------------------------------------------------------------------------------|
516516
| `server` | The name of the remote server (as defined in `config/syncops.php`).<br>Example: `php artisan syncops:project-pull production --pull` |
517517
518-
### Options
518+
#### Options
519519
520520
| Option | Description |
521521
|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -557,7 +557,7 @@ php artisan syncops:project-push [options]
557557
558558
By default, this will commit with the message **"Server changes"** and push them to your configured remote.
559559
560-
### Options
560+
#### Options
561561
562562
| Option | Description |
563563
|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -573,7 +573,7 @@ The recommended entries for the Scheduler are as follows:
573573
- create a backup of the database every day at 3 am and push it to a cloud
574574
- commit changes from the production environment every day at 4 am
575575
576-
```
576+
```php
577577
$schedule->command('syncops:project-backup dropbox --folder=files')->weeklyOn(1, '01:00');
578578
$schedule->command('syncops:db-push dropbox --folder=database')->daily()->at('02:00');
579579
$schedule->command('syncops:media-push dropbox')->daily()->at('03:00');
@@ -584,36 +584,42 @@ $schedule->command('syncops:project-push')->daily()->at('04:00');
584584
585585
## Dropbox setup
586586
587-
Dropbox is very easy to configure and upon the registration on https://www.dropbox.com/register
587+
Dropbox is very easy to configure and upon the registration on [Dropbox website](https://www.dropbox.com/register)
588588
it offers free 2GB of cloud storage space.
589589
In order to setup the Dropbox, complete the registration, add the
590590
[NumenCode Dropbox Adapter Plugin](https://packagist.org/packages/numencode/wn-dropboxadapter-plugin)
591591
and follow the [Installation steps here](https://github.com/numencode/wn-dropboxadapter-plugin/blob/main/README.md).
592592
593593
---
594594
595-
# Changelog
595+
## Changelog
596+
597+
All notable changes are documented in the [CHANGELOG](CHANGELOG.md).
598+
599+
---
600+
601+
## Contributing
596602
597-
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
603+
Please refer to the [CONTRIBUTING](CONTRIBUTING.md) guide for details on contributing to this project.
598604
599-
# Contributing
605+
---
600606
601-
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
607+
## Security
602608
603-
# Security
609+
If you identify any security issues, email info@numencode.com rather than using the issue tracker.
604610
605-
If you discover any security-related issues, please email info@numencode.com instead of using the issue tracker.
611+
---
606612
607-
# Author
613+
## Author
608614
609-
**NumenCode.SyncOps** plugin was created by and is maintained by [Blaz Orazem](https://www.orazem.si/).
615+
The **NumenCode.SyncOps** plugin is created and maintained by [Blaz Orazem](https://orazem.si/).
610616
611-
Please write an email to info@numencode.com about all the things concerning this project.
617+
For inquiries, contact: info@numencode.com
612618
613-
Follow [@blazorazem](https://twitter.com/blazorazem) on Twitter.
619+
---
614620
615-
# License
621+
## License
616622
617623
This project is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
618624
619-
[![MIT License](https://img.shields.io/github/license/numencode/wn-syncops-plugin?label=License&color=blue&style=flat-square&cacheSeconds=600)](https://github.com/numencode/wn-syncops-plugin/blob/main/LICENSE.md)
625+
[![License](https://img.shields.io/github/license/numencode/wn-syncops-plugin?style=flat-square&color=0099FF)](https://github.com/numencode/wn-syncops-plugin/blob/main/LICENSE.md)

phpunit.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
4+
backupGlobals="false"
5+
backupStaticAttributes="false"
6+
colors="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false"
12+
>
13+
<testsuites>
14+
<testsuite name="Plugin Unit Test Suite">
15+
<directory>./tests</directory>
16+
</testsuite>
17+
</testsuites>
18+
<php>
19+
<env name="APP_ENV" value="testing"/>
20+
<env name="CACHE_DRIVER" value="array"/>
21+
<env name="SESSION_DRIVER" value="array"/>
22+
</php>
23+
</phpunit>

tests/BoilerplateTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php namespace NumenCode\SyncOps\Tests;
2+
3+
use PluginTestCase;
4+
5+
class BoilerplateTest extends PluginTestCase
6+
{
7+
/**
8+
* Test boilerplate
9+
*/
10+
public function testBoilerplate(): void
11+
{
12+
$this->assertEquals(true, true);
13+
}
14+
}

0 commit comments

Comments
 (0)