Skip to content

Commit c21b97e

Browse files
authored
Merge pull request #218 from open-runtimes/refactor-ci
refactor: ci
2 parents ac39d1f + 66ddbc8 commit c21b97e

File tree

9 files changed

+131
-104
lines changed

9 files changed

+131
-104
lines changed

.github/workflows/ci.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: "CI"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
format:
14+
name: Format
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Check out the repo
19+
uses: actions/checkout@v6
20+
21+
- name: Run Format
22+
run: |
23+
docker run --rm -v $PWD:/app composer:2.8 sh -c \
24+
"composer install --profile --ignore-platform-reqs && composer format:check"
25+
26+
analyze:
27+
name: Analyze
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- name: Check out the repo
32+
uses: actions/checkout@v6
33+
34+
- name: Run Analyze
35+
run: |
36+
docker run --rm -v $PWD:/app composer:2.8 sh -c \
37+
"composer install --profile --ignore-platform-reqs && composer analyze"
38+
39+
unit-tests:
40+
name: Unit Tests
41+
runs-on: ubuntu-latest
42+
43+
steps:
44+
- name: Check out the repo
45+
uses: actions/checkout@v6
46+
47+
- name: Run Unit Tests
48+
run: |
49+
docker run --rm \
50+
-v $PWD:/app \
51+
-w /app \
52+
phpswoole/swoole:5.1.2-php8.3-alpine \
53+
sh -c "
54+
apk update && \
55+
apk add zip unzip && \
56+
composer install --profile --ignore-platform-reqs && \
57+
composer test:unit
58+
"
59+
60+
build:
61+
name: Build
62+
runs-on: ubuntu-latest
63+
64+
steps:
65+
- name: Check out the repo
66+
uses: actions/checkout@v6
67+
68+
- name: Build Docker image
69+
run: docker compose build
70+
71+
- name: Save Docker image
72+
run: docker save -o executor-image.tar executor-openruntimes-executor
73+
74+
- name: Upload Docker image artifact
75+
uses: actions/upload-artifact@v6
76+
with:
77+
name: executor-image
78+
path: executor-image.tar
79+
retention-days: 1
80+
81+
e2e-tests:
82+
name: E2E Tests
83+
runs-on: ubuntu-latest
84+
needs: build
85+
86+
steps:
87+
- name: Check out the repo
88+
uses: actions/checkout@v6
89+
90+
- name: Download Docker image artifact
91+
uses: actions/download-artifact@v7
92+
with:
93+
name: executor-image
94+
95+
- name: Load Docker image
96+
run: docker load -i executor-image.tar
97+
98+
- name: Start Test Stack
99+
run: docker compose up -d --wait --wait-timeout 300
100+
101+
- name: Doctor
102+
run: |
103+
docker compose logs
104+
docker ps
105+
docker network ls
106+
107+
- name: Run E2E Tests
108+
run: |
109+
docker run --rm \
110+
-v $PWD:/app \
111+
-v /tmp:/tmp \
112+
-v /var/run/docker.sock:/var/run/docker.sock \
113+
--network executor_runtimes \
114+
-w /app \
115+
phpswoole/swoole:5.1.2-php8.3-alpine \
116+
sh -c "
117+
apk update && \
118+
apk add docker-cli zip unzip && \
119+
composer install --profile --ignore-platform-reqs && \
120+
composer test:e2e
121+
"

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/linter.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Check out the repo
18-
uses: actions/checkout@v2
18+
uses: actions/checkout@v6
1919

2020
- name: Set up QEMU
2121
uses: docker/setup-qemu-action@v2

.github/workflows/tests.yml

Lines changed: 0 additions & 64 deletions
This file was deleted.

composer.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
"autoload": {
77
"psr-4": {
88
"OpenRuntimes\\": "src/",
9-
"Tests\\": "tests"
9+
"Tests\\E2E\\": "tests/e2e",
10+
"Tests\\Unit\\": "tests/unit"
1011
}
1112
},
1213
"scripts": {
13-
"lint": "./vendor/bin/pint --test --config pint.json",
1414
"format": "./vendor/bin/pint --config pint.json",
15-
"check": "./vendor/bin/phpstan analyse --level 8 --memory-limit=2G -c phpstan.neon app src tests",
16-
"test": "./vendor/bin/phpunit --configuration phpunit.xml --debug"
15+
"format:check": "./vendor/bin/pint --test --config pint.json",
16+
"analyze": "./vendor/bin/phpstan analyse --level 8 --memory-limit=2G -c phpstan.neon app src tests",
17+
"test:unit": "./vendor/bin/phpunit --configuration phpunit.xml --debug --testsuite=unit",
18+
"test:e2e": "./vendor/bin/phpunit --configuration phpunit.xml --debug --testsuite=e2e"
1719
},
1820
"require": {
1921
"php": ">=8.3.0",

phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
>
1212
<testsuites>
1313
<testsuite name="e2e">
14-
<file>./tests/ExecutorTest.php</file>
14+
<directory>./tests/e2e</directory>
1515
</testsuite>
1616
<testsuite name="unit">
1717
<directory>./tests/unit</directory>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Tests;
3+
namespace Tests\E2E;
44

55
use Utopia\Fetch\Client as FetchClient;
66
use OpenRuntimes\Executor\BodyMultipart;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Tests;
3+
namespace Tests\E2E;
44

55
use PHPUnit\Framework\TestCase;
66
use Swoole\Coroutine as Co;

0 commit comments

Comments
 (0)