This commit is contained in:
parent
9e12f48274
commit
9b78e90b57
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/.*
|
||||||
|
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/vendor/
|
||||||
|
/.phpunit.cache/
|
||||||
|
|
15
.woodpecker.yml
Normal file
15
.woodpecker.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
pipeline:
|
||||||
|
phpunit:
|
||||||
|
image: walkero/phpunit-alpine:php8.0-phpunit9
|
||||||
|
commands:
|
||||||
|
- composer install
|
||||||
|
- phpunit
|
||||||
|
- echo -n "latest,1.0,1.0.0" > .tags
|
||||||
|
dockerbuild:
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
repo: docker.noccylabs.info/pipeline-test
|
||||||
|
registry: docker.noccylabs.info
|
||||||
|
|
||||||
|
|
||||||
|
|
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
FROM composer:latest
|
||||||
|
|
||||||
|
FROM php:8.0-cli-alpine
|
||||||
|
|
||||||
|
WORKDIR /application
|
||||||
|
|
||||||
|
COPY . /application
|
||||||
|
COPY --from=0 /usr/bin/composer /usr/bin/composer
|
||||||
|
RUN composer install
|
||||||
|
|
||||||
|
ENTRYPOINT /application/hello
|
||||||
|
|
@ -1,3 +1,8 @@
|
|||||||
# docker-pipeline-test
|
# docker-pipeline-test
|
||||||
|
|
||||||
Test pipeline with gitea→woodpecker→docker registry
|
This is a repository with an example application to test a custom docker pipeline
|
||||||
|
using Gitea, Woodpecker and a private registry.
|
||||||
|
|
||||||
|
- Runs phpunit against the code
|
||||||
|
- Builds image from Dockerfile, tags the image and pushes to repo
|
||||||
|
|
||||||
|
12
composer.json
Normal file
12
composer.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "noccy/docker-pipeline-test",
|
||||||
|
"description": "Pipeline test",
|
||||||
|
"type": "application",
|
||||||
|
"license": "MIT",
|
||||||
|
"require": {},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Hello\\": "src/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
hello
Executable file
7
hello
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once __DIR__."/vendor/autoload.php";
|
||||||
|
|
||||||
|
$app = new Hello\HelloApplication;
|
||||||
|
$app->run();
|
26
phpunit.xml
Normal file
26
phpunit.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
|
||||||
|
bootstrap="vendor/autoload.php"
|
||||||
|
cacheResultFile=".phpunit.cache/test-results"
|
||||||
|
executionOrder="depends,defects"
|
||||||
|
forceCoversAnnotation="true"
|
||||||
|
beStrictAboutCoversAnnotation="true"
|
||||||
|
beStrictAboutOutputDuringTests="true"
|
||||||
|
beStrictAboutTodoAnnotatedTests="true"
|
||||||
|
failOnRisky="true"
|
||||||
|
failOnWarning="true"
|
||||||
|
verbose="true">
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="default">
|
||||||
|
<directory suffix="Test.php">tests</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
|
||||||
|
<coverage cacheDirectory=".phpunit.cache/code-coverage"
|
||||||
|
processUncoveredFiles="true">
|
||||||
|
<include>
|
||||||
|
<directory suffix=".php">src</directory>
|
||||||
|
</include>
|
||||||
|
</coverage>
|
||||||
|
</phpunit>
|
17
src/HelloApplication.php
Normal file
17
src/HelloApplication.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Hello;
|
||||||
|
|
||||||
|
class HelloApplication
|
||||||
|
{
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
echo $this->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMessage()
|
||||||
|
{
|
||||||
|
return "Hello World!\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
15
tests/HelloApplicationTest.php
Normal file
15
tests/HelloApplicationTest.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Hello;
|
||||||
|
|
||||||
|
class HelloApplicationTest extends \PhpUnit\Framework\TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @covers HelloApplication::getMessage
|
||||||
|
*/
|
||||||
|
public function testTheMessage()
|
||||||
|
{
|
||||||
|
$app = new HelloApplication();
|
||||||
|
$this->assertEquals("Hello World!\n", $app->getMessage());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user