|
| 1 | +# This workflow will build a .NET project |
| 2 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net |
| 3 | + |
| 4 | +name: macos |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ "master" ] |
| 9 | + pull_request: |
| 10 | + branches: [ "master" ] |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + os: [macos-13] |
| 17 | + |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + - name: Setup .NET |
| 23 | + uses: actions/setup-dotnet@v4 |
| 24 | + with: |
| 25 | + dotnet-version: 8.0.x |
| 26 | + - name: Restore dependencies |
| 27 | + run: dotnet restore |
| 28 | + - name: Build |
| 29 | + run: dotnet build -c Debug --no-restore |
| 30 | + - name: Upload artifact |
| 31 | + |
| 32 | + with: |
| 33 | + name: cstojs-${{ matrix.os }}-artifact |
| 34 | + path: /Users/runner/work/CSharpToJavaScript/CSharpToJavaScript/CSharpToJavaScript/bin/Debug/net8.0/ |
| 35 | + if-no-files-found: error |
| 36 | + compression-level: 0 |
| 37 | + test: |
| 38 | + needs: build |
| 39 | + strategy: |
| 40 | + matrix: |
| 41 | + os: [macos-13] |
| 42 | + |
| 43 | + runs-on: ${{ matrix.os }} |
| 44 | + |
| 45 | + steps: |
| 46 | + - uses: actions/download-artifact@v4 |
| 47 | + with: |
| 48 | + name: cstojs-${{ matrix.os }}-artifact |
| 49 | + path: ~/artifact/ |
| 50 | + - name: Display structure of downloaded files |
| 51 | + run: ls -R ~/artifact/ |
| 52 | + - name: Clone CSTOJS_Tests |
| 53 | + |
| 54 | + with: |
| 55 | + owner: TiLied |
| 56 | + repository: CSTOJS_Tests |
| 57 | + branch: 'master' |
| 58 | + - name: Access cloned repository content |
| 59 | + run: ls -R CSTOJS_Tests |
| 60 | + - name: Setup .NET |
| 61 | + uses: actions/setup-dotnet@v4 |
| 62 | + with: |
| 63 | + dotnet-version: 8.0.x |
| 64 | + - name: List refs |
| 65 | + run: dotnet list CSTOJS_Tests/CSTOJS_Tests/CSTOJS_Tests.csproj reference |
| 66 | + - name: Delete reference |
| 67 | + run: dotnet remove CSTOJS_Tests/CSTOJS_Tests/CSTOJS_Tests.csproj reference "..\..\CSharpToJavaScript\CSharpToJavaScript\CSharpToJavaScript.csproj" |
| 68 | + - name: Replace reference |
| 69 | + run: sed -i '' 's+</Project>+<ItemGroup><Reference Include="CSharpToJavaScript"><HintPath>/Users/runner/artifact/CSharpToJavaScript.dll</HintPath></Reference></ItemGroup></Project>+g' CSTOJS_Tests/CSTOJS_Tests/CSTOJS_Tests.csproj |
| 70 | + - name: Cat CSTOJS_Tests.csproj |
| 71 | + run: cat CSTOJS_Tests/CSTOJS_Tests/CSTOJS_Tests.csproj |
| 72 | + - name: Add Microsoft.CodeAnalysis.CSharp reference |
| 73 | + run: dotnet add CSTOJS_Tests/CSTOJS_Tests/CSTOJS_Tests.csproj package Microsoft.CodeAnalysis.CSharp |
| 74 | + - name: Run tests |
| 75 | + run: dotnet test CSTOJS_Tests/CSTOJS_Tests/CSTOJS_Tests.csproj --filter "FullyQualifiedName!=CSTOJS_Tests.UnitTestOptions.TestNormalizeWhitespace" --logger "html;logfilename=test-result-${{ matrix.os }}.html;verbosity=detailed" --results-directory ~/artifact/ |
| 76 | + - name: Upload test result |
| 77 | + |
| 78 | + with: |
| 79 | + name: test-result-${{ matrix.os }} |
| 80 | + path: ~/artifact/test-result-${{ matrix.os }}.html |
| 81 | + if-no-files-found: error |
| 82 | + if: ${{ always() }} |
0 commit comments