Skip to content

Commit

Permalink
Test with GITHUB_TOKEN
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadow243 committed Jan 25, 2025
1 parent ed410db commit 34efef7
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 148 deletions.
34 changes: 11 additions & 23 deletions .github/workflows/Nightly-Image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:

env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_RELEASE_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.FINE_GRAINED_RELEASE_TOKEN }}

strategy:
matrix:
include:
- php_version: ${{ inputs.php_version }}
php_version: [ "${{ inputs.php_version }}" ]

steps:
- name: Checkout repository
Expand All @@ -39,36 +39,25 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# Debugging steps for DOCKER_USERNAME
- name: Verify DOCKER_USERNAME is set
- name: Debug DOCKER_USERNAME secret
run: |
if [ -z "$DOCKER_USERNAME" ]; then
echo "DOCKER_USERNAME is empty or not set!"
if [ -z "${{ secrets.DOCKER_USERNAME }}" ]; then
echo "DOCKER_USERNAME is not set or accessible."
exit 1
else
echo "DOCKER_USERNAME is set."
echo "Partial DOCKER_USERNAME: ${DOCKER_USERNAME:0:3}***"
echo "Length of DOCKER_USERNAME: ${#DOCKER_USERNAME}"
fi
- name: Output partial DOCKER_USERNAME
run: |
echo "Partial DOCKER_USERNAME: ${DOCKER_USERNAME:0:3}***"
- name: Debug DOCKER_USERNAME length
run: |
echo "Length of DOCKER_USERNAME: ${#DOCKER_USERNAME}"
- name: Encode and Debug DOCKER_USERNAME
run: |
echo "Encoded DOCKER_USERNAME: $(echo -n "$DOCKER_USERNAME" | base64)"
- name: Log Environment Variables
- name: Log environment variables
run: env

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
password: ${{ secrets.DOCKER_RELEASE_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
Expand All @@ -78,7 +67,6 @@ jobs:
file: ./docker/Dockerfile
push: true
tags: cypht/cypht-daily:${{ matrix.php_version }}
debug: true

- name: Log out from Docker Hub
run: docker logout
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

0 comments on commit 34efef7

Please sign in to comment.