diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b36e3b6..2ac91d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,40 +1,77 @@ -name: CSCI2910_Lab5 +name: .NET Core Console CI + + on: + push: - branches: - - main + + branches: [ "main" ] + pull_request: - branches: - - main + + branches: [ "main" ] + + jobs: + build-and-test: - runs-on: windows-latest + + + + name: build-and-test-${{matrix.os}} + + runs-on: ${{ matrix.os }} + + strategy: + + matrix: + + os: [ubuntu-latest, windows-latest, macOS-latest] + + + + env: + + Solution_Name: TestCases.sln + + Test_Project_Path: TestProject1/TestProject1.csproj + + steps: - # Checkout the code - - name: Checkout code - uses: actions/checkout@v3 - # Setup .NET - - name: Setup .NET - uses: actions/setup-dotnet@v3 + - name: Checkout repository + + uses: actions/checkout@v4 + + + + - name: Install .NET Core + + uses: actions/setup-dotnet@v4 + with: - dotnet-version: '8.0.x' - # Restore dependencies - - name: Restore dependencies - run: dotnet restore + dotnet-version: '8.0.x' + + + + - name: Restore NuGet packages + + run: dotnet restore ${{ env.Solution_Name }} + + + + - name: Build solution + + run: dotnet build ${{ env.Solution_Name }} --configuration Release --no-restore + + - # Build the solution - - name: Build the solution - run: dotnet build --no-restore --configuration Release + - name: Test and publish results - # Run MSTest - - name: Run tests - run: dotnet test --no-build --verbosity normal - env: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + run: | + dotnet test ${{ env.Test_Project_Path }} --no-restore --verbosity normal