Skip to content

Commit

Permalink
Improve test workflow (#704)
Browse files Browse the repository at this point in the history
- Disable auto-migration in CI pipeline as it's done on test start
- Move away from undocumented env variable for this and use
`IConfiguration` (but still leave it undocumented 😁)
- Cache nuget package restore
  • Loading branch information
SapiensAnatis authored Mar 8, 2024
1 parent e08e19e commit 917fa67
Show file tree
Hide file tree
Showing 20 changed files with 13,641 additions and 45 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:
HUSKY: 0
POSTGRES_USER: testing
POSTGRES_PASSWORD: verystrongpassword
PostgresOptions__DisableAutoMigration: true

jobs:
test:
Expand Down Expand Up @@ -48,19 +49,32 @@ jobs:
run: >
echo ${{ inputs.project }} | sed 's/.*\//name=/' >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4

- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Load cache
id: cache
uses: actions/cache@v4
with:
path: .nuget-cache
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}-${{ steps.get-name.outputs.name }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Install dependencies
run: dotnet restore ${{ inputs.project }}
run: dotnet restore ${{ inputs.project }} --packages .nuget-cache --verbosity normal

- name: Test
run: >
dotnet test ${{ inputs.project }}
-c Release
--no-restore
--no-restore
--logger "console;verbosity=detailed"
--logger "trx;LogFileName=${{ steps.get-name.outputs.name }}.trx"
- name: Upload test report
uses: actions/upload-artifact@v4
if: success() || failure() # run this step even if previous step failed
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,32 @@ jobs:
run: >
echo ${{ inputs.project }} | sed 's/.*\//name=/' >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4

- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Load cache
id: cache
uses: actions/cache@v4
with:
path: .nuget-cache
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}-${{ steps.get-name.outputs.name }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Install dependencies
run: dotnet restore ${{ inputs.project }}
run: dotnet restore ${{ inputs.project }} --packages .nuget-cache --verbosity normal

- name: Test
run: >
dotnet test ${{ inputs.project }}
-c Release
--no-restore
--logger "console;verbosity=detailed"
--logger "trx;LogFileName=${{ steps.get-name.outputs.name }}.trx"
- name: Upload test report
uses: actions/upload-artifact@v4
if: success() || failure() # run this step even if previous step failed
Expand Down
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

<PropertyGroup>
Expand Down
Loading

0 comments on commit 917fa67

Please sign in to comment.