Skip to content

Commit

Permalink
Merge pull request #348 from silinternational/develop
Browse files Browse the repository at this point in the history
Release 6.7.7 -- add a log message and do some housekeeping
  • Loading branch information
briskt authored Jul 31, 2024
2 parents eaf813f + 36a1435 commit 4cea80e
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 35 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Check PSR2
run: docker-compose -f actions-services.yml run --rm app ./check-psr2.sh
run: docker compose -f actions-services.yml run --rm app ./check-psr12.sh
- name: Run unit tests
run: docker-compose -f actions-services.yml run --rm app ./run-tests.sh
run: docker compose -f actions-services.yml run --rm app ./run-tests.sh

build-and-publish:
name: Build and Publish
Expand Down
48 changes: 24 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
start: app

app: db composer
docker-compose up -d app phpmyadmin
docker compose up -d app phpmyadmin

appfortests: testdb composerfortests
docker-compose up -d appfortests
docker compose up -d appfortests

bash:
docker-compose run --rm cli bash
docker compose run --rm cli bash

composer:
docker-compose run --rm cli composer install
docker compose run --rm cli composer install

composerfortests:
docker-compose run --rm appfortests composer install
docker-compose run --rm dynamorestart composer install
docker compose run --rm appfortests composer install
docker compose run --rm dynamorestart composer install

composershow:
docker-compose run --rm cli bash -c 'composer show --format=json --no-dev --no-ansi --locked | jq "[.locked[] | { \"name\": .name, \"version\": .version }]" > dependencies.json'
docker compose run --rm cli bash -c 'composer show --format=json --no-dev --no-ansi --locked | jq "[.locked[] | { \"name\": .name, \"version\": .version }]" > dependencies.json'

composerupdate:
docker-compose run --rm cli composer update
docker compose run --rm cli composer update
make composershow

db:
docker-compose up -d db
docker compose up -d db

testdb:
docker-compose up -d testdb
docker compose up -d testdb

tables: db
docker-compose run --rm cli whenavail db 3306 100 ./yii migrate --interactive=0
docker compose run --rm cli whenavail db 3306 100 ./yii migrate --interactive=0

tablesfortests: testdb
docker-compose run --rm appfortests whenavail testdb 3306 100 ./yii migrate --interactive=0
docker compose run --rm appfortests whenavail testdb 3306 100 ./yii migrate --interactive=0

basemodels: db tables
docker-compose run --rm cli whenavail db 3306 100 ./rebuildbasemodels.sh
docker compose run --rm cli whenavail db 3306 100 ./rebuildbasemodels.sh

quicktest:
docker-compose run --rm test bash -c "vendor/bin/behat --stop-on-failure --strict --append-snippets"
docker compose run --rm test bash -c "vendor/bin/behat --stop-on-failure --strict --append-snippets"

test: appfortests
docker-compose run --rm test
docker compose run --rm test

testcli: appfortests tablesfortests mfaapi
docker-compose run --rm test bash
docker compose run --rm test bash

mfaapi:
docker-compose up -d mfaapi
docker compose up -d mfaapi

# This is needed to re-run certain feature tests in testcli without stopping that container.
dynamoclean:
docker-compose kill dynamorestart
docker-compose up -d dynamorestart
docker compose kill dynamorestart
docker compose up -d dynamorestart

clean:
docker-compose kill
docker-compose rm -f
docker compose kill
docker compose rm -f

raml2html:
touch api.html
docker-compose run --rm raml2html
docker compose run --rm raml2html

psr2:
docker-compose run --rm cli bash -c "vendor/bin/php-cs-fixer fix ."
docker compose run --rm cli bash -c "vendor/bin/php-cs-fixer fix ."

callGA: app
docker-compose exec app bash -c "./yii ga/register_event"
docker compose exec app bash -c "./yii ga/register_event"


1 change: 0 additions & 1 deletion actions-services.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '2'
services:
testdb:
image: mariadb:10
Expand Down
8 changes: 4 additions & 4 deletions application/check-psr2.sh → application/check-psr12.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
cd /data
composer install --no-interaction --no-scripts --no-progress

# Check the code against PSR-2.
# Check the code against PSR-12.
vendor/bin/php-cs-fixer fix -v --dry-run --stop-on-violation --using-cache=no .

# If it didn't match PSR-2, then exit.
# If it didn't match PSR-12, then exit.
rc=$?;
if [[ $rc != 0 ]]; then
echo ------------------------------------------------------------------------------
echo Please run \"make psr2\" to format the code as PSR-2, then commit those changes.
echo Please run \"make psr2\" to format the code as PSR-12, then commit those changes.
echo ------------------------------------------------------------------------------
exit $rc;
fi

echo -------------------------------------------------
echo All PHP files appear to match PSR-2 requirements.
echo All PHP files appear to match PSR-12 requirements.
echo -------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ public function actionCreate(): User
// rpOrigin is needed for WebAuthn authentication
$rpOrigin = \Yii::$app->request->get('rpOrigin', '');
if ($rpOrigin != '' && !in_array($rpOrigin, \Yii::$app->params['authorizedRPOrigins'])) {
throw new ForbiddenHttpException("Invalid rpOrigin", 1639169238);
$message = "Invalid rpOrigin. Received " . $rpOrigin . " authorized " .
var_export(\Yii::$app->params['authorizedRPOrigins'], true);
\Yii::error($message);
throw new ForbiddenHttpException($message, 1639169238);
}

$authentication = new Authentication(
Expand Down
5 changes: 4 additions & 1 deletion application/frontend/controllers/MfaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ public function actionList(string $employeeId): array
// rpOrigin is needed for WebAuthn authentication
$rpOrigin = \Yii::$app->request->get('rpOrigin', '');
if ($rpOrigin != '' && !in_array($rpOrigin, \Yii::$app->params['authorizedRPOrigins'])) {
throw new ForbiddenHttpException("Invalid rpOrigin", 1638378156);
$message = "Invalid rpOrigin. Received " . $rpOrigin . " authorized " .
var_export(\Yii::$app->params['authorizedRPOrigins'], true);
\Yii::error($message);
throw new ForbiddenHttpException($message, 1638378156);
}

$mfaOptions = Mfa::findAll(['user_id' => $user->id, 'verified' => 1]);
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ services:
U2F_SIM_HOST_AND_PORT: u2fsim:8080
command: ./run-tests.sh
# running isolated tests
# docker-compose run --rm test vendor/bin/behat --stop-on-failure features/user.feature
# docker-compose run --rm test vendor/bin/behat --stop-on-failure features/user.feature:306
# docker compose run --rm test vendor/bin/behat --stop-on-failure features/user.feature
# docker compose run --rm test vendor/bin/behat --stop-on-failure features/user.feature:306

phpmyadmin:
image: phpmyadmin:5
Expand Down

0 comments on commit 4cea80e

Please sign in to comment.