From f819e1469ab1205cd42b5d7e64689125dc152a27 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 3 Jan 2024 12:27:13 -0800 Subject: [PATCH 1/6] Run sqlite tests in GitHub action --- .../workflows/{tests.yml => tests-mysql.yml} | 0 .github/workflows/tests-sqlite.yml | 58 +++++++++++++++++++ 2 files changed, 58 insertions(+) rename .github/workflows/{tests.yml => tests-mysql.yml} (100%) create mode 100644 .github/workflows/tests-sqlite.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests-mysql.yml similarity index 100% rename from .github/workflows/tests.yml rename to .github/workflows/tests-mysql.yml diff --git a/.github/workflows/tests-sqlite.yml b/.github/workflows/tests-sqlite.yml new file mode 100644 index 000000000..bf1665748 --- /dev/null +++ b/.github/workflows/tests-sqlite.yml @@ -0,0 +1,58 @@ +name: Tests + +on: + push: + branches: + - master + - develop + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php-version: + - "8.1.1" + + name: PHP ${{ matrix.php-version }} + + steps: + - uses: shivammathur/setup-php@v2 + with: + php-version: "${{ matrix.php-version }}" + coverage: none + + - uses: actions/checkout@v4 + + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + - uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Copy .env + run: | + cp -v .env.testing.example .env + cp -v .env.testing.example .env.testing + + - name: Install Dependencies + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + + - name: Generate key + run: php artisan key:generate + + - name: Directory Permissions + run: chmod -R 777 storage bootstrap/cache + + - name: Execute tests (Unit and Feature tests) via PHPUnit + env: + DB_CONNECTION: sqlite_testing + run: php artisan test --parallel From 4894f524a05b7325c92efe330b9f86cbf4b577a7 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 3 Jan 2024 12:30:10 -0800 Subject: [PATCH 2/6] Update action name --- .github/workflows/tests-mysql.yml | 2 +- .github/workflows/tests-sqlite.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests-mysql.yml b/.github/workflows/tests-mysql.yml index a82946161..7c0659976 100644 --- a/.github/workflows/tests-mysql.yml +++ b/.github/workflows/tests-mysql.yml @@ -1,4 +1,4 @@ -name: Tests +name: Tests in MySQL on: push: diff --git a/.github/workflows/tests-sqlite.yml b/.github/workflows/tests-sqlite.yml index bf1665748..5b41c60de 100644 --- a/.github/workflows/tests-sqlite.yml +++ b/.github/workflows/tests-sqlite.yml @@ -1,4 +1,4 @@ -name: Tests +name: Tests in SQLite on: push: From 32b34ca9b934f306f836b587d6abdd7399e465d0 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Thu, 4 Jan 2024 12:33:33 -0800 Subject: [PATCH 3/6] departmentNameLinkFormatter had a bad url --- .env.testing.example | 19 ----------------- .github/workflows/crowdin-upload.yml | 21 ------------------- .../views/partials/bootstrap-table.blade.php | 2 +- 3 files changed, 1 insertion(+), 41 deletions(-) delete mode 100644 .env.testing.example delete mode 100644 .github/workflows/crowdin-upload.yml diff --git a/.env.testing.example b/.env.testing.example deleted file mode 100644 index 3391d6272..000000000 --- a/.env.testing.example +++ /dev/null @@ -1,19 +0,0 @@ -# -------------------------------------------- -# REQUIRED: BASIC APP SETTINGS -# -------------------------------------------- -APP_ENV=testing -APP_DEBUG=true -APP_KEY=base64:glJpcM7BYwWiBggp3SQ/+NlRkqsBQMaGEOjemXqJzOU= -APP_URL=http://localhost:8000 -APP_TIMEZONE='UTC' -APP_LOCALE=en - -# -------------------------------------------- -# REQUIRED: DATABASE SETTINGS -# -------------------------------------------- -DB_CONNECTION=mysql -DB_HOST=127.0.0.1 -DB_PORT=3306 -DB_DATABASE=null -DB_USERNAME=null -DB_PASSWORD=null diff --git a/.github/workflows/crowdin-upload.yml b/.github/workflows/crowdin-upload.yml deleted file mode 100644 index 325593453..000000000 --- a/.github/workflows/crowdin-upload.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Crowdin Action - -on: - push: - branches: [ develop ] - -jobs: - upload-sources-to-crowdin: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Crowdin push - uses: crowdin/github-action@v1 - with: - upload_sources: true - upload_translations: false - download_translations: false - project_id: ${{ secrets.CROWDIN_PROJECT_ID }} - token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index 74abfa24b..20c52d5b2 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -597,7 +597,7 @@ function departmentNameLinkFormatter(value, row) { if ((row.assigned_user) && (row.assigned_user.department) && (row.assigned_user.department.name)) { - return '' + row.assigned_user.department.name + ''; + return '' + row.assigned_user.department.name + ''; } } From 1f1e58eb1e1ce5f56e17fb1c617ace8a6c92ca94 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Thu, 4 Jan 2024 12:36:57 -0800 Subject: [PATCH 4/6] remove unintentional change --- .env.testing.example | 19 +++++++++++++++++ .github/workflows/crowdin-upload.yml | 21 +++++++++++++++++++ .../views/partials/bootstrap-table.blade.php | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 .env.testing.example create mode 100644 .github/workflows/crowdin-upload.yml diff --git a/.env.testing.example b/.env.testing.example new file mode 100644 index 000000000..3391d6272 --- /dev/null +++ b/.env.testing.example @@ -0,0 +1,19 @@ +# -------------------------------------------- +# REQUIRED: BASIC APP SETTINGS +# -------------------------------------------- +APP_ENV=testing +APP_DEBUG=true +APP_KEY=base64:glJpcM7BYwWiBggp3SQ/+NlRkqsBQMaGEOjemXqJzOU= +APP_URL=http://localhost:8000 +APP_TIMEZONE='UTC' +APP_LOCALE=en + +# -------------------------------------------- +# REQUIRED: DATABASE SETTINGS +# -------------------------------------------- +DB_CONNECTION=mysql +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_DATABASE=null +DB_USERNAME=null +DB_PASSWORD=null diff --git a/.github/workflows/crowdin-upload.yml b/.github/workflows/crowdin-upload.yml new file mode 100644 index 000000000..325593453 --- /dev/null +++ b/.github/workflows/crowdin-upload.yml @@ -0,0 +1,21 @@ +name: Crowdin Action + +on: + push: + branches: [ develop ] + +jobs: + upload-sources-to-crowdin: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Crowdin push + uses: crowdin/github-action@v1 + with: + upload_sources: true + upload_translations: false + download_translations: false + project_id: ${{ secrets.CROWDIN_PROJECT_ID }} + token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index 20c52d5b2..74abfa24b 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -597,7 +597,7 @@ function departmentNameLinkFormatter(value, row) { if ((row.assigned_user) && (row.assigned_user.department) && (row.assigned_user.department.name)) { - return '' + row.assigned_user.department.name + ''; + return '' + row.assigned_user.department.name + ''; } } From a110b5fccab22266ac992d6336fece5811ce77d5 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Thu, 4 Jan 2024 12:37:53 -0800 Subject: [PATCH 5/6] ugh --- resources/views/partials/bootstrap-table.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index 74abfa24b..20c52d5b2 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -597,7 +597,7 @@ function departmentNameLinkFormatter(value, row) { if ((row.assigned_user) && (row.assigned_user.department) && (row.assigned_user.department.name)) { - return '' + row.assigned_user.department.name + ''; + return '' + row.assigned_user.department.name + ''; } } From 742e183b02f955c6b2bb3b4238888935493439c7 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Thu, 4 Jan 2024 14:04:00 -0800 Subject: [PATCH 6/6] Add guard against adding null values to query Since $request->filled(null) returns true --- app/Http/Controllers/Api/AssetsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index 89d02c8b6..f5168a591 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -136,7 +136,7 @@ class AssetsController extends Controller // Search custom fields by column name foreach ($all_custom_fields as $field) { - if ($request->filled($field->db_column_name())) { + if ($request->filled($field->db_column_name()) && $field->db_column_name()) { $assets->where($field->db_column_name(), '=', $request->input($field->db_column_name())); } }