Skip to content

Commit

Permalink
Merge branch 'volkszaehler:master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
magicWF authored Sep 2, 2023
2 parents 2f5352e + 778b008 commit 4a8115f
Show file tree
Hide file tree
Showing 116 changed files with 1,032 additions and 726 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: weekly
time: "04:00"
open-pull-requests-limit: 10
ignore:
- dependency-name: webpatser/laravel-uuid
versions:
- "4.0"
- dependency-name: symfony/console
versions:
- 5.2.0
75 changes: 75 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: "Build"

# original source: https://github.com/php-pm/php-pm/blob/master/.github/workflows/continuous-integration.yml

on:
pull_request:
push:

jobs:
build:
name: "Build"
runs-on: "ubuntu-22.04"

strategy:
fail-fast: false
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
deps:
- "normal"
include:
- deps: "low"
php-version: "7.4"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
fetch-depth: 0

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "pcntl"
tools: "cs2pr"
# this is needed in order to remove the pcntl_ restrictions on the php-cgi SAPI
ini-values: "disable_functions="

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v3"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"

- name: "Install dependencies with composer"
run: "composer update --no-interaction --no-progress --no-suggest --prefer-dist"
if: "${{ matrix.deps == 'normal' }}"

- name: "Install lowest possible dependencies with composer"
run: "composer update --no-interaction --no-progress --no-suggest --prefer-dist --prefer-lowest"
if: "${{ matrix.deps == 'low' }}"

# # Ignore CS for PHP8 until https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4702 is merged
# - name: "Run git-phpcs (for pull request)"
# if: "${{ github.event_name == 'pull_request' && matrix.php-version != '8.0' }}"
# run: |
# CHANGED_PHP_FILES=$(git diff origin/$GITHUB_BASE_REF --name-only --diff-filter=ACMRTUXB | grep -E "\.php$" || [[ $? == 1 ]])
# php vendor/bin/php-cs-fixer fix --config=.php_cs.php --dry-run --diff -v -- $CHANGED_PHP_FILES

# - name: "Run git-phpcs (for push)"
# if: "${{ github.event_name != 'pull_request' && matrix.php-version != '8.0' }}"
# run: |
# CHANGED_PHP_FILES=$(git diff --name-only --diff-filter=ACMRTUXB HEAD~..HEAD | grep -E "\.php$" || [[ $? == 1 ]])
# php vendor/bin/php-cs-fixer fix --config=.php_cs.php --dry-run --diff -v -- $CHANGED_PHP_FILES

# - name: "Run a static analysis with phpstan/phpstan"
# run: "php vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr"

# - name: "Run PHPUnit"
# run: "vendor/bin/phpunit"
51 changes: 51 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: docker

on:
push:
branches:
- master
workflow_dispatch:

jobs:
docker:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: volkszaehler/volkszaehler
tags: |
type=sha
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
- name: Build for test
uses: docker/build-push-action@v3
with:
load: true
tags: volkszaehler/volkszaehler
cache-from: type=gha

- name: Test image
run: ./misc/dockertest/test-docker.sh

- name: Push image
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ node_modules/
vendor/
lib/Model/Proxy
dbcopy.yaml
linux-*.Dockerfile
manifest.json
File renamed without changes.
6 changes: 3 additions & 3 deletions .phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
parameters:
excludes_analyse:
- vendor

ignoreErrors:
- '#Function sys_getloadvg not found#'
- '#Volkszaehler.View.Text.* does not call parent constructor#'
- '#Volkszaehler.Interpreter.AggregatorInterpreter.* does not call parent constructor#'
- '#Constructor of class Volkszaehler.Interpreter.AggregatorInterpreter has an unused parameter#'
- '#Constant VZ_DIR not found#'
- '#Variable .config in isset.. is never defined#'
- '#Variable .average in isset.. always exists and is not nullable#'
- '#Access to an undefined property Doctrine.DBAL.Logging.SQLLogger::.queries#'
- '#Undefined variable: .reference_#'
Expand Down
136 changes: 0 additions & 136 deletions .travis.yml

This file was deleted.

15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
# Copyright (c) 2019 Andreas Goetz <[email protected]>

FROM jorge07/alpine-php:7.3-dev AS builder
ARG PHP_IMAGE_TAG=8.1-alpine

FROM php:$PHP_IMAGE_TAG AS builder

WORKDIR /vz

COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
COPY composer.json /vz

RUN composer install --no-ansi --no-scripts --no-dev --no-interaction --no-progress --optimize-autoloader
RUN composer install --ignore-platform-reqs --no-ansi --no-scripts --no-dev --no-interaction --no-progress --optimize-autoloader

COPY . /vz


FROM jorge07/alpine-php:7.3
FROM php:$PHP_IMAGE_TAG

EXPOSE 8080
EXPOSE 8082
EXPOSE 5582

RUN apk add --no-cache postgresql-libs postgresql-dev \
&& docker-php-ext-install pcntl pdo_mysql pdo_pgsql mysqli \
&& apk del postgresql-dev

COPY --from=builder /vz /vz
COPY --from=builder /vz/etc/config.dist.yaml /vz/etc/config.yaml

# modify options.js
RUN sed -i "s/url: 'api'/url: '',/" /vz/htdocs/js/options.js

CMD /vz/vendor/bin/ppm start -c /vz/etc/middleware.json --static-directory /vz/htdocs --cgi-path=/usr/bin/php
CMD /vz/vendor/bin/ppm start -c /vz/etc/middleware.json --static-directory /vz/htdocs --cgi-path=/usr/local/bin/php
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# volkszaehler.org

[![Build Status](https://travis-ci.org/volkszaehler/volkszaehler.org.svg?branch=master)](https://travis-ci.org/volkszaehler/volkszaehler.org)
[![Build](https://github.com/volkszaehler/volkszaehler.org/actions/workflows/build.yml/badge.svg)](https://github.com/volkszaehler/volkszaehler.org/actions/workflows/build.yml)

volkszaehler.org is a free smart meter implementation with focus on data privacy.

Expand Down Expand Up @@ -62,5 +62,5 @@ Or follow the detailed installation instructions at http://wiki.volkszaehler.org

## Copyright

Copyright © 2011-2018 volkszaehler.org
Copyright © 2011-2020 volkszaehler.org
Licensed under the GNU General Public License Version 3 (https://opensource.org/licenses/GPL-3.0).
Loading

0 comments on commit 4a8115f

Please sign in to comment.