Skip to content

Commit

Permalink
Merge pull request #2 from monicahq/master
Browse files Browse the repository at this point in the history
update forked repo
  • Loading branch information
sktlmarat authored Mar 2, 2021
2 parents 310ef5f + 8de23ba commit a36eb19
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 112 deletions.
29 changes: 15 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Build

on:
push:
branches: [master]
pull_request:
types: [opened, synchronize, reopened]
branches-ignore: ['l10n_master*']
Expand All @@ -13,31 +11,32 @@ on:
workflows: ['Compress images']
types: [completed]

env:
php-version: 7.4
node-version: 14

jobs:
#############
# Build
#############
build:
runs-on: ubuntu-latest
name: Build (PHP ${{ matrix.php-version }})
name: Build Assets

strategy:
fail-fast: false
matrix:
php-version: [7.4]

env:
node-version: 14

steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup PHP ${{ matrix.php-version }}
- name: Setup PHP ${{ env.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: imagick, mbstring, dom, fileinfo, ${{ matrix.connection }}
php-version: ${{ env.php-version }}
extensions: imagick, mbstring, dom, fileinfo
coverage: none
- name: Check PHP Version
run: php -v
Expand All @@ -57,10 +56,10 @@ jobs:
uses: actions/cache@v2.1.4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
key: ${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-${{ matrix.php-version }}
${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-${{ env.php-version }}
${{ runner.os }}-composer-
- name: Install composer dependencies
Expand Down Expand Up @@ -91,11 +90,13 @@ jobs:
run: yarn run production

- name: Check if there is any file update needed
id: check
run: |
status=$(git status --porcelain)
if [ -z "$status" ]; then
echo "Nothing to push, already up to date."
else
echo -e "Waiting modifications:\n$status"
echo "::error::Assets are not up to date. Please rebuild with: 'yarn run lint:all' and 'yarn run prod'."
exit -1
fi
7 changes: 4 additions & 3 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
pull_request:
types: [labeled, opened, synchronize, reopened]

env:
node-version: 14


jobs:
cypress:
runs-on: ubuntu-latest
Expand All @@ -17,9 +21,6 @@ jobs:
browser: [chrome]
containers: [1, 2, 3, 4, 5, 6, 7, 8]

env:
node-version: 14

steps:
- name: Checkout sources
uses: actions/checkout@v2
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:

workflow_dispatch:

env:
php-version: 7.4
node-version: 14


jobs:
####################
# Semantic release
Expand Down Expand Up @@ -58,10 +63,6 @@ jobs:
name: Package release
if: needs.semantic.outputs.new_release_published == 'true'

env:
php-version: 7.4
node-version: 14

steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand Down
32 changes: 14 additions & 18 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ on:
workflows: ['Compress images']
types: [completed]

env:
php-version: 7.4


jobs:
psalm:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [7.4]

steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Setup PHP ${{ matrix.php-version }}
- name: Setup PHP ${{ env.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
php-version: ${{ env.php-version }}
extensions: imagick, mbstring, dom, fileinfo
coverage: none

Expand All @@ -33,10 +33,10 @@ jobs:
uses: actions/cache@v2.1.4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
key: ${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-${{ matrix.php-version }}
${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-${{ env.php-version }}
${{ runner.os }}-composer-
- name: Install dependencies
Expand All @@ -48,18 +48,14 @@ jobs:

phpstan:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [7.4]

steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Setup PHP ${{ matrix.php-version }}
- name: Setup PHP ${{ env.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
php-version: ${{ env.php-version }}
extensions: imagick, mbstring, dom, fileinfo
coverage: none

Expand All @@ -70,10 +66,10 @@ jobs:
uses: actions/cache@v2.1.4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
key: ${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-${{ matrix.php-version }}
${{ runner.os }}-composer-${{ env.php-version }}-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-${{ env.php-version }}
${{ runner.os }}-composer-
- name: Install dependencies
Expand Down
65 changes: 35 additions & 30 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ on:
workflows: ['Compress images']
types: [completed]

env:
default-php-version: 7.4
node-version: 14


jobs:
#############
# Run tests
#############
tests:
runs-on: ubuntu-latest
name: Unit tests on ${{ matrix.connection }} Testsuite ${{ matrix.testsuite }} (PHP ${{ matrix.php-version }})
name: Testsuite ${{ matrix.testsuite }} with PHP ${{ matrix.php-version }} (${{ matrix.connection }})

strategy:
fail-fast: false
Expand Down Expand Up @@ -106,25 +111,26 @@ jobs:

# Test
- name: Run Unit test suite
if: matrix.php-version == '7.4'
run: phpdbg -dmemory_limit=4G -qrr vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} --log-junit ./results/junit/results${{ matrix.testsuite }}.xml --coverage-clover ./results/coverage${{ matrix.testsuite }}.xml
if: matrix.php-version == env.default-php-version
run: phpdbg -dmemory_limit=4G -qrr vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} --log-junit ./results/junit/results${{ matrix.testsuite }}.xml --coverage-clover ./results/coverage/coverage${{ matrix.testsuite }}.xml
env:
DB_CONNECTION: ${{ matrix.connection }}
- name: Run Unit test suite
if: matrix.php-version != '7.4'
run: vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }}
if: matrix.php-version != env.default-php-version
run: vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} --log-junit ./results/junit/results${{ matrix.testsuite }}.xml
env:
DB_CONNECTION: ${{ matrix.connection }}

- name: Fix results files
if: matrix.php-version == '7.4'
run: sed -i -e "s%$GITHUB_WORKSPACE/%%g" results/*/*.xml
if: matrix.php-version == env.default-php-version
run: sed -i -e "s%$GITHUB_WORKSPACE/%%g" **/*.xml
working-directory: results

- name: Store results
if: matrix.php-version == '7.4' && always()
if: always()
uses: actions/upload-artifact@v2
with:
name: results${{ matrix.testsuite }}
name: results
path: results


Expand All @@ -133,17 +139,14 @@ jobs:
###################
tests_browser:
runs-on: ubuntu-latest
name: Tests browser on ${{ matrix.connection }} (PHP ${{ matrix.php-version }})
name: Tests browser with PHP ${{ matrix.php-version }} (${{ matrix.connection }})

strategy:
fail-fast: false
matrix:
php-version: [7.4]
php-version: [7.4, 8.0]
connection: [mysql]

env:
node-version: 14

steps:
- name: Checkout sources
uses: actions/checkout@v2
Expand Down Expand Up @@ -207,7 +210,7 @@ jobs:
run: |
cp scripts/ci/.env.${{ matrix.connection }} .env
touch config/.version config/.release .sentry-release .sentry-commit
mkdir -p results/coverage results/console
mkdir -p results/coverage results/cov results/console
chmod -R 777 storage bootstrap/cache
- name: Generate key
Expand Down Expand Up @@ -252,14 +255,18 @@ jobs:

- name: Fix coverage
run: |
vendor/bin/phpcov merge --clover=results/coverage0.xml results/coverage/
rm -rf results/coverage
vendor/bin/phpcov merge --clover=results/coverage/coverageBrowser.xml results/cov/
rm -rf results/cov
- name: Fix results files
run: sed -i -e "s%$GITHUB_WORKSPACE/%%g" **/*.xml
working-directory: results

- name: Store results
if: always()
uses: actions/upload-artifact@v2
with:
name: results0
name: results
path: results


Expand All @@ -278,21 +285,11 @@ jobs:
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- name: Checkout HEAD
if: github.event_name == 'pull_request'
run: git checkout HEAD^2

- name: Download results
uses: actions/download-artifact@v2
with:
path: results

- name: Fix results paths
run: |
pushd results
for f in $(ls); do cp -rf $f/* .; rm -rf $f; done
name: results

- name: Merge junit files
run: |
Expand All @@ -303,9 +300,15 @@ jobs:
id: version
run: |
version=$(git tag --points-at HEAD)
test -z "$version" && version="main"
test -z "$version" && version="master"
echo "::set-output name=value::$version"
- name: Set coverage list
id: coverage
run: |
SONAR_COVERAGE=$(ls -m --format=comma results/coverage/coverage*.xml | sed -e ':a;N;$!ba;s/\n//g; s/ //g;')
echo "::set-output name=list::$SONAR_COVERAGE"
- name: SonarCloud Scan
if: env.SONAR_TOKEN != ''
uses: SonarSource/sonarcloud-github-action@v1.5
Expand All @@ -315,3 +318,5 @@ jobs:
with:
args: |
-Dsonar.projectVersion=${{ steps.version.outputs.value }}
-Dsonar.php.tests.reportPath=./results/results.xml
-Dsonar.php.coverage.reportPaths=${{ steps.coverage.outputs.list }}
1 change: 1 addition & 0 deletions app/Http/Resources/Journal/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function toArray($request)
'object' => 'entry',
'title' => $this->title,
'post' => $this->post,
'date' => $this->date,
'url' => route('api.entry', $this->id),
'account' => [
'id' => $this->account_id,
Expand Down
Loading

0 comments on commit a36eb19

Please sign in to comment.