Skip to content

Commit 348c224

Browse files
author
Daniel Mellum
committed
testing the testing with github actions
1 parent 8386755 commit 348c224

File tree

4 files changed

+66
-20
lines changed

4 files changed

+66
-20
lines changed

.github/workflows/docker.yml

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,61 @@ on:
99
- main
1010

1111
jobs:
12-
docker:
12+
build-test-image:
1313
timeout-minutes: 15
1414
runs-on: ubuntu-latest
15-
container: ghcr.io/danielme85/lltdb-testbench:latest
15+
permissions:
16+
contents: read
17+
packages: write
1618

1719
steps:
1820
- name: Checkout
19-
uses: actions/checkout@v1
21+
uses: actions/checkout@v3
22+
23+
- name: Login to Github Packages
24+
uses: docker/login-action@v2
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Extract metadata (tags, labels) for Docker
31+
id: meta
32+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
33+
with:
34+
images: ghcr.io/danielme85/lltdb-testbench
35+
36+
- name: Build and push Docker image
37+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
38+
with:
39+
context: ./docker/php8/
40+
push: true
41+
tags: ${{ steps.meta.outputs.tags }}
42+
labels: ${{ steps.meta.outputs.labels }}
2043

44+
run-test-image:
45+
needs: build-test-image
46+
timeout-minutes: 5
47+
container: ghcr.io/danielme85/lltdb-testbench:latest
48+
credentials:
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
51+
52+
steps:
2153
- name: Start containers
2254
run: docker-compose up -d mariadb mongo
2355

2456
- name: Install composer packages
25-
run: cd /var/testing && composer install --no-interaction
57+
run: cd /var/testing && composer install --no-interaction
2658

2759
- name: Run tests
2860
run: cd /var/testing && dockerize -wait tcp://mariadb:3306 -timeout 1m && ./vendor/bin/testbench package:test
2961

62+
- name: Upload test coverage
63+
uses: codecov/codecov-action@v3
64+
with:
65+
files: ./clover.xml
66+
3067
- name: Cleanup containers
3168
run: docker-compose down
3269

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ services:
3333
networks:
3434
- laravel-log-to-db-testing
3535
volumes:
36-
- .:/var/testing
36+
- .:/var/testing:cached
3737
environment:
3838
- DB_CONNECTION=mysql
3939
- DB_HOST=mariadb

docker/php8/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ WORKDIR /
1111

1212
RUN apt update && apt upgrade -y
1313
RUN apt install -y curl git openssl openssh-client mysql-client bash libzip-dev zip wget \
14-
php8.1 php8.1-dev php8.1-mysql php8.1-mongodb php8.1-curl php8.1-mbstring
14+
php8.1 php8.1-dev php8.1-mysql php8.1-mongodb php8.1-curl php8.1-mbstring php8.1-pcov
1515

1616
RUN pecl install pcov
1717
RUN pecl install mongodb

phpunit.xml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
<coverage processUncoveredFiles="true">
4-
<include>
5-
<directory suffix=".php">./src</directory>
6-
</include>
7-
<exclude>
8-
<directory>./vendor</directory>
9-
</exclude>
10-
</coverage>
11-
<testsuites>
12-
<testsuite name="Test Suite danielme85/laravel-log-to-db">
13-
<directory suffix=".php">./tests/</directory>
14-
</testsuite>
15-
</testsuites>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false"
3+
colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true"
4+
convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false"
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
6+
<coverage>
7+
<include>
8+
<directory suffix=".php">./src</directory>
9+
</include>
10+
<exclude>
11+
<directory>./vendor</directory>
12+
</exclude>
13+
<report>
14+
<clover outputFile="./clover.xml"/>
15+
</report>
16+
</coverage>
17+
<testsuites>
18+
<testsuite name="Test Suite danielme85/laravel-log-to-db">
19+
<directory suffix=".php">./tests/</directory>
20+
</testsuite>
21+
<logging>
22+
<log type="testdox-text" target="php://stdout"/>
23+
</logging>
24+
</testsuites>
1625
</phpunit>

0 commit comments

Comments
 (0)