From f0164cd24fbde8d6d4b6cdea58b9ccb790974a7e Mon Sep 17 00:00:00 2001 From: Dalet Date: Mon, 6 Mar 2023 00:01:15 +0900 Subject: [PATCH] test job: optional .env and separate restore, build, and test steps --- .github/workflows/test-backend.yml | 14 ++++++-------- .../LeaderboardBackend.Jobs.csproj | 2 +- .../LeaderboardBackend.Test.csproj | 2 +- LeaderboardBackend/LeaderboardBackend.csproj | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-backend.yml b/.github/workflows/test-backend.yml index 461ba8e8..cfc9f7a3 100644 --- a/.github/workflows/test-backend.yml +++ b/.github/workflows/test-backend.yml @@ -13,11 +13,9 @@ jobs: uses: actions/setup-dotnet@v1 with: dotnet-version: '7.0.x' - - name: Create .env file - run: cp example.env .env - - name: Spin up containers - run: docker compose up -d - - name: Run Tests on In Memory Database - run: ApplicationContext__UseInMemoryDb=true dotnet test LeaderboardBackend.Test - - name: Run Tests on Test Postgres Database - run: ApplicationContext__UseInMemoryDb=false dotnet test LeaderboardBackend.Test + - name: Restore NuGet packages + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Run tests + run: dotnet test LeaderboardBackend.Test --no-restore diff --git a/LeaderboardBackend.Jobs/LeaderboardBackend.Jobs.csproj b/LeaderboardBackend.Jobs/LeaderboardBackend.Jobs.csproj index 73850be8..7ad9a1d2 100644 --- a/LeaderboardBackend.Jobs/LeaderboardBackend.Jobs.csproj +++ b/LeaderboardBackend.Jobs/LeaderboardBackend.Jobs.csproj @@ -13,7 +13,7 @@ - + Always diff --git a/LeaderboardBackend.Test/LeaderboardBackend.Test.csproj b/LeaderboardBackend.Test/LeaderboardBackend.Test.csproj index 7d24fee1..475ea7e0 100644 --- a/LeaderboardBackend.Test/LeaderboardBackend.Test.csproj +++ b/LeaderboardBackend.Test/LeaderboardBackend.Test.csproj @@ -24,7 +24,7 @@ - + Always diff --git a/LeaderboardBackend/LeaderboardBackend.csproj b/LeaderboardBackend/LeaderboardBackend.csproj index 85e04ba1..fcb3a41e 100644 --- a/LeaderboardBackend/LeaderboardBackend.csproj +++ b/LeaderboardBackend/LeaderboardBackend.csproj @@ -38,7 +38,7 @@ - + Always