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

feat(other): nightly-image #1430

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
73 changes: 60 additions & 13 deletions .github/workflows/Nightly-Image.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,75 @@
name: Nightly-Image-Build

defaults:
run:
shell: bash
name: Build Daily Image

on:
pull_request_target:
workflow_call:
inputs:
php_version:
description: "PHP version to use for the build"
required: false
default: "latest"
type: string
schedule:
- cron: "0 0 * * *"
push:
branches:
- master
workflow_dispatch:

jobs:
Nightly-Image-Build:
name: Nightly-Image-${{ matrix.arch }}-PHP${{ matrix.php-versions }}
build-and-push:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: ['8.1']
arch: ['x64', 'aarch64']
php_version: [ "${{ inputs.php_version }}" ]

steps:
- name: "Checkout code"
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: "Build Nightly Image"
# Log in to Docker Hub using the username and Docker Token
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }} # Your Docker Hub username
password: ${{ secrets.DOCKER_PASSWORD }} # Your Docker Hub access token

# Set up Docker Buildx (after login)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# Check if DOCKER_USERNAME secret is available
- name: Check if DOCKER_USERNAME secret is available
run: |
echo "Publish each updated content to the nightly mirror, package and fix errors in time."
if [ -z "${{ secrets.DOCKER_USERNAME }}" ]; then
echo "DOCKER_USERNAME secret is NOT set or accessible!"
exit 1
else
echo "DOCKER_USERNAME secret is accessible."
fi

# Check if DOCKER_TOKEN secret is available
- name: Check if DOCKER_TOKEN secret is available
run: |
if [ -z "${{ secrets.DOCKER_TOKEN }}" ]; then
echo "DOCKER_TOKEN secret is NOT set or accessible!"
exit 1
else
echo "DOCKER_TOKEN secret is accessible."
fi

# Build and push Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
file: ./docker/Dockerfile
push: true
tags: cypht/cypht-daily:${{ matrix.php_version }}

- name: Log out from Docker Hub
run: docker logout
250 changes: 125 additions & 125 deletions .github/workflows/Test-Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,131 +16,131 @@ on:
workflow_dispatch:

jobs:
Test-phpunit:
name: PHPUNIT (PHP-${{ matrix.php-versions }} && DB-${{ matrix.database }})
runs-on: ubuntu-latest

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

env:
PHP_V: ${{ matrix.php-versions }}
DB: ${{ matrix.database }}
TEST_ARG: 'phpunit'

services:
mysql:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: cypht_test
MYSQL_DATABASE: cypht_test
MYSQL_USER: cypht_test
MYSQL_PASSWORD: cypht_test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

postgresql:
image: postgres:latest
env:
POSTGRES_USER: cypht_test
POSTGRES_PASSWORD: cypht_test
POSTGRES_DB: cypht_test
ports:
- 5432:5432
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: "System Install Dependencies"
run: sudo apt-get install -y mysql-client postgresql-client sqlite3 libsodium-dev

- name: "Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: "Set up PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: pdo, sodium, sqlite, pdo_mysql, pdo_pgsql, memcached, redis, gd, gnupg
tools: phpunit, composer
ini-values: cgi.fix_pathinfo=1
env:
update: true
fail-fast: true

- name: "Script: setup.sh"
run: bash .github/tests/setup.sh

- name: "Composer Install Dependencies"
run: |
composer install
composer require --dev php-coveralls/php-coveralls

- name: "Script: test.sh"
run: bash tests/phpunit/run.sh


Test-selenium:
name: SELENIUM (PHP-${{ matrix.php-versions }} && DB-${{ matrix.database }})
runs-on: ubuntu-latest
needs: Test-phpunit

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

env:
PHP_V: ${{ matrix.php-versions }}
DB: ${{ matrix.database }}
TEST_ARG: 'selenium'

steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: "System Install Dependencies"
run: |
sudo hostnamectl set-hostname cypht-test.org
sudo usermod -aG docker www-data
sudo chmod g+s -R "$(pwd)"
sudo setfacl -d -m g::rwx "$(pwd)"
# chrome
#wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor > /etc/apt/trusted.gpg.d/google.gpg
sudo wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install -y google-chrome-stable dovecot-imapd dovecot-lmtpd postfix python3-pip
sudo bash .github/tests/selenium/webdriver/webdriver.sh
pip install -r tests/selenium/requirements.txt

