From a34d39805cb236f5f3453102c6fa18631eda57bc Mon Sep 17 00:00:00 2001 From: Bartek Fabiszewski Date: Sun, 20 Mar 2022 18:28:16 +0100 Subject: [PATCH] Fix Github Actions --- .github/workflows/tests.yml | 76 ++++++++++++++++++------------------- Dockerfile | 6 +-- composer.json | 6 +++ composer.lock | 67 +++++++++++++++++--------------- 4 files changed, 83 insertions(+), 72 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index eba61f5..b0f2505 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,9 +2,9 @@ name: Tests on: push: - branches: [ master ] + branches: [master, github-actions] pull_request: - branches: [ master ] + branches: [master] jobs: unix-tests: @@ -15,56 +15,56 @@ jobs: strategy: fail-fast: false - matrix: - config: - - name: MySQL - db-driver: mysql - db-dsn: mysql:host=127.0.0.1;port=8081;dbname=ulogger;charset=utf8 - docker-options: -p 8080:80 -p 8081:3306 --expose 3306 - - name: PostgreSQL - db-driver: pgsql - db-dsn: pgsql:host=127.0.0.1;port=8081;dbname=ulogger - docker-options: -p 8080:80 -p 8081:5432 --expose 5432 - - name: SQLite - db-driver: sqlite - db-dsn: sqlite:${{ runner.temp }}/data/sqlite/ulogger.db - docker-options: -p 8080:80 -v ${{ runner.temp }}/data:/data - env: - DB_DSN: "${{ matrix.config.db-dsn }}" - DB_USER: ulogger - DB_PASS: secret2 - ULOGGER_URL: "http://127.0.0.1:8080" + matrix: + db: [mysql, pgsql, sqlite] + php: ['7.4', '8.1'] steps: - uses: actions/checkout@v2 - - name: Prepare for docker - if: ${{ matrix.config.db-driver == 'sqlite' }} + - if: matrix.db == 'mysql' run: | - rm -rf ${{ runner.temp }}/data - mkdir -p ${{ runner.temp }}/data/sqlite ${{ runner.temp }}/data/uploads - sqlite3 -init scripts/ulogger.sqlite ${{ runner.temp }}/data/sqlite/ulogger.db .exit + echo "db-dsn=mysql:host=127.0.0.1;port=8081;dbname=ulogger;charset=utf8" >> $GITHUB_ENV + echo "docker-options=-p 8080:80 -p 8081:3306 --expose 3306" >> $GITHUB_ENV + - if: matrix.db == 'pgsql' + run: | + echo "db-dsn=pgsql:host=127.0.0.1;port=8081;dbname=ulogger" >> $GITHUB_ENV + echo "docker-options=-p 8080:80 -p 8081:5432 --expose 5432" >> $GITHUB_ENV + - if: matrix.db == 'sqlite' + run: | + echo "db-dsn=sqlite:${{ runner.temp }}/data/sqlite/ulogger.db" >> $GITHUB_ENV + echo "docker-options=-p 8080:80 -v ${{ runner.temp }}/data:/data" >> $GITHUB_ENV + rm -rf ${{ runner.temp }}/data + mkdir -p ${{ runner.temp }}/data/sqlite ${{ runner.temp }}/data/uploads + sqlite3 -init scripts/ulogger.sqlite ${{ runner.temp }}/data/sqlite/ulogger.db .exit + sudo chown -R runner ${{ runner.temp }}/data + sudo chmod -R 777 ${{ runner.temp }}/data + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: ctype, json, pdo, pdo_${{ matrix.db }}, session, simplexml, xmlwriter, xdebug + tools: composer - name: Build docker - run: docker build -t ulogger --build-arg DB_DRIVER=${{ matrix.config.db-driver }} . + run: docker build -t ulogger --build-arg DB_DRIVER=${{ matrix.db }} . - name: Run docker run: | - docker run -d --name ulogger ${{ matrix.config.docker-options }} -e ULOGGER_ENABLE_SETUP=1 ulogger - until netstat -atn 2>/dev/null | grep '8080.*LISTEN'; do sleep 1; done - - name: Install PHP dependencies - uses: php-actions/composer@v6 + docker run -d --name ulogger ${{ env.docker-options }} -e ULOGGER_ENABLE_SETUP=1 ulogger + until netstat -atn 2>/dev/null | grep '8080.*LISTEN'; do sleep 1; done - name: Setup node uses: actions/setup-node@v2 - name: Install node dependencies run: npm install + - name: Install PHP dependencies + run: composer install - name: PHPUnit tests - uses: php-actions/phpunit@v3 - with: - php_extensions: pdo_${{ matrix.config.db-driver }} xdebug - bootstrap: vendor/autoload.php - configuration: .tests/phpunit.xml - args: --coverage-text + run: ./vendor/bin/phpunit -c .tests/phpunit.xml env: XDEBUG_MODE: coverage + DB_DSN: "${{ env.db-dsn }}" + DB_USER: ulogger + DB_PASS: secret2 + ULOGGER_URL: "http://127.0.0.1:8080" - name: UI tests run: npm test @@ -72,7 +72,7 @@ jobs: run: npm run lint:js - name: CSS lint run: npm run lint:css - + - name: Show docker logs on failure if: ${{ failure() }} run: docker logs ulogger diff --git a/Dockerfile b/Dockerfile index c539710..6981a8a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.13 +FROM alpine:3.15 LABEL maintainer="Bartek Fabiszewski (https://github.com/bfabiszewski)" @@ -33,8 +33,8 @@ COPY .docker/run.sh /run.sh RUN chmod +x /run.sh COPY .docker/init.sh /init.sh RUN chmod +x /init.sh -COPY .docker/nginx.conf /etc/nginx/conf.d/default.conf -RUN chown nginx.nginx /etc/nginx/conf.d/default.conf +COPY .docker/nginx.conf /etc/nginx/http.d/default.conf +RUN chown nginx.nginx /etc/nginx/http.d/default.conf COPY . /var/www/html diff --git a/composer.json b/composer.json index 0417144..60f3f90 100644 --- a/composer.json +++ b/composer.json @@ -2,6 +2,7 @@ "name": "bfabiszewski/ulogger-server", "description": "ulogger server", "require": { + "php": ">=7.4", "ulrichsg/getopt-php": "^3.2", "ext-json": "*", "ext-pdo": "*", @@ -18,5 +19,10 @@ "vlucas/phpdotenv": "^5.3", "guzzlehttp/guzzle": "^7.3", "kornrunner/dbunit": "^6.0" + }, + "config": { + "platform": { + "php": "7.4" + } } } diff --git a/composer.lock b/composer.lock index 1e4652e..01510f9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1a3c4445dd142c9b904638bfe4a58a63", + "content-hash": "49479104520ca7b03de7504b29769153", "packages": [ { "name": "ulrichsg/getopt-php", @@ -192,16 +192,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.4.1", + "version": "7.4.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "ee0a041b1760e6a53d2a39c8c34115adc2af2c79" + "reference": "ac1ec1cd9b5624694c3a40be801d94137afb12b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ee0a041b1760e6a53d2a39c8c34115adc2af2c79", - "reference": "ee0a041b1760e6a53d2a39c8c34115adc2af2c79", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ac1ec1cd9b5624694c3a40be801d94137afb12b4", + "reference": "ac1ec1cd9b5624694c3a40be801d94137afb12b4", "shasum": "" }, "require": { @@ -296,7 +296,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.4.1" + "source": "https://github.com/guzzle/guzzle/tree/7.4.2" }, "funding": [ { @@ -312,7 +312,7 @@ "type": "tidelift" } ], - "time": "2021-12-06T18:43:05+00:00" + "time": "2022-03-20T14:16:28+00:00" }, { "name": "guzzlehttp/promises", @@ -400,16 +400,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.1.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "089edd38f5b8abba6cb01567c2a8aaa47cec4c72" + "reference": "6565c7e0db3231e92dd5ca3bed448b30fbc89eb1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/089edd38f5b8abba6cb01567c2a8aaa47cec4c72", - "reference": "089edd38f5b8abba6cb01567c2a8aaa47cec4c72", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/6565c7e0db3231e92dd5ca3bed448b30fbc89eb1", + "reference": "6565c7e0db3231e92dd5ca3bed448b30fbc89eb1", "shasum": "" }, "require": { @@ -433,7 +433,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.2-dev" } }, "autoload": { @@ -495,7 +495,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.1.0" + "source": "https://github.com/guzzle/psr7/tree/2.2.0" }, "funding": [ { @@ -511,7 +511,7 @@ "type": "tidelift" } ], - "time": "2021-10-06T17:43:30+00:00" + "time": "2022-03-20T13:51:08+00:00" }, { "name": "kornrunner/dbunit", @@ -3149,25 +3149,25 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.0.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced" + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/c726b64c1ccfe2896cb7df2e1331c357ad1c8ced", - "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3196,7 +3196,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0" }, "funding": [ { @@ -3212,7 +3212,7 @@ "type": "tidelift" } ], - "time": "2021-11-01T23:48:49+00:00" + "time": "2021-07-12T14:48:14+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3464,27 +3464,28 @@ }, { "name": "symfony/yaml", - "version": "v6.0.3", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "e77f3ea0b21141d771d4a5655faa54f692b34af5" + "reference": "e80f87d2c9495966768310fc531b487ce64237a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e77f3ea0b21141d771d4a5655faa54f692b34af5", - "reference": "e77f3ea0b21141d771d4a5655faa54f692b34af5", + "url": "https://api.github.com/repos/symfony/yaml/zipball/e80f87d2c9495966768310fc531b487ce64237a2", + "reference": "e80f87d2c9495966768310fc531b487ce64237a2", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<5.4" + "symfony/console": "<5.3" }, "require-dev": { - "symfony/console": "^5.4|^6.0" + "symfony/console": "^5.3|^6.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -3518,7 +3519,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.0.3" + "source": "https://github.com/symfony/yaml/tree/v5.4.3" }, "funding": [ { @@ -3534,7 +3535,7 @@ "type": "tidelift" } ], - "time": "2022-01-26T17:23:29+00:00" + "time": "2022-01-26T16:32:32+00:00" }, { "name": "theseer/tokenizer", @@ -3733,6 +3734,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { + "php": ">=7.4", "ext-json": "*", "ext-pdo": "*", "ext-xmlwriter": "*", @@ -3740,5 +3742,8 @@ "ext-libxml": "*" }, "platform-dev": [], + "platform-overrides": { + "php": "7.4" + }, "plugin-api-version": "2.2.0" }