From 34efef7cc761bb9834f1603811f7513f9114f837 Mon Sep 17 00:00:00 2001 From: Steven Ngesera Date: Sat, 25 Jan 2025 14:47:47 +0200 Subject: [PATCH] Test with GITHUB_TOKEN --- .github/workflows/Nightly-Image.yml | 34 ++-- .github/workflows/Test-Build.yml | 250 ++++++++++++++-------------- 2 files changed, 136 insertions(+), 148 deletions(-) diff --git a/.github/workflows/Nightly-Image.yml b/.github/workflows/Nightly-Image.yml index 8c4806e67..3afb0169d 100644 --- a/.github/workflows/Nightly-Image.yml +++ b/.github/workflows/Nightly-Image.yml @@ -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 @@ -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 @@ -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 \ No newline at end of file + run: docker logout diff --git a/.github/workflows/Test-Build.yml b/.github/workflows/Test-Build.yml index d94e72b2e..1604ec321 100644 --- a/.github/workflows/Test-Build.yml +++ b/.github/workflows/Test-Build.yml @@ -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 \ No newline at end of file