Skip to content
Open
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
23 changes: 19 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ jobs:
- id: supported-arch-matrix
name: Generate Arch
run: |
echo "arch=[\\\"amd64\\\",\\\"arm64\\\"]" >> $GITHUB_OUTPUT
echo "arch=[\\\"amd64\\\"]" >> $GITHUB_OUTPUT
# echo "arch=[\\\"amd64\\\",\\\"arm64\\\"]" >> $GITHUB_OUTPUT
image-type-matrix:
name: Create Image Type Matrix
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -191,7 +192,7 @@ jobs:
- run: make ci-scan-vulnerability
if: contains(matrix.image, 'alpine')
test:
name: Testing "${{ matrix.image }}"
name: Testing "${{ matrix.image }}" on "${{ matrix.arch }}"
needs:
- build
- image-matrix
Expand All @@ -201,6 +202,8 @@ jobs:
strategy:
fail-fast: false
matrix:
arch:
- linux/amd64
image: ${{ fromJson(needs.image-matrix.outputs.image) }}
exclude: ${{ fromJson(needs.exclude-matrix.outputs.exclude) }}
steps:
Expand All @@ -212,11 +215,23 @@ jobs:
name: docker-image-${{ matrix.image }}
path: ./docker-image
- run: ls -lasth ./docker-image/
- run: printf "images=%s" $(awk '{printf("%s,",$0)} END { printf "\n" }' ./docker-image/image.tags) >> $GITHUB_OUTPUT
id: images
- run: docker load --input ./docker-image/image.tar
- run: |
- run: docker image ls -a
- name: Determine test suite
id: test_suite
run: |
export IMAGE_BASE_VERSION=$(php -r 'echo explode("-", "${{ matrix.image }}")[2];')
(echo "${{ needs.supported-arch-matrix.outputs.arch }}" | jq -r '.[]') | xargs -I % make $(php -r 'echo "test-", explode("-", str_replace(["zts-zts", "cli-nts"], ["zts", "nts"], "${{ matrix.image }}"))[0];') IMAGE_ARCH=%
printf "test_suite=%s" $(make $(php -r 'echo "test-", explode("-", str_replace(["zts-zts", "cli-nts"], ["zts", "nts"], "${{ matrix.image }}"))[0];') IMAGE_ARCH=${{ matrix.arch }}) >> $GITHUB_OUTPUT
- run: rm -Rf ./docker-image/
- uses: WyriHaximus/github-action-testinfra@main
with:
cmd: php
image: "${{ steps.images.outputs.images }}"
flags: --platform="${{ matrix.arch }}"
testsPath: test
testSuite: "${{ steps.test_suite.outputs.test_suite }}"
check-mark:
name: ✔️
needs:
Expand Down
23 changes: 1 addition & 22 deletions test-nts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,4 @@ else
TEST_SUITE="php_app or $TEST_SUITE"
fi

printf "Starting a container for '%s'\\n" "$DOCKER_TAG"

DOCKER_CONTAINER=$(docker run --rm -v "$(pwd)/test:/tests" -t -d "$DOCKER_TAG" php)
readonly DOCKER_CONTAINER

# Let's register a trap function, if our tests fail, finish or the script gets
# interrupted, we'll still be able to remove the running container
function tearDown {
docker rm -f "$DOCKER_CONTAINER" &>/dev/null &
}
trap tearDown EXIT TERM ERR

# Finally, run the tests!
echo "Running test suite: $TEST_SUITE"
docker run --rm -t \
-v "$(pwd)/test:/tests" \
-v "$(pwd)/tmp/test-results:/results" \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
renatomefi/docker-testinfra:5 \
-m "$TEST_SUITE" --junitxml="/results/php-nts-$DOCKER_TAG.xml" \
--disable-pytest-warnings \
--verbose --hosts="docker://$DOCKER_CONTAINER"
echo $TEST_SUITE
23 changes: 1 addition & 22 deletions test-zts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,4 @@ else
TEST_SUITE="php_app or $TEST_SUITE"
fi

printf "Starting a container for '%s'\\n" "$DOCKER_TAG"

DOCKER_CONTAINER=$(docker run --rm -v "$(pwd)/test:/tests" -t -d "$DOCKER_TAG" php)
readonly DOCKER_CONTAINER

# Let's register a trap function, if our tests fail, finish or the script gets
# interrupted, we'll still be able to remove the running container
function tearDown {
docker rm -f "$DOCKER_CONTAINER" &>/dev/null &
}
trap tearDown EXIT TERM ERR

# Finally, run the tests!
echo "Running test suite: $TEST_SUITE"
docker run --rm -t \
-v "$(pwd)/test:/tests" \
-v "$(pwd)/tmp/test-results:/results" \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
renatomefi/docker-testinfra:5 \
-m "$TEST_SUITE" --junitxml="/results/php-zts-$DOCKER_TAG.xml" \
--disable-pytest-warnings \
--verbose --hosts="docker://$DOCKER_CONTAINER"
echo $TEST_SUITE