- name: "Set up PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_V }}
extensions: pdo, sodium, curl, mbstring, xml, sqlite, pdo_mysql, pdo_pgsql, memcached, redis, gd, gnupg, imagick, bcmath, tidy, soap, xdebug, bcmath
tools: phpunit, composer
ini-values: cgi.fix_pathinfo=1
env:
update: true
fail-fast: true

- name: "Composer Install Dependencies"
run: |
composer install

- name: "Script: setup.sh"
run: bash .github/tests/setup.sh

- name: "Script: test.sh"
run: bash .github/tests/test.sh
# Test-phpunit:
# name: PHPUNIT (PHP-${{ matrix.php-versions }} && DB-${{ matrix.database }})
# runs-on: ubuntu-latest

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

# env:
# PHP_V: ${{ matrix.php-versions }}
# DB: ${{ matrix.database }}
# TEST_ARG: 'phpunit'

# services:
# mysql:
# image: mysql:latest
# env:
# MYSQL_ROOT_PASSWORD: cypht_test
# MYSQL_DATABASE: cypht_test
# MYSQL_USER: cypht_test
# MYSQL_PASSWORD: cypht_test
# ports:
# - 3306:3306
# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

# postgresql:
# image: postgres:latest
# env:
# POSTGRES_USER: cypht_test
# POSTGRES_PASSWORD: cypht_test
# POSTGRES_DB: cypht_test
# ports:
# - 5432:5432
# options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3

# steps:
# - name: "System Install Dependencies"
# run: sudo apt-get install -y mysql-client postgresql-client sqlite3 libsodium-dev

# - name: "Checkout code"
# uses: actions/checkout@v4
# with:
# fetch-depth: 0

# - name: "Set up PHP"
# uses: shivammathur/setup-php@v2
# with:
# php-version: ${{ matrix.php-versions }}
# extensions: pdo, sodium, sqlite, pdo_mysql, pdo_pgsql, memcached, redis, gd, gnupg
# tools: phpunit, composer
# ini-values: cgi.fix_pathinfo=1
# env:
# update: true
# fail-fast: true

# - name: "Script: setup.sh"
# run: bash .github/tests/setup.sh

# - name: "Composer Install Dependencies"
# run: |
# composer install
# composer require --dev php-coveralls/php-coveralls

# - name: "Script: test.sh"
# run: bash tests/phpunit/run.sh


# Test-selenium:
# name: SELENIUM (PHP-${{ matrix.php-versions }} && DB-${{ matrix.database }})
# runs-on: ubuntu-latest
# needs: Test-phpunit

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

# env:
# PHP_V: ${{ matrix.php-versions }}
# DB: ${{ matrix.database }}
# TEST_ARG: 'selenium'

# steps:
# - name: "Checkout code"
# uses: actions/checkout@v4
# with:
# fetch-depth: 0

# - name: "System Install Dependencies"
# run: |
# sudo hostnamectl set-hostname cypht-test.org
# sudo usermod -aG docker www-data
# sudo chmod g+s -R "$(pwd)"
# sudo setfacl -d -m g::rwx "$(pwd)"
# # chrome
# #wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor > /etc/apt/trusted.gpg.d/google.gpg
# sudo wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
# sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
# sudo apt-get update
# sudo apt-get install -y google-chrome-stable dovecot-imapd dovecot-lmtpd postfix python3-pip
# sudo bash .github/tests/selenium/webdriver/webdriver.sh
# pip install -r tests/selenium/requirements.txt

# - name: "Set up PHP"
# uses: shivammathur/setup-php@v2
# with:
# php-version: ${{ env.PHP_V }}
# extensions: pdo, sodium, curl, mbstring, xml, sqlite, pdo_mysql, pdo_pgsql, memcached, redis, gd, gnupg, imagick, bcmath, tidy, soap, xdebug, bcmath
# tools: phpunit, composer
# ini-values: cgi.fix_pathinfo=1
# env:
# update: true
# fail-fast: true

# - name: "Composer Install Dependencies"
# run: |
# composer install

# - name: "Script: setup.sh"
# run: bash .github/tests/setup.sh

# - name: "Script: test.sh"
# run: bash .github/tests/test.sh

Call-Image-Build:
needs: Test-selenium
# needs: Test-selenium
uses: ./.github/workflows/Nightly-Image.yml
Loading