Skip to content
Draft
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
31 changes: 17 additions & 14 deletions .github/actions/setup-cypress/action.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
name: 'Setup Cypress'
description: 'Setup Cypress with caching and verification'
name: Setup Cypress
description: Fix Cypress permissions and verify binary

runs:
using: 'composite'
using: composite
steps:
- name: Cache Cypress
uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: cypress-cache-v1
- name: Setup Cypress
- name: Fix Cypress binary permissions
shell: bash
env:
CYPRESS_VERIFY_TIMEOUT: 100000
run: |
mv cypress.config.dist.js cypress.config.js
npx cypress install
npx cypress verify
if [ -f /usr/local/bin/cypress ]; then
chmod +x /usr/local/bin/cypress
fi

if [ -d "$HOME/.cache/Cypress" ]; then
chmod -R +x "$HOME/.cache/Cypress"
fi

- name: Verify Cypress
shell: bash
run: |
/usr/local/bin/cypress verify
31 changes: 31 additions & 0 deletions .github/actions/setup-db/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Setup Database
description: Wait for database readiness
inputs:
db:
required: true
host:
required: true
name:
required: true
user:
required: true
password:
required: true

runs:
using: composite
steps:
- shell: bash
run: |
for i in {1..30}; do
case "${{ inputs.db }}" in
mysql|mariadb)
mysql -h ${{ inputs.host }} -u${{ inputs.user }} -p${{ inputs.password }} -e "SELECT 1" && exit 0
;;
pgsql)
PGPASSWORD=${{ inputs.password }} psql -h ${{ inputs.host }} -U ${{ inputs.user }} -d ${{ inputs.name }} -c "SELECT 1" && exit 0
;;
esac
sleep 2
done
exit 1
57 changes: 37 additions & 20 deletions .github/actions/setup-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,49 @@
name: 'Setup Dependencies'
description: 'Install Composer and NPM dependencies with caching'
name: Setup Dependencies
description: Install Composer and (optionally) npm dependencies
inputs:
composer-cache-key:
description: 'Composer cache key'
required: false
default: 'composer'
npm-cache:
description: 'Enable NPM caching'
required: false
default: 'false'

runs:
using: 'composite'
using: composite
steps:
- name: Cache Composer dependencies
# -------------------------------
# Composer (always available)
# -------------------------------
- name: Cache Composer vendor
uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ inputs.composer-cache-key }}-cache-v1
path: vendor
key: composer-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}

- name: Install Composer dependencies
shell: bash
run: composer install --no-progress --ignore-platform-reqs
- name: Setup Node.js
if: inputs.npm-cache == 'true'
uses: actions/setup-node@v4
run: composer install --no-interaction --prefer-dist

# -------------------------------
# npm (ONLY if available)
# -------------------------------
- name: Detect npm
id: has-npm
shell: bash
run: |
if command -v npm >/dev/null 2>&1; then
echo "available=true" >> "$GITHUB_OUTPUT"
else
echo "available=false" >> "$GITHUB_OUTPUT"
fi

- name: Cache npm
if: inputs.npm-cache == 'true' && steps.has-npm.outputs.available == 'true'
uses: actions/cache@v4
with:
node-version: '20'
cache: 'npm'
- name: Install NPM dependencies
if: inputs.npm-cache == 'true'
path: ~/.npm
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}

- name: Install npm dependencies
if: inputs.npm-cache == 'true' && steps.has-npm.outputs.available == 'true'
shell: bash
run: npm ci --unsafe-perm
run: |
npm ci
chmod -R +x node_modules/.bin || true
81 changes: 81 additions & 0 deletions .github/workflows/cy-nigthly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: CI Weblinks (Nightly Joomla)

on:
schedule:
- cron: "0 3 * * *"
workflow_dispatch:

env:
EXTENSION_ZIP: pkg-weblinks-current.zip
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}

jobs:
nightly:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
fail-fast: false
matrix:
shard: [1, 2]

container:
image: joomlaprojects/docker-images:cypress8.4

services:
db:
image: mariadb:11.4
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test_joomla
MYSQL_USER: joomla_ut
MYSQL_PASSWORD: joomla_ut

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-dependencies
- uses: ./.github/actions/setup-cypress

- run: |
curl -fL https://downloads.joomla.org/cms/joomla6.2/nightly/Joomla_6.2-Nightly-Full_Package.zip -o joomla.zip
unzip -q joomla.zip -d /tests/www/site

- uses: ./.github/actions/setup-db
with:
db: mariadb
host: db
name: test_joomla
user: joomla_ut
password: joomla_ut

- run: |
apache2ctl start
php /tests/www/site/installation/joomla.php install \
--site-name="CI Nightly" \
--admin-user=admin \
--admin-username=admin \
--admin-password=admin123 \
--admin-email=admin@example.org \
--db-type=mysqli \
--db-host=db \
--db-user=joomla_ut \
--db-pass=joomla_ut \
--db-name=test_joomla \
--db-prefix=night_

php /tests/www/site/cli/joomla.php extension:install \
--path=dist/${{ env.EXTENSION_ZIP }}

- name: Cypress (parallel)
run: |
npx cypress run \
--browser chrome \
--parallel \
--record \
--ci-build-id nightly-${{ github.run_id }} \
--group shard-${{ matrix.shard }}

- if: failure()
uses: ./.github/actions/report-nightly-failure
with:
title: "Nightly CI failure (Joomla 6.2)"
label: nightly
58 changes: 58 additions & 0 deletions .github/workflows/cy-rc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI Weblinks (Joomla RC)

on:
pull_request:
workflow_dispatch:

jobs:
rc:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: joomlaprojects/docker-images:cypress8.4

services:
db:
image: mariadb:11.4
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test_joomla
MYSQL_USER: joomla_ut
MYSQL_PASSWORD: joomla_ut

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-dependencies
- uses: ./.github/actions/setup-cypress

- run: |
curl -fL https://downloads.joomla.org/cms/joomla6.2/rc/Joomla_6.2-RC-Full_Package.zip -o joomla.zip
unzip -q joomla.zip -d /tests/www/site

- uses: ./.github/actions/setup-db
with:
db: mariadb
host: db
name: test_joomla
user: joomla_ut
password: joomla_ut

- run: |
apache2ctl start
php /tests/www/site/installation/joomla.php install \
--site-name="CI RC" \
--admin-user=admin \
--admin-username=admin \
--admin-password=admin123 \
--admin-email=admin@example.org \
--db-type=mysqli \
--db-host=db \
--db-user=joomla_ut \
--db-pass=joomla_ut \
--db-name=test_joomla \
--db-prefix=rc_

php /tests/www/site/cli/joomla.php extension:install \
--path=dist/pkg-weblinks-current.zip

- run: npx cypress run --browser chrome
Loading
Loading