From ffdd473c8e660084aeb8ff1d338a9b85b48ba30c Mon Sep 17 00:00:00 2001 From: Jeremy Woertink Date: Sat, 12 Oct 2024 15:30:30 -0700 Subject: [PATCH] running PowerShell for Windows to do integration CLI tests --- .github/workflows/ci.yml | 8 +++++++- script/integration_test.ps1 | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 script/integration_test.ps1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e64818f78..50d0e6ce0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,8 +72,14 @@ jobs: crystal: ${{matrix.crystal_version}} - name: Install shards run: SHARDS_OVERRIDE=${{ matrix.shard_file }} shards install - - name: Run integration test + - name: Run integration test (Linux) run: ./script/integration_test + if: matrix.os == 'ubuntu-latest' + env: + DATABASE_URL: postgres://lucky:developer@localhost:5432/avram_dev + - name: Run integration test (Windows) + run: .\script\integration_test.ps1 + if: matrix.os == 'windows-latest' env: DATABASE_URL: postgres://lucky:developer@localhost:5432/avram_dev - name: Run tests diff --git a/script/integration_test.ps1 b/script/integration_test.ps1 new file mode 100644 index 000000000..e476cef2b --- /dev/null +++ b/script/integration_test.ps1 @@ -0,0 +1,23 @@ +# Exit if any subcommand fails +$ErrorActionPreferences = "Stop" + +Write-Host "\nRunning tasks\n\n" + +crystal tasks.cr db.drop +crystal tasks.cr db.create +crystal tasks.cr db.migrate + +# If there were no errors, continue the test +if ($?) { + # Integration test various tasks + Write-Host "\nRolling back to 20180802180356\n" + crystal tasks.cr db.rollback_to 20180802180356 + crystal tasks.cr db.migrations.status + Write-Host "\nRolling back remainder\n" + crystal tasks.cr db.rollback_all + crystal tasks.cr db.migrate.one + crystal tasks.cr db.migrate + crystal tasks.cr db.reset + crystal tasks.cr db.drop + crystal tasks.cr db.setup +}