-
Notifications
You must be signed in to change notification settings - Fork 25
125 lines (106 loc) · 3.78 KB
/
dotnet-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
fail-fast: false
runs-on: "${{ matrix.os }}"
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
id: setup-conda
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: csnakes_test
environment-file: src/Conda.Tests/python/environment.yml
- name: cleanup conda-incubator/setup-miniconda
run: conda clean --all --yes
- name: Setup Python
id: installpython
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python }}"
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
- uses: actions/cache@v4
name: Cache NuGet packages
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('src/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore -bl:${{ github.workspace }}/restore-${{ matrix.os }}-${{ matrix.python }}.binlog
working-directory: src
env:
PYTHON_VERSION: ${{ steps.installpython.outputs.python-version }}
- name: Build
run: dotnet build --no-restore -bl:${{ github.workspace }}/build-${{ matrix.os }}-${{ matrix.python }}.binlog
working-directory: src
- name: Test
run: dotnet test --no-build --blame --verbosity m --collect "XPlat Code Coverage" --results-directory test-results /p:TrxLogFileNameSuffix=${{ matrix.os }}-${{ matrix.python }} -bl:${{ github.workspace }}/tests-${{ matrix.os }}-${{ matrix.python }}.binlog
working-directory: src
env:
PYTHON_VERSION: ${{ steps.installpython.outputs.python-version }}
- name: Upload logs
uses: actions/upload-artifact@v4
if: always()
with:
name: logs-${{ matrix.os }}-${{ matrix.python }}
path: |
${{ github.workspace }}/*.binlog
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.os }}-${{ matrix.python }}
path: |
${{ github.workspace }}/src/test-results/**
build-samples:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python: ["3.12"]
sample: ["simple", "Aspire"]
fail-fast: false
runs-on: "${{ matrix.os }}"
steps:
- uses: actions/checkout@v4
- name: Setup Python
id: installpython
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python }}"
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
- name: Install Aspire workload
run: dotnet workload install aspire
- name: Restore dependencies
run: dotnet restore "${{ matrix.sample }}"
working-directory: samples
- name: Build
run: dotnet build --no-restore "${{ matrix.sample }}"
working-directory: samples
- name: Test
run: dotnet test --no-build --verbosity normal "${{ matrix.sample }}"
working-directory: samples
env:
PYTHON_VERSION: ${{ steps.installpython.outputs.python-version }}