Skip to content

Commit

Permalink
Merge pull request #1182 from Shadow243/merge-v2-2-0-with-2-x
Browse files Browse the repository at this point in the history
Merge tag v2.2.0 into 2.x
  • Loading branch information
kroky authored Aug 21, 2024
2 parents 15c2d20 + 39ab928 commit b30b176
Show file tree
Hide file tree
Showing 207 changed files with 7,560 additions and 4,044 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/data/
.git
17 changes: 11 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,22 @@ DYNAMIC_MAIL_SUBDOMAIN=""
#github.com
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_REDIRECT_URI=
GITHUB_REDIRECT_URI=http://localhost/?page=home
GITHUB_AUTH_URL=https://github.com/login/oauth/authorize
GITHUB_AUTH_URL=https://github.com/login/oauth/access_token
GITHUB_TOKEN_URL=https://github.com/login/oauth/access_token

#gmail
GMAIL_CLIENT_ID=
GMAIL_CLIENT_SECRET=
GMAIL_CLIENT_URI=
GMAIL_CLIENT_URI=http://localhost/?page=home
GMAIL_AUTH_URI=https://accounts.google.com/o/oauth2/auth
GMAIL_TOKEN_URI=https://www.googleapis.com/oauth2/v3/token
GMAIL_REFRESH_URI=https://www.googleapis.com/oauth2/v3/token

#aoutlook
OUTLOOK_CLIENT_ID=
OUTLOOK_CLIENT_SECRET=
OUTLOOK_CLIENT_URI=
OUTLOOK_CLIENT_URI=http://localhost/?page=home
OUTLOOK_AUTH_URI=https://login.live.com/oauth20_authorize.srf
OUTLOOK_TOKEN_URI=https://login.live.com/oauth20_token.srf
OUTLOOK_REFRESH_URI=https://login.live.com/oauth20_token.srf
Expand Down Expand Up @@ -191,7 +191,12 @@ WORDPRESS_CLIENT_URI=
RECAPTCHA_SECRET=
RECAPTCHA_SITE_KEY=

CYPHT_MODULES="core,contacts,local_contacts,ldap_contacts,gmail_contacts,feeds,jmap,imap,smtp,account,idle_timer,desktop_notifications,calendar,themes,nux,developer"
CYPHT_MODULES="core,contacts,local_contacts,ldap_contacts,gmail_contacts,feeds,jmap,imap,smtp,account,idle_timer,desktop_notifications,calendar,themes,nux,developer,profiles,imap_folders,sievefilters"

#LoginPage
FANCY_LOGIN=false
FANCY_LOGIN=false

#Windows CA certificates
#Get ON https://curl.se/ca/cacert.pem
#Depending on your PHP Directory, e.g. "c:\php\extras\ssl\cacert.pem"
WIN_CACERT_DIR=
11 changes: 6 additions & 5 deletions .github/tests/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ APP_NAME=Cypht
DB_CONNECTION_TYPE=host
DB_DRIVER=mysql
DB_PORT=
DB_HOST=localhost
DB_HOST=127.0.0.1
DB_NAME=cypht_test
DB_USER=cypht_test
DB_PASS=cypht_test
DB_SOCKET=/var/lib/mysqld/mysqld.sock
DB_SOCKET=/tmp/test.db

SESSION_TYPE=PHP
AUTH_TYPE=IMAP
AUTH_TYPE=DB
LDAP_AUTH_SERVER=localhost
LDAP_AUTH_PORT=389
LDAP_AUTH_TLS=
Expand All @@ -28,7 +28,7 @@ DEFAULT_SMTP_PORT=
DEFAULT_SMTP_TLS=
DEFAULT_SMTP_NO_AUTH=

USER_CONFIG_TYPE=file
USER_CONFIG_TYPE=DB
USER_SETTINGS_DIR=/tmp
ATTACHMENT_DIR=/tmp
APP_DATA_DIR=/tmp
Expand Down Expand Up @@ -147,7 +147,7 @@ GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_REDIRECT_URI=
GITHUB_AUTH_URL=https://github.com/login/oauth/authorize
GITHUB_AUTH_URL=https://github.com/login/oauth/access_token
GITHUB_TOKEN_URL=https://github.com/login/oauth/access_token

#gmail
GMAIL_CLIENT_ID=
Expand Down Expand Up @@ -183,3 +183,4 @@ WORDPRESS_CLIENT_URI=

