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
121 changes: 121 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: "CI"

on:
pull_request:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
format:
name: Format
runs-on: ubuntu-latest

steps:
- name: Check out the repo
uses: actions/checkout@v6

- name: Run Format
run: |
docker run --rm -v $PWD:/app composer:2.8 sh -c \
"composer install --profile --ignore-platform-reqs && composer format:check"

analyze:
name: Analyze
runs-on: ubuntu-latest

steps:
- name: Check out the repo
uses: actions/checkout@v6

- name: Run Analyze
run: |
docker run --rm -v $PWD:/app composer:2.8 sh -c \
"composer install --profile --ignore-platform-reqs && composer analyze"

unit-tests:
name: Unit Tests
runs-on: ubuntu-latest

steps:
- name: Check out the repo
uses: actions/checkout@v6

- name: Run Unit Tests
run: |
docker run --rm \
-v $PWD:/app \
-w /app \
phpswoole/swoole:5.1.2-php8.3-alpine \
sh -c "
apk update && \
apk add zip unzip && \
composer install --profile --ignore-platform-reqs && \
composer test:unit
"

build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Check out the repo
uses: actions/checkout@v6

- name: Build Docker image
run: docker compose build

- name: Save Docker image
run: docker save -o executor-image.tar executor-openruntimes-executor

- name: Upload Docker image artifact
uses: actions/upload-artifact@v6
with:
name: executor-image
path: executor-image.tar
retention-days: 1

e2e-tests:
name: E2E Tests
runs-on: ubuntu-latest
needs: build

steps:
- name: Check out the repo
uses: actions/checkout@v6

- name: Download Docker image artifact
uses: actions/download-artifact@v7
with:
name: executor-image

- name: Load Docker image
run: docker load -i executor-image.tar

- name: Start Test Stack
run: docker compose up -d --wait --wait-timeout 300

- name: Doctor
run: |
docker compose logs
docker ps
docker network ls

- name: Run E2E Tests
run: |
docker run --rm \
-v $PWD:/app \
-v /tmp:/tmp \
-v /var/run/docker.sock:/var/run/docker.sock \
--network executor_runtimes \
-w /app \
phpswoole/swoole:5.1.2-php8.3-alpine \
sh -c "
apk update && \
apk add docker-cli zip unzip && \
composer install --profile --ignore-platform-reqs && \
composer test:e2e
"
16 changes: 0 additions & 16 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/linter.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v6

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand Down
64 changes: 0 additions & 64 deletions .github/workflows/tests.yml

This file was deleted.

10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
"autoload": {
"psr-4": {
"OpenRuntimes\\": "src/",
"Tests\\": "tests"
"Tests\\E2E\\": "tests/e2e",
"Tests\\Unit\\": "tests/unit"
}
},
"scripts": {
"lint": "./vendor/bin/pint --test --config pint.json",
"format": "./vendor/bin/pint --config pint.json",
"check": "./vendor/bin/phpstan analyse --level 8 --memory-limit=2G -c phpstan.neon app src tests",
"test": "./vendor/bin/phpunit --configuration phpunit.xml --debug"
"format:check": "./vendor/bin/pint --test --config pint.json",
"analyze": "./vendor/bin/phpstan analyse --level 8 --memory-limit=2G -c phpstan.neon app src tests",
"test:unit": "./vendor/bin/phpunit --configuration phpunit.xml --debug --testsuite=unit",
"test:e2e": "./vendor/bin/phpunit --configuration phpunit.xml --debug --testsuite=e2e"
},
"require": {
"php": ">=8.3.0",
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
>
<testsuites>
<testsuite name="e2e">
<file>./tests/ExecutorTest.php</file>
<directory>./tests/e2e</directory>
</testsuite>
<testsuite name="unit">
<directory>./tests/unit</directory>
Expand Down
2 changes: 1 addition & 1 deletion tests/Client.php → tests/e2e/Client.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Tests;
namespace Tests\E2E;

use Utopia\Fetch\Client as FetchClient;
use OpenRuntimes\Executor\BodyMultipart;
Expand Down
2 changes: 1 addition & 1 deletion tests/ExecutorTest.php → tests/e2e/ExecutorTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Tests;
namespace Tests\E2E;

use PHPUnit\Framework\TestCase;
use Swoole\Coroutine as Co;
Expand Down