Skip to content

Commit 49b5d12

Browse files
committed
Add github action scaffolding
1 parent 539ad24 commit 49b5d12

6 files changed

Lines changed: 127 additions & 1 deletion

File tree

.github/workflows/pipes.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Pipes
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
paths:
8+
- 'bin/**'
9+
- 'build/**'
10+
- 'scripts/**'
11+
- 'src/**'
12+
types:
13+
- labeled
14+
- unlabeled
15+
- opened
16+
- synchronize
17+
push:
18+
branches:
19+
- master
20+
paths:
21+
- 'bin/**'
22+
- 'build/**'
23+
- 'scripts/**'
24+
- 'src/**'
25+
workflow_dispatch:
26+
27+
jobs:
28+
# build images and ensure no git diff
29+
# run phpinfo and ensure correct version of xdebug is installed
30+
build_and_verify:
31+
name: Build and Verify
32+
if: |
33+
github.event_name == 'push'
34+
|| github.event_name == 'workflow_dispatch'
35+
|| (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci'))
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
- name: Verify builds are correct
40+
run: |
41+
make clean
42+
make generate
43+
./scripts/git-has-changes.sh
44+
- name: Build docker images
45+
run: |
46+
make build
47+
- name: Verify docker images
48+
run: |
49+
./scripts/test-all-images.sh

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
/.idea
1+
.*
2+
3+
!.gitignore
4+
5+
!.github/

bin/build-all.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,5 @@ if [ "${#build_failed[@]}" -gt 0 ]; then
6060
for img in "${build_failed[@]}"; do
6161
echo "${text_red}* ${img}${text_normal}"
6262
done
63+
exit 1
6364
fi

scripts/git-has-changes.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
3+
if [[ -n $(git status --porcelain --untracked-files=no) ]]; then
4+
exit 1
5+
fi

scripts/test-all-images.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Script builds all Dockerfiles defined in build directory
5+
# Prints summary after all images have been built (successfully or not)
6+
#
7+
8+
image_name="$1"
9+
10+
# Checks if image name was provided by user
11+
if [ -z "${image_name}" ]; then
12+
echo "Usage: $0 [docker_image_name]" >&2
13+
exit -1
14+
fi
15+
16+
# Change current path to project root
17+
script_path=$(dirname "$0")
18+
cd "${script_path}/../" || exit -1
19+
20+
# Text formatting
21+
text_bold=$(tput bold)
22+
text_red=$(tput setaf 1)
23+
text_normal=$(tput sgr0)
24+
25+
# Loop through all available directories in ./build
26+
for i in ./build/*/; do
27+
version=$(basename "$i");
28+
image="${image_name}:${version}"
29+
30+
echo "${text_bold}* Testing ${image} ${text_normal}"
31+
32+
docker run \
33+
--volume ./scripts/test-xdebug-install.php:/app/test-xdebug-install.php \
34+
--workdir /app \
35+
$image
36+
37+
38+
# Builds image and check for return code
39+
if docker build --pull -t "${image}" "./build/${version}"; then
40+
build_done+=( "${image}" )
41+
else
42+
echo "${text_bold}${text_red}* ERROR when building ${image} ${text_normal}"
43+
build_failed+=( "${image}" )
44+
fi
45+
done
46+

scripts/test-xdebug-install.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
function testPhpinfo() {
4+
ob_start();
5+
phpinfo();
6+
$phpinfo = ob_get_flush();
7+
}
8+
9+
function testVardump() {
10+
11+
}
12+
13+
function testXdebugIsDebuggerActive() {
14+
// xdebug_is_debugger_active
15+
// https://xdebug.org/docs/all_functions#xdebug_is_debugger_active
16+
}
17+
18+
19+
20+
21+
// https://stackoverflow.com/questions/14046501/check-if-xdebug-is-working

0 commit comments

Comments
 (0)