Skip to content

Create build-and-test.yml #1

Create build-and-test.yml

Create build-and-test.yml #1

name: CI
on:
push:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
build-and-test:
name: Build and Unit Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: 1
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
cache: true
- name: Restore (Windows)
if: runner.os == 'Windows'
run: dotnet restore Couchbase.Analytics.sln
- name: Build (Windows, Release)
if: runner.os == 'Windows'
run: dotnet build Couchbase.Analytics.sln --configuration Release --no-restore
- name: Restore (Linux)
if: runner.os == 'Linux'
run: dotnet restore Couchbase.Analytics.sln
- name: Build (Linux, Release)
if: runner.os == 'Linux'
run: dotnet build Couchbase.Analytics.sln --configuration Release --no-restore
- name: Test - Couchbase.Analytics.UnitTests
run: dotnet test tests/Couchbase.Analytics.UnitTests/Couchbase.Analytics.UnitTests.csproj --configuration Release --no-build --logger "trx;LogFileName=unit-tests.trx" --results-directory "TestResults"
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: unit-test-results-${{ matrix.os }}
path: TestResults