mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-04 21:06:04 +01:00
Updated dependencies and build test.
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,6 +3,8 @@ public/assets/
|
||||
var/
|
||||
vendor/
|
||||
node_modules/
|
||||
tests/fixtures/hg-repo/.hg/cache
|
||||
.cache/
|
||||
.env
|
||||
docker-compose.override.yml
|
||||
npm-debug.log
|
||||
|
||||
33
Makefile
33
Makefile
@@ -2,50 +2,51 @@
|
||||
.DEFAULT_GOAL := help
|
||||
NAME := gitlist
|
||||
VERSION := $(shell git show -s --format=%h)
|
||||
EXEC_DOCKER ?= docker-compose exec -T
|
||||
DOCKER_COMPOSE ?= docker compose
|
||||
EXEC_DOCKER ?= $(DOCKER_COMPOSE) exec -T
|
||||
EXEC_PHP ?= $(EXEC_DOCKER) php-fpm
|
||||
EXEC_NODE ?= $(EXEC_DOCKER) node
|
||||
EXEC_WEB ?= $(EXEC_DOCKER) web
|
||||
|
||||
help: # Display the application manual
|
||||
@echo -e "$(NAME) version \033[33m$(VERSION)\n\e[0m"
|
||||
@echo -e "\033[1;37mUSAGE\e[0m"
|
||||
@echo -e " \e[4mmake\e[0m <command> [<arg1>] ... [<argN>]\n"
|
||||
@echo -e "\033[1;37mAVAILABLE COMMANDS\e[0m"
|
||||
@echo "$(NAME) version \033[33m$(VERSION)\n\e[0m"
|
||||
@echo "\033[1;37mUSAGE\e[0m"
|
||||
@echo " \e[4mmake\e[0m <command> [<arg1>] ... [<argN>]\n"
|
||||
@echo "\033[1;37mAVAILABLE COMMANDS\e[0m"
|
||||
@grep -E '^[a-zA-Z_-]+:.*?# .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?# "}; {printf " \033[32m%-20s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
check-deps: check-local-overrides
|
||||
@if ! [ -x "$$(command -v docker-compose)" ]; then\
|
||||
echo -e '\n\033[0;31mdocker-compose is not installed.';\
|
||||
@if ! [ -x "$$(command -v docker)" ]; then\
|
||||
echo '\n\033[0;31mdocker is not installed.';\
|
||||
exit 1;\
|
||||
else\
|
||||
echo -e "\033[0;32mdocker-compose installed\033[0m";\
|
||||
echo "\033[0;32mdocker installed\033[0m";\
|
||||
fi
|
||||
|
||||
setup: check-deps # Setup dependencies and development configuration
|
||||
@docker-compose pull || true
|
||||
@docker-compose up -d --build
|
||||
$(DOCKER_COMPOSE) pull || true
|
||||
$(DOCKER_COMPOSE) up -d --build
|
||||
$(EXEC_PHP) composer install
|
||||
|
||||
up: # Create and start containers
|
||||
@docker-compose up -d
|
||||
$(DOCKER_COMPOSE) up -d
|
||||
|
||||
clean: # Cleanup containers and build artifacts
|
||||
@docker-compose down
|
||||
$(DOCKER_COMPOSE) down
|
||||
$(MAKE) setup
|
||||
|
||||
bash: # Start a bash session in the PHP container
|
||||
@docker-compose exec php-fpm /bin/bash
|
||||
$(EXEC_PHP) /bin/bash
|
||||
|
||||
test: # Run automated test suite
|
||||
$(EXEC_PHP) composer test
|
||||
$(EXEC_NODE) npm run test
|
||||
|
||||
acceptance:# Run acceptance test suite
|
||||
acceptance: # Run acceptance test suite
|
||||
$(EXEC_NODE) npm run cypress
|
||||
|
||||
show-app: # Open applicatipn in your browser
|
||||
xdg-open http://$$(docker-compose port webserver 80)/
|
||||
show-app: # Open application in your browser
|
||||
xdg-open http://$$(docker compose port webserver 80)/
|
||||
|
||||
update: # Update dependencies
|
||||
$(EXEC_PHP) composer update
|
||||
|
||||
@@ -8,29 +8,29 @@
|
||||
"php": ">=8.1",
|
||||
"ext-iconv": "*",
|
||||
"ext-mbstring": "*",
|
||||
"league/commonmark": "^2.4",
|
||||
"nesbot/carbon": "^2.71",
|
||||
"symfony/asset": "^6.3",
|
||||
"symfony/cache": "^6.3",
|
||||
"symfony/console": "^6.3",
|
||||
"symfony/form": "^6.3",
|
||||
"symfony/framework-bundle": "^6.3",
|
||||
"league/commonmark": "^2.7",
|
||||
"nesbot/carbon": "^3.10",
|
||||
"symfony/asset": "^6.4",
|
||||
"symfony/cache": "^6.4",
|
||||
"symfony/console": "^6.4",
|
||||
"symfony/form": "^6.4",
|
||||
"symfony/framework-bundle": "^6.4",
|
||||
"symfony/monolog-bundle": "^3.10",
|
||||
"symfony/process": "^6.3",
|
||||
"symfony/string": "^6.3",
|
||||
"symfony/templating": "^6.3",
|
||||
"symfony/translation": "^6.3",
|
||||
"symfony/twig-bundle": "^6.3",
|
||||
"symfony/webpack-encore-bundle": "^2.1",
|
||||
"symfony/yaml": "^6.3"
|
||||
"symfony/process": "^6.4",
|
||||
"symfony/string": "^6.4",
|
||||
"symfony/templating": "^6.4",
|
||||
"symfony/translation": "^6.4",
|
||||
"symfony/twig-bundle": "^6.4",
|
||||
"symfony/webpack-encore-bundle": "^2.3",
|
||||
"symfony/yaml": "^6.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^3.38",
|
||||
"friendsofphp/php-cs-fixer": "^3.86",
|
||||
"phpspec/prophecy-phpunit": "^2.0",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"symfony/debug-bundle": "^6.3",
|
||||
"symfony/dotenv": "^6.3"
|
||||
"symfony/debug-bundle": "^6.4",
|
||||
"symfony/dotenv": "^6.4"
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": {
|
||||
|
||||
3079
composer.lock
generated
3079
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,12 @@
|
||||
services:
|
||||
node:
|
||||
image: node:16-alpine
|
||||
build:
|
||||
context: docker/node/
|
||||
working_dir: /application
|
||||
volumes:
|
||||
- .:/application
|
||||
command: npm install && npm run watch
|
||||
command: sh -lc "npm ci && npm run watch"
|
||||
tty: true
|
||||
|
||||
webserver:
|
||||
build:
|
||||
|
||||
19
docker/node/Dockerfile
Normal file
19
docker/node/Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
||||
FROM node:22-bookworm
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
git ca-certificates wget \
|
||||
chromium \
|
||||
xvfb xauth \
|
||||
libgtk2.0-0 libgtk-3-0 libgbm1 libnotify4 libnss3 libxss1 libasound2 \
|
||||
libxshmfence1 libatk-bridge2.0-0 libdrm2 libx11-xcb1 libxtst6 libxrandr2 \
|
||||
libpangocairo-1.0-0 fonts-liberation libappindicator3-1 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV CYPRESS_CACHE_FOLDER=/application/.cache/Cypress \
|
||||
XDG_CACHE_HOME=/application/.cache \
|
||||
npm_config_unsafe_perm=true
|
||||
|
||||
WORKDIR /application
|
||||
|
||||
CMD ["node", "-e", "console.log('Container ready')"]
|
||||
@@ -1,6 +1,5 @@
|
||||
parameters:
|
||||
level: max
|
||||
checkMissingIterableValueType: false
|
||||
paths:
|
||||
- src
|
||||
ignoreErrors:
|
||||
|
||||
@@ -47,7 +47,7 @@ class Repository
|
||||
return $this->system->getTags($this->repository);
|
||||
}
|
||||
|
||||
public function getTree(string $commitish = null): Tree
|
||||
public function getTree(?string $commitish = null): Tree
|
||||
{
|
||||
if (!$commitish) {
|
||||
return $this->system->getTree($this->repository);
|
||||
@@ -62,7 +62,7 @@ class Repository
|
||||
return $this->system->getTree($this->repository, $commitish->getHash());
|
||||
}
|
||||
|
||||
public function getCommit(string $commitish = null): Commit
|
||||
public function getCommit(?string $commitish = null): Commit
|
||||
{
|
||||
if (!$commitish) {
|
||||
return $this->system->getCommit($this->repository);
|
||||
@@ -129,7 +129,7 @@ class Repository
|
||||
}
|
||||
}
|
||||
|
||||
public function searchCommits(Criteria $criteria, string $commitish = null): array
|
||||
public function searchCommits(Criteria $criteria, ?string $commitish = null): array
|
||||
{
|
||||
if (!$commitish) {
|
||||
return $this->system->searchCommits($this->repository, $criteria);
|
||||
|
||||
@@ -18,17 +18,17 @@ interface System
|
||||
|
||||
public function getTags(Repository $repository): array;
|
||||
|
||||
public function getTree(Repository $repository, string $hash = null): Tree;
|
||||
public function getTree(Repository $repository, ?string $hash = null): Tree;
|
||||
|
||||
public function getRecursiveTree(Repository $repository, string $hash = null): Tree;
|
||||
public function getRecursiveTree(Repository $repository, ?string $hash = null): Tree;
|
||||
|
||||
public function getPathTree(Repository $repository, string $path, string $hash = null): Tree;
|
||||
public function getPathTree(Repository $repository, string $path, ?string $hash = null): Tree;
|
||||
|
||||
public function getCommit(Repository $repository, string $hash = null): Commit;
|
||||
public function getCommit(Repository $repository, ?string $hash = null): Commit;
|
||||
|
||||
public function getCommits(Repository $repository, string $hash = null, int $page = 1, int $perPage = 10): array;
|
||||
public function getCommits(Repository $repository, ?string $hash = null, int $page = 1, int $perPage = 10): array;
|
||||
|
||||
public function getCommitsFromPath(Repository $repository, string $path, string $hash = null, int $page = 1, int $perPage = 10): array;
|
||||
public function getCommitsFromPath(Repository $repository, string $path, ?string $hash = null, int $page = 1, int $perPage = 10): array;
|
||||
|
||||
public function getSpecificCommits(Repository $repository, array $hashes): array;
|
||||
|
||||
@@ -36,7 +36,7 @@ interface System
|
||||
|
||||
public function getBlob(Repository $repository, string $hash, string $path): Blob;
|
||||
|
||||
public function searchCommits(Repository $repository, Criteria $criteria, string $hash = null): array;
|
||||
public function searchCommits(Repository $repository, Criteria $criteria, ?string $hash = null): array;
|
||||
|
||||
public function archive(Repository $repository, string $format, string $hash, string $path): string;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class CommandLine implements System
|
||||
|
||||
protected ?string $path;
|
||||
|
||||
public function __construct(string $path = null)
|
||||
public function __construct(?string $path = null)
|
||||
{
|
||||
if (!$path) {
|
||||
$path = (new ExecutableFinder())->find('git', '/usr/bin/git');
|
||||
@@ -67,7 +67,18 @@ class CommandLine implements System
|
||||
|
||||
public function getDefaultBranch(Repository $repository): string
|
||||
{
|
||||
$branch = $this->run(['symbolic-ref', '--short', 'HEAD'], $repository);
|
||||
try {
|
||||
$branch = $this->run(['symbolic-ref', '--short', 'HEAD'], $repository);
|
||||
} catch (CommandException $e) {
|
||||
$isOwnershipCheck = 0 === strpos($e->getMessage(), 'fatal: detected dubious ownership');
|
||||
if (!$isOwnershipCheck) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
// Git 2.35+ introduced ownership checks to prevent attacks when running git commands in directories owned by a different user
|
||||
$this->run(['config', '--global', '--add', 'safe.directory', '*']);
|
||||
$branch = $this->run(['symbolic-ref', '--short', 'HEAD'], $repository);
|
||||
}
|
||||
|
||||
return trim($branch);
|
||||
}
|
||||
@@ -298,7 +309,7 @@ class CommandLine implements System
|
||||
return $destination;
|
||||
}
|
||||
|
||||
protected function run(array $command, Repository $repository = null): string
|
||||
protected function run(array $command, ?Repository $repository = null): string
|
||||
{
|
||||
array_unshift($command, $this->path);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class CommandLine implements System
|
||||
|
||||
protected ?string $path;
|
||||
|
||||
public function __construct(string $path = null)
|
||||
public function __construct(?string $path = null)
|
||||
{
|
||||
if (!$path) {
|
||||
$path = (new ExecutableFinder())->find('hg', '/usr/bin/hg');
|
||||
@@ -297,7 +297,7 @@ class CommandLine implements System
|
||||
return $destination;
|
||||
}
|
||||
|
||||
protected function run(array $command, Repository $repository = null): string
|
||||
protected function run(array $command, ?Repository $repository = null): string
|
||||
{
|
||||
array_unshift($command, $this->path);
|
||||
|
||||
|
||||
@@ -24,9 +24,6 @@ class CommandLineTest extends TestCase
|
||||
if (empty(shell_exec('which git 2> /dev/null'))) {
|
||||
$this->markTestSkipped('Git is not available.');
|
||||
}
|
||||
|
||||
// Git 2.35+ introduced ownership checks to prevent attacks when running git commands in directories owned by a different user
|
||||
shell_exec('git config --global --add safe.directory "*"');
|
||||
}
|
||||
|
||||
public function testIsValidatingRepository(): void
|
||||
|
||||
Reference in New Issue
Block a user