Skip to content

Commit

Permalink
Merge branch 'monorepo-test' into monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
ezzatron committed Aug 23, 2021
2 parents 60e5a38 + 932238d commit 2df1460
Show file tree
Hide file tree
Showing 56 changed files with 599 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/pkg-go/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.makefiles
.git
2 changes: 2 additions & 0 deletions test/pkg-go/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/artifacts
/.makefiles
7 changes: 7 additions & 0 deletions test/pkg-go/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: go
go: '1.15'
install:
- go mod download
- go install github.com/golang/protobuf/protoc-gen-go
script: make ci
after_success: bash <(curl -s https://codecov.io/bash)
4 changes: 4 additions & 0 deletions test/pkg-go/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM scratch

COPY artifacts/build/release/linux/amd64/cmd1 /cmd1
COPY artifacts/build/release/linux/amd64/cmd2 /cmd2
21 changes: 21 additions & 0 deletions test/pkg-go/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 James Harris, Erin Millard

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
9 changes: 9 additions & 0 deletions test/pkg-go/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DOCKER_REPO := makefiles/test

-include .makefiles/Makefile
-include .makefiles/pkg/protobuf/v1/Makefile
-include .makefiles/pkg/go/v1/Makefile
-include .makefiles/pkg/docker/v1/Makefile

.makefiles/%:
@curl -sfL https://makefiles.dev/v1 | bash /dev/stdin "$@"
7 changes: 7 additions & 0 deletions test/pkg-go/cmd/cmd1/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "fmt"

func main() {
fmt.Println("cmd1")
}
7 changes: 7 additions & 0 deletions test/pkg-go/cmd/cmd2/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "fmt"

func main() {
fmt.Println("cmd2")
}
5 changes: 5 additions & 0 deletions test/pkg-go/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/make-files/test

go 1.13

require github.com/golang/protobuf v1.3.2
2 changes: 2 additions & 0 deletions test/pkg-go/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
4 changes: 4 additions & 0 deletions test/pkg-go/source.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package go1

// Global is a variable that is used in the tests.
var Global *TestMessage
79 changes: 79 additions & 0 deletions test/pkg-go/source.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions test/pkg-go/source.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
syntax = "proto3";

import "google/protobuf/any.proto";
option go_package = "go1";

message TestMessage {
google.protobuf.Any any = 1;
}
8 changes: 8 additions & 0 deletions test/pkg-go/source_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package go1_test

import "testing"
import . "github.com/make-files/test"

func Test(t *testing.T) {
Global = &TestMessage{}
}
13 changes: 13 additions & 0 deletions test/pkg-js/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
parserOptions: {
ecmaVersion: 2019,
},
env: {
jest: true,
node: true,
},
rules: {
'comma-dangle': ['error', 'always-multiline'],
'no-console': 'warn',
},
}
4 changes: 4 additions & 0 deletions test/pkg-js/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.makefiles/
/artifacts/
/node_modules/
/yarn.lock
10 changes: 10 additions & 0 deletions test/pkg-js/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
DOCKER_REPO := makefiles/test

-include .makefiles/Makefile
-include .makefiles/pkg/js/v1/Makefile
-include .makefiles/pkg/js/v1/with-yarn.mk
-include .makefiles/pkg/js/v1/with-webpack.mk
-include .makefiles/pkg/docker/v1/Makefile

.makefiles/%:
@curl -sfL https://makefiles.dev/v1 | bash /dev/stdin "$@"
6 changes: 6 additions & 0 deletions test/pkg-js/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
collectCoverageFrom: [
'src/**/*.js',
],
coverageDirectory: 'artifacts/coverage/jest',
}
13 changes: 13 additions & 0 deletions test/pkg-js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"private": true,
"dependencies": {
"stats-webpack-plugin": "^0.7.0",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10"
},
"devDependencies": {
"eslint": "^6.8.0",
"jest": "^24.9.0",
"webpack-bundle-analyzer": "^3.6.0"
}
}
1 change: 1 addition & 0 deletions test/pkg-js/src/bad.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('This should not be here')
1 change: 1 addition & 0 deletions test/pkg-js/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
window.makefiles = true
12 changes: 12 additions & 0 deletions test/pkg-js/src/module-a.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
functionA,
functionB,
}

