|
22 | 22 | dotenv_file:
|
23 | 23 | required: true
|
24 | 24 | type: string
|
| 25 | + |
| 26 | +env: |
| 27 | + NUPKG_ARTIFACT_NAME: nupkg-${{inputs.dotnet_sdk_version}}-${{inputs.clr_version}}-${{inputs.redis_stack_type}} |
| 28 | + |
25 | 29 | jobs:
|
26 | 30 | build_and_test:
|
27 | 31 | name: Test
|
@@ -55,11 +59,10 @@ jobs:
|
55 | 59 | find . -name '*.csproj' | xargs cat
|
56 | 60 | jq -n --arg version ${{inputs.dotnet_sdk_version}} '{"sdk":{"version":$version,"rollForward":"latestMinor"}}' > global.json
|
57 | 61 | - name: Check .NET version
|
58 |
| - run: dotnet --version |
59 |
| - - name: Check .NET SDKs |
60 |
| - run: dotnet --list-sdks |
61 |
| - - name: Check .NET runtimes |
62 |
| - run: dotnet --list-runtimes |
| 62 | + run: | |
| 63 | + dotnet --version |
| 64 | + dotnet --list-sdks |
| 65 | + dotnet --list-runtimes |
63 | 66 | - name: Restore dependencies
|
64 | 67 | run: dotnet restore
|
65 | 68 | - name: Build
|
|
77 | 80 | verbose: true
|
78 | 81 | - name: Build
|
79 | 82 | run: dotnet pack -c Release
|
| 83 | + |
| 84 | + - name: Upload Nuget package as artifact |
| 85 | + uses: actions/upload-artifact@v4 |
| 86 | + with: |
| 87 | + name: ${{env.NUPKG_ARTIFACT_NAME}} |
| 88 | + path: "**/*.nupkg" |
| 89 | + if-no-files-found: error |
| 90 | + retention-days: 1 |
| 91 | + overwrite: true |
| 92 | + |
| 93 | + test_package: |
| 94 | + name: Test Package |
| 95 | + needs: build_and_test |
| 96 | + runs-on: ubuntu-latest |
| 97 | + steps: |
| 98 | + - uses: actions/checkout@v3 |
| 99 | + |
| 100 | + - name: .NET Core 8 |
| 101 | + uses: actions/setup-dotnet@v3 |
| 102 | + with: |
| 103 | + dotnet-version: 8 |
| 104 | + |
| 105 | + - name: Run redis-stack Docker |
| 106 | + working-directory: .github |
| 107 | + run: docker-compose up -d redis-stack-${{inputs.redis_stack_type}} |
| 108 | + |
| 109 | + - name: Set variables in dotenv |
| 110 | + uses: c-py/action-dotenv-to-setenv@v2 |
| 111 | + with: |
| 112 | + env-file: ${{inputs.dotenv_file}} |
| 113 | + |
| 114 | + - name: Prepare local Nuget source |
| 115 | + working-directory: dogfooding |
| 116 | + run: | |
| 117 | + mkdir -p test-source-data |
| 118 | + dotnet nuget add source $(readlink -f test-source-data) -n test-source |
| 119 | +
|
| 120 | + - name: Download Nuget package artifact |
| 121 | + uses: actions/download-artifact@v4 |
| 122 | + with: |
| 123 | + name: ${{env.NUPKG_ARTIFACT_NAME}} |
| 124 | + path: dogfooding/test-source-data |
| 125 | + |
| 126 | + - name: Test against Nuget package |
| 127 | + working-directory: dogfooding |
| 128 | + run: | |
| 129 | + # Tweak dotnet version |
| 130 | + find . -name '*.csproj' | xargs -I {} sed -E -i 's|<TargetFrameworks(.*)>.*</TargetFrameworks>|<TargetFramework\1>${{inputs.clr_version}}</TargetFramework>|' {} |
| 131 | + find . -name '*.csproj' | xargs cat |
| 132 | + jq -n --arg version ${{inputs.dotnet_sdk_version}} '{"sdk":{"version":$version,"rollForward":"latestMinor"}}' > global.json |
| 133 | + # Verify dotnet version |
| 134 | + dotnet --version |
| 135 | + dotnet --list-sdks |
| 136 | + dotnet --list-runtimes |
| 137 | + # Install package and run the code that uses it |
| 138 | + dotnet restore -s test-source |
| 139 | + dotnet run |
0 commit comments