RECAPTCHA_SECRET=
RECAPTCHA_SITE_KEY=
CYPHT_MODULES="core,contacts,local_contacts,feeds,imap,smtp,account,idle_timer,calendar,themes,nux,history,saved_searches,advanced_search,profiles,inline_message,imap_folders,keyboard_shortcuts,tags"
13 changes: 12 additions & 1 deletion .github/tests/selenium/creds.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
chrome_options.BinaryLocation = "/usr/bin/google-chrome"
chrome_options.add_argument("--window-size=3200,3800")

chrome_options.headless = False
chrome_options.add_argument("start-maximized")
# options.add_experimental_option("detach", True)
chrome_options.add_argument("--no-sandbox")
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
chrome_options.add_experimental_option('excludeSwitches', ['enable-logging'])
chrome_options.add_experimental_option('useAutomationExtension', False)
chrome_options.add_argument('--disable-blink-features=AutomationControlled')

RECIP='testuser@localhost.org'
IMAP_ID='0'
DRIVER_CMD =Service('/usr/bin/chromedriver')
SITE_URL = 'http://cypht-test.org'
SITE_URL = 'http://cypht-test.org/'
USER = 'testuser'
PASS = 'testuser'
DESIRED_CAP = None
Expand All @@ -22,3 +32,4 @@ def get_driver(cap):

def success(driver):
pass

8 changes: 4 additions & 4 deletions .github/tests/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ setup_cypht() {
cp .github/tests/.env .
if [ "$DB" = "postgres" ]; then
# .env
sed -i 's/db_driver=mysql/db_driver=pgsql/' .env
sed -i 's/DB_DRIVER=mysql/DB_DRIVER=pgsql/' .env
# mocks.php
sed -i 's/mysql/pgsql/' tests/phpunit/mocks.php
fi
if [ "$DB" = "sqlite" ]; then
# .env
sed -i 's/db_driver=mysql/db_driver=sqlite/' .env
sed -i 's/DB_DRIVER=mysql/DB_DRIVER=sqlite/' .env
# mocks.php
sed -i 's/mysql/sqlite/' tests/phpunit/mocks.php
sed -i "s/'host'/'socket'/" tests/phpunit/mocks.php
Expand Down Expand Up @@ -125,7 +125,7 @@ setup_site() {
sudo cp .github/tests/selenium/nginx/php_fastcgi.conf /etc/nginx/nginxconfig/php_fastcgi.conf
sudo sed -e "s?%VERSION%?${PHP_V}?g" --in-place /etc/nginx/sites-available/default
sudo ln -sf "$(pwd)" /var/www/cypht
sudo systemctl start nginx.service
sudo systemctl start nginx
if [ "$(curl -s -o /dev/null -w '%{http_code}' 'http://cypht-test.org')" -eq 200 ]; then
STATUS_DONE
else
Expand Down Expand Up @@ -161,7 +161,7 @@ case "$ARG" in
phpunit)
setup_unit_tests
;;
ui)
selenium)
setup_ui_tests
;;
*)
Expand Down
3 changes: 2 additions & 1 deletion .github/tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ phpunit_tests() {
}

selenium_tests() {
cp .github/tests/selenium/creds.py tests/selenium/
cd tests/selenium/ && sh ./runall.sh && cd ../../
}

Expand All @@ -18,7 +19,7 @@ case "$ARG" in
phpunit)
phpunit_tests
;;
ui)
selenium)
selenium_tests
;;
*)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Nightly-Image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
php-versions: ['7.4']
php-versions: ['8.1']
arch: ['x64', 'aarch64']

steps:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/Test-Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

strategy:
matrix:
php-versions: ['7.4']
php-versions: ['8.1']
database: ['mysql', 'postgres', 'sqlite']

env:
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:

strategy:
matrix:
php-versions: ['7.4']
php-versions: ['8.1']
database: ['sqlite']

env:
Expand Down Expand Up @@ -133,6 +133,7 @@ jobs:
- name: "Composer Install Dependencies"
run: |
composer install
php scripts/config_gen.php
- name: "Script: setup.sh"
run: bash .github/tests/setup.sh
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Package

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: curl, fileinfo, iconv, json, mbstring, openssl, session, pdo, sodium, xml, sqlite, pdo_mysql, pdo_pgsql, memcached, redis, gd, gnupg, imagick, bcmath, tidy, soap, xdebug
tools: phpunit, composer
ini-values: cgi.fix_pathinfo=1

- name: Copy .env.example to .env
run: cp .env.example .env

- name: Install Composer dependencies
run: composer install --no-dev --optimize-autoloader