function functionA () {
return 'a'
}

function functionB () {
return 'b'
}
12 changes: 12 additions & 0 deletions test/pkg-js/src/module-b.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
functionA,
functionB,
}

function functionA () {
return 'a'
}

function functionB () {
return 'b'
}
5 changes: 5 additions & 0 deletions test/pkg-js/test/jest/module-a.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const {functionA} = require('../../src/module-a.js')

test('functionA()', () => {
expect(functionA()).toBe('a')
})
16 changes: 16 additions & 0 deletions test/pkg-js/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const {join} = require('path')
const StatsPlugin = require('stats-webpack-plugin')

module.exports = (_, {mode = 'development'} = {}) => {
const isProduction = mode === 'production'

return {
mode,
output: {
path: join(__dirname, 'artifacts/webpack/build', mode),
},
plugins: [
new StatsPlugin('.stats.json'),
],
}
}
5 changes: 5 additions & 0 deletions test/pkg-php-peridot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.makefiles/
/.phpunit.result.cache
/artifacts/
/composer.lock
/vendor/
13 changes: 13 additions & 0 deletions test/pkg-php-peridot/.php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude([
'vendor',
]);

return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
])
->setFinder($finder);
10 changes: 10 additions & 0 deletions test/pkg-php-peridot/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
DOCKER_REPO := makefiles/test
PHP_PERIDOT_PRIMARY_REPORTER := dot
PHP_PHPUNIT_RESULT_CACHE_FILE :=

-include .makefiles/Makefile
-include .makefiles/pkg/php/v1/Makefile
-include .makefiles/pkg/docker/v1/Makefile

.makefiles/%:
@curl -sfL https://makefiles.dev/v1 | bash /dev/stdin "$@"
Empty file.
Empty file.
21 changes: 21 additions & 0 deletions test/pkg-php-peridot/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "makefiles/test",
"description": "Test project for make-files/pkg-php",
"license": "MIT",
"require": {
},
"require-dev": {
"phpunit/phpunit": "^6",
"peridot-php/peridot": "^1.19",
"peridot-php/peridot-code-coverage-reporters": "^3.0",
"peridot-php/leo": "^1.6",
"peridot-php/peridot-dot-reporter": "^1.0",
"friendsofphp/php-cs-fixer": "^2.16",
"pcov/clobber": "^2.0"
},
"autoload": {
"psr-4": {
"Makefiles\\Test\\": "src"
}
}
}
25 changes: 25 additions & 0 deletions test/pkg-php-peridot/peridot.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

use Evenement\EventEmitterInterface;
use Peridot\Console\Environment;
use Peridot\Reporter\CodeCoverageReporters;
use Peridot\Reporter\CodeCoverage\CodeCoverageReporter;
use Peridot\Reporter\Dot\DotReporterPlugin;

error_reporting(-1);

return function (EventEmitterInterface $emitter) {
new DotReporterPlugin($emitter);

// set the default path
$emitter->on('peridot.start', function (Environment $environment) {
$environment->getDefinition()->getArgument('path')->setDefault('test/peridot');
});

$emitter->on('code-coverage.start', function (CodeCoverageReporter $reporter) {
$reporter->addDirectoryToWhitelist(__DIR__ . '/src');
});

$coverage = new CodeCoverageReporters($emitter);
$coverage->register();
};
23 changes: 23 additions & 0 deletions test/pkg-php-peridot/phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.4/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
executionOrder="depends,defects"
forceCoversAnnotation="false"
beStrictAboutCoversAnnotation="false"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
verbose="true">
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">test</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
Loading

0 comments on commit 2df1460

Please sign in to comment.