Skip to content

Commit

Permalink
sync github workflows config
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Aug 22, 2024
1 parent cf8c93d commit 6fef1d4
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 42 deletions.
14 changes: 14 additions & 0 deletions .github/WORKFLOW-PARAMETERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Workflow Parameters
Adding parameters in the Git commit log can control the workflow.

## --filter
This parameter specifies which workflows to run, instead of running all of them.
The command format is: `--filter=[flow1][flow2][flow...]` ,
and it supports setting multiple workflows, with names matching the filename of the yml file.

## --valgrind
Setting this parameter will cause the test program to be run with `valgrind`.

```shell
git commit -m "commit message --filter=[core][unit] --valgrind"
```
10 changes: 8 additions & 2 deletions .github/workflows/lib.yml → .github/workflows/core.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: lib-swoole
name: Core Tests

on: [ push, pull_request ]

Expand All @@ -8,7 +8,7 @@ env:
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[test]')"
if: "!contains(github.event.head_commit.message, '--filter=') || contains(github.event.head_commit.message, '[core]')"
services:
tinyproxy:
image: "vimagick/tinyproxy"
Expand Down Expand Up @@ -37,6 +37,12 @@ jobs:
make VERBOSE=1 -j &&
sudo make install

- name: make test with valgrind
if: "contains(github.event.head_commit.message, '--valgrind')"
run: |
sudo apt install -y valgrind
cd core-tests && SWOOLE_VALGRIND=1 ./run.sh
- name: make test
run:
cd core-tests && ./run.sh
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ext.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: ext-swoole
name: Compile Tests

on: [push, pull_request]
on: [ push, pull_request ]

env:
CPPFLAGS: "-I/opt/homebrew/opt/pcre2/include/"

jobs:
build-ubuntu-latest:
if: "!contains(github.event.head_commit.message, '[test]')"
if: "!contains(github.event.head_commit.message, '--filter=') || contains(github.event.head_commit.message, '[ext]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
make clean && make -j$(nproc)

build-macos-latest:
if: "!contains(github.event.head_commit.message, '[test]')"
if: "!contains(github.event.head_commit.message, '--filter=')"
runs-on: macos-latest
steps:
- name: install dependencies
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
make clean && make -j$(sysctl -n hw.ncpu)

build-alpine-latest:
if: "!contains(github.event.head_commit.message, '[test]')"
if: "!contains(github.event.head_commit.message, '--filter=')"
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/framework.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Frameworks Tests
name: Framework Tests

on:
push:
Expand All @@ -10,7 +10,7 @@ env:
jobs:
linux:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[test]')"
if: "!contains(github.event.head_commit.message, '--filter=') || contains(github.event.head_commit.message, '[framework]')"
strategy:
fail-fast: false
matrix:
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/mirror.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: test-linux
name: Unit Tests

on: [push, pull_request]

jobs:
test-linux:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '--filter=') || contains(github.event.head_commit.message, '[unit]')"
strategy:
fail-fast: false
matrix:
Expand All @@ -31,7 +32,9 @@ jobs:
- name: Run pecl-install.sh
run: |
sudo ${{runner.workspace}}/swoole-src/scripts/pecl-install.sh
- name: Run Swoole test
- name: Run unit tests
run: |
export SWOOLE_BRANCH=${GITHUB_REF##*/}
export SWOOLE_BUILD_DIR=$(realpath .)
export PHP_VERSION=${{ matrix.php }}
${{runner.workspace}}/swoole-src/scripts/route.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: conflict-exts
name: Xdebug Support Tests

on: [push, pull_request]

jobs:
tests:
if: "!contains(github.event.head_commit.message, '--filter=') || contains(github.event.head_commit.message, '[xdebug]')"
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
12 changes: 10 additions & 2 deletions core-tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ ipcs -q

tasks=$(./bin/core_tests --gtest_list_tests | awk '/\./')
for task in $tasks; do

if [ "${SWOOLE_VALGRIND}" = 1 ]; then
# --leak-check=full --show-leak-kinds=all --track-origins=yes
execute_command="valgrind ./bin/core_tests"
else
execute_command="./bin/core_tests"
fi

if [ $task = "log." ]; then
./bin/core_tests --gtest_filter=$task*
$execute_command --gtest_filter=$task*
else
sudo ./bin/core_tests --gtest_filter=$task*
sudo $execute_command --gtest_filter=$task*
fi

if [ $? -ne 0 ] && [ "${GITHUB_ACTIONS}" = true ]; then
Expand Down

0 comments on commit 6fef1d4

Please sign in to comment.