From 353c15b526198e388f5e275fdd7113f93f21bb9c Mon Sep 17 00:00:00 2001 From: Nathan Curtis Date: Tue, 9 Apr 2024 11:03:38 -0700 Subject: [PATCH] [TM-785] Github workflow to run tests. --- .github/workflows/pull-request.yml | 15 +++++++++++++++ Makefile | 10 +++++----- .../AdminIndexSiteReportsControllerTest.php | 4 ++-- 3 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 000000000..d7b52b16e --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,15 @@ +name: pull-request +on: + pull_request: + branches: [main, staging, release/**] +jobs: + lintTest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install deps + run: make composer + - name: Bring up Docker + run: make up + - name: Lint & Test + run: make test diff --git a/Makefile b/Makefile index 16c33bf88..0fdfff1ff 100644 --- a/Makefile +++ b/Makefile @@ -27,12 +27,12 @@ migrate-seed: migrate-seed-test: echo "create database if not exists terramatch_test;" | docker-compose exec -T mariadb mysql -h localhost -u root -proot echo "grant all on terramatch_test.* to 'wri'@'%';" | docker-compose exec -T mariadb mysql -h localhost -u root -proot - docker-compose exec php php artisan --env=testing migrate:fresh - docker-compose exec php php artisan --env=testing migrate-services - docker-compose exec php php artisan --env=testing db:seed + docker-compose exec -T php php artisan --env=testing migrate:fresh + docker-compose exec -T php php artisan --env=testing migrate-services + docker-compose exec -T php php artisan --env=testing db:seed test: lint migrate-seed-test - docker-compose exec php ./vendor/bin/phpunit + docker-compose exec -T php ./vendor/bin/phpunit test-single: docker-compose exec php ./vendor/bin/phpunit --filter $(t) @@ -43,7 +43,7 @@ quick-test: lint migrate-seed-test docker-compose exec php ./vendor/bin/phpunit --exclude=skipPipeline,slow lint: - docker-compose exec php ./vendor/bin/php-cs-fixer fix -v --dry-run --stop-on-violation --using-cache=no + docker-compose exec -T php ./vendor/bin/php-cs-fixer fix -v --dry-run --stop-on-violation --using-cache=no lint-fix: docker-compose exec php ./vendor/bin/php-cs-fixer fix -v diff --git a/tests/V2/SiteReports/AdminIndexSiteReportsControllerTest.php b/tests/V2/SiteReports/AdminIndexSiteReportsControllerTest.php index 5c97f63f1..cce52210d 100644 --- a/tests/V2/SiteReports/AdminIndexSiteReportsControllerTest.php +++ b/tests/V2/SiteReports/AdminIndexSiteReportsControllerTest.php @@ -18,8 +18,8 @@ class AdminIndexSiteReportsControllerTest extends TestCase public function test_invoke_action() { Artisan::call('v2migration:roles'); - Framework::factory()->create(['slug' => 'terrafund']); - Framework::factory()->create(['slug' => 'ppc']); +// Framework::factory()->create(['slug' => 'terrafund']); +// Framework::factory()->create(['slug' => 'ppc']); $tfAdmin = User::factory()->admin()->create(); $ppcAdmin = User::factory()->admin()->create(); $tfAdmin->givePermissionTo('framework-terrafund');