- name: Create tarball
run: tar -czvf cypht.tar.gz ./*

- name: Upload release asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./cypht.tar.gz
asset_name: cypht.tar.gz
asset_content_type: application/gzip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/config/dynamic.php
/config/app.php
/site.js
/site.css
/site/
Expand All @@ -9,6 +8,8 @@
/tests/selenium/remote_creds.py
*.pyc
/.env
/.env.*
!.env.example
apigen4.sh
testuser.txt
website/docs
Expand All @@ -25,3 +26,5 @@ scripts/test.php
composer.phar
lib/hm3/users/
.env
/data/
/docker/data/
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ php:
#- '5.6'
#- '7.0'
#- '7.1'
- '7.2'
- '7.3'
- '7.4'
# - '7.2'
# - '7.3'
# - '7.4'
- '8.0'
- '8.1'

Expand Down Expand Up @@ -44,7 +44,7 @@ after_script:

# unit test coverage reporting
after_success:
- if [ "$TRAVIS_PHP_VERSION" = "7.4" ] && [ "$DB" = "mysql" ]; then php coveralls.phar -v; fi
- if [ "$TRAVIS_PHP_VERSION" = "8.1" ] && [ "$DB" = "mysql" ]; then php coveralls.phar -v; fi

# use browserstack
addons:
Expand Down
2 changes: 1 addition & 1 deletion .travis/.env
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_REDIRECT_URI=
GITHUB_AUTH_URL=https://github.com/login/oauth/authorize
GITHUB_AUTH_URL=https://github.com/login/oauth/access_token
GITHUB_TOKEN_URL=https://github.com/login/oauth/access_token

#gmail
GMAIL_CLIENT_ID=
Expand Down
3 changes: 3 additions & 0 deletions .travis/phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<phpunit strict="false" colors="true">
<php>
<const name="CYPHT_PHPUNIT_TEST_MODE" value="phpunit"/>
</php>
<testsuite name="session">
<file>./session.php</file>
</testsuite>
Expand Down
2 changes: 1 addition & 1 deletion .travis/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ selenium_tests() {

BUILD="$DB$TRAVIS_PHP_VERSION"
case "$BUILD" in
postgresql7.4)
postgresql8.1)
#phpunit_tests && selenium_tests
phpunit_tests
;;
Expand Down
6 changes: 3 additions & 3 deletions .travis/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ setup_memcached() {

# PHP tweaks based on versions
setup_php() {
if [ "$TRAVIS_PHP_VERSION" = "7.4" ]; then
sudo apt-get install php7.4-gd
if [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
sudo apt-get install php8.1-gd
fi
}

Expand Down Expand Up @@ -245,7 +245,7 @@ setup_all_tests() {

BUILD="$DB$TRAVIS_PHP_VERSION"
case "$BUILD" in
postgresql7.4)
postgresql8.1)
#setup_all_tests
setup_unit_tests
;;
Expand Down
2 changes: 1 addition & 1 deletion INSTALL
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Requirements
------------

Cypht requires at least PHP 7.4, with the OpenSSL and cURL extensions. You will
Cypht requires at least PHP 8.1, with the OpenSSL and cURL extensions. You will
also need PDO support if using any database features. Testing is done on
Debian and Ubuntu platforms with Nginx, Apache, standard PHP, and HHVM. We also
use Composer to manage our few PHP dependencies.
Expand Down
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

DOCKERHUB_REPO=cypht/cypht

.PHONY: docker-up
docker-up: ## start docker stack in foreground for development
docker compose -f docker-compose.dev.yaml up --build || true # --abort-on-container-exit

.PHONY: docker-push
.ONESHELL:
docker-push: ## build, tag, and push image to dockerhub. presumes you are logged in. run with a version like tag:1.2.3
@[ "$(tag)" = "" ] && (echo "Tag required. Example tag=1.2.3" ; exit 1)
@image=$(DOCKERHUB_REPO):$(tag)
@echo "Building image $${image}"
@docker buildx build . --platform linux/amd64 \
-t $${image} -f docker/Dockerfile --push
# TODO: build for arm architectures

.PHONY: dockerhub-push-readme
.ONESHELL:
dockerhub-push-readme: ## upload readme to dockerhub
docker pushrm --file docker/DOCKERHUB-README.md $(DOCKERHUB_REPO)

.PHONY: setup
.ONESHELL:
setup: ## locally setup app and users. presumes env vars are set
set -e
echo "Installing dependencies"
composer install
echo "Creating tables and user"
./scripts/setup_database.php
echo "Creating directories and configs"
./scripts/setup_system.sh

help: ## get help
@grep -E '^[a-zA-Z_-]+:.*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Loading

0 comments on commit b30b176

Please sign in to comment.