Skip to content
Merged
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
38 changes: 0 additions & 38 deletions .env.ci

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
"CODE_OF_CONDUCT.md"
"CONTRIBUTOR_LICENSE_AGREEMENT"
"crowdin.yml"
"docker-compose.ci.yml"
"phpstan.neon"
"phpunit.xml"
"stats.html"
Expand Down
101 changes: 91 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,110 @@ jobs:
tests:
runs-on: ubuntu-latest

# Run straight on the runner, as main does, rather than inside the
# performave/convoy-workspace image, which is unmaintained and pins
# whatever PHP and Node it was last built with.
services:
mysql:
image: mysql:8.0
env:
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_DATABASE: convoy
MYSQL_USER: convoy_user
MYSQL_PASSWORD: YzLa2BCBwDGWVkpG
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -uconvoy_user -pYzLa2BCBwDGWVkpG"
--health-interval=5s
--health-timeout=5s
--health-retries=20

redis:
image: redis:7.0-alpine
ports:
- 6379:6379
options: >-
--health-cmd="redis-cli ping"
--health-interval=5s
--health-timeout=5s
--health-retries=20

steps:
- uses: actions/checkout@v4

- name: Create environment file
run: cp .env.ci .env
# The versions ddev runs for 4.x development (.ddev/config.yaml).
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: gmp, pcntl, redis, pdo_mysql, bcmath, intl
coverage: none
tools: composer:v2

- name: Start Docker Containers
run: docker compose -f docker-compose.ci.yml up -d
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

# Built from .env.example, pointed at the service containers above. A
# written file rather than job-level env vars because `php artisan serve`
# does not hand its own environment to the app it serves.
- name: Create environment file
run: |
cp .env.example .env
sed -i 's/^DB_HOST=.*/DB_HOST=127.0.0.1/' .env
sed -i 's/^DB_PASSWORD=.*/DB_PASSWORD=YzLa2BCBwDGWVkpG/' .env
sed -i 's/^REDIS_HOST=.*/REDIS_HOST=127.0.0.1/' .env

- name: Install Composer dependencies
run: docker compose -f docker-compose.ci.yml exec workspace composer install --prefer-dist --no-interaction --no-progress
run: composer install --prefer-dist --no-interaction --no-progress

- name: Generate application key
run: php artisan key:generate

- name: Install NPM dependencies
run: docker compose -f docker-compose.ci.yml exec workspace npm install
run: npm ci

- name: Build frontend assets
run: docker compose -f docker-compose.ci.yml exec workspace npm run build
run: npm run build

- name: Run database migrations
run: docker compose -f docker-compose.ci.yml exec workspace php artisan migrate
run: php artisan migrate --force

- name: Run feature tests
run: docker compose -f docker-compose.ci.yml exec workspace vendor/bin/pest --bootstrap vendor/autoload.php tests/Feature
run: vendor/bin/pest --bootstrap vendor/autoload.php tests/Feature

- name: Run unit tests
run: docker compose -f docker-compose.ci.yml exec workspace vendor/bin/pest --bootstrap vendor/autoload.php tests/Unit
run: vendor/bin/pest --bootstrap vendor/autoload.php tests/Unit

- name: Install Playwright browser
run: npx playwright install --with-deps chromium

# 127.0.0.1:8000 rather than localhost: it is one of Sanctum's default
# stateful domains, so the session from logging in is honoured.
- name: Seed and serve the panel
run: |
php artisan migrate:fresh --seed --seeder=E2eSeeder --force
php artisan serve --host=127.0.0.1 --port=8000 > storage/logs/serve.log 2>&1 &
for i in $(seq 30); do
curl -sf -o /dev/null http://127.0.0.1:8000/auth/login && exit 0
sleep 1
done
cat storage/logs/serve.log
exit 1

- name: Run Playwright tests
run: npm run test:e2e

- name: Upload Playwright report
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: |
playwright-report/
test-results/
storage/logs/
retention-days: 14
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ _ide_*.php
stats.html
.fleet
lang/php_*.json
.phpunit.cache
.phpunit.cache
/test-results
/playwright-report
/blob-report
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ This file is a running track of new features and fixes to each version of the pa
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
follows [Semantic Versioning](https://semver.org) guidelines.

## Unreleased

### Fixed

- Fixed the Create Server modal offering no templates once a node was picked. The node select holds its id as a string,
and since v4.7.0-rc.1 the template group lookup skips anything that is not a positive integer -- which was meant to
stop requests going out before a node is chosen, but also stopped them after. The id is now converted before the
lookup.

## v4.7.0-rc.1

### Changed
Expand Down
50 changes: 50 additions & 0 deletions database/seeders/E2eSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace Database\Seeders;

use Convoy\Models\Location;
use Convoy\Models\Node;
use Convoy\Models\Template;
use Convoy\Models\TemplateGroup;
use Convoy\Models\User;
use Illuminate\Database\Seeder;

/**
* Seed the fixed records the Playwright suite in tests/e2e logs in with and
* clicks through -- NOT for production.
*
* Nothing here talks to Proxmox: the node is a factory row, so only flows that
* stay inside the panel's own database can be exercised against it. The names
* are constants the specs look for, so change them in both places.
*
* Run: php artisan migrate:fresh --seed --seeder=E2eSeeder
*/
class E2eSeeder extends Seeder
{
public function run(): void
{
User::factory()->create([
'name' => 'E2E Admin',
'email' => 'admin@e2e.test',
'root_admin' => true,
]); // password: "password", from the factory

$node = Node::factory()->for(Location::factory())->create([
'name' => 'e2e-node',
'fqdn' => 'e2e-node.test',
]);

$group = TemplateGroup::create([
'node_id' => $node->id,
'name' => 'E2E Linux',
'hidden' => false,
]);

Template::create([
'template_group_id' => $group->id,
'name' => 'E2E Debian 12',
'vmid' => 9000,
'hidden' => false,
]);
}
}
41 changes: 0 additions & 41 deletions docker-compose.ci.yml

This file was deleted.

67 changes: 67 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading