garnet

Форк
0
183 строки · 6.2 Кб
1
name: Garnet .NET CI
2
on:
3
  workflow_dispatch:
4
  push:
5
    branches:
6
      - main
7
  pull_request:
8
    branches:
9
      - main
10
  
11
env:
12
  DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
13
  DOTNET_NOLOGO: true
14

15
jobs:
16
  changes:
17
    name: Check for changes
18
    runs-on: ubuntu-latest # don't need matrix to test where the changes were made in code
19
    permissions:
20
      pull-requests: read
21
      contents: read
22
    outputs:
23
      tsavorite: ${{ steps.filter.outputs.tsavorite }}
24
      website: ${{ steps.filter.outputs.website }}
25
      garnet: ${{ steps.filter.outputs.garnet }}
26
    steps:
27
    - name: Check out code
28
      uses: actions/checkout@v4
29
    - name: Apply filter
30
      uses: dorny/paths-filter@v3
31
      id: filter
32
      with:
33
        filters: |
34
          tsavorite:
35
            - 'libs/storage/Tsavorite/**'
36
          website:
37
            - 'website/**'
38
          garnet:
39
            - '!((*.md)|(website/**))'
40
  
41
  format-garnet:
42
    name: Format Garnet
43
    needs: changes
44
    runs-on: ubuntu-latest
45
    if: needs.changes.outputs.garnet == 'true'
46
    steps:
47
      - name: Check out code
48
        uses: actions/checkout@v4
49
      - name: Setup .NET
50
        uses: actions/setup-dotnet@v4
51
        with:
52
          dotnet-version: 8.0.x
53
      - name: Install dependencies
54
        run: dotnet restore Garnet.sln
55
      - name: Check style format
56
        run: dotnet format Garnet.sln --no-restore --verify-no-changes --verbosity diagnostic
57

58
  format-tsavorite:
59
    name: Format Tsavorite
60
    needs: changes
61
    runs-on: ubuntu-latest
62
    if: needs.changes.outputs.tsavorite == 'true'
63
    steps:
64
      - name: Check out code
65
        uses: actions/checkout@v4
66
      - name: Setup .NET
67
        uses: actions/setup-dotnet@v4
68
        with:
69
          dotnet-version: 8.0.x
70
      - name: Install dependencies
71
        run: dotnet restore libs/storage/Tsavorite/cs/Tsavorite.sln
72
      - name: Check style format
73
        run: dotnet format libs/storage/Tsavorite/cs/Tsavorite.sln --no-restore --verify-no-changes --verbosity diagnostic
74
  
75
  # Job to build and test Garnet code
76
  build-test-garnet:
77
    name: Garnet
78
    needs: [changes, format-garnet]
79
    runs-on: ${{ matrix.os }}
80
    strategy:
81
      fail-fast: false
82
      matrix:
83
        os: [ ubuntu-latest, windows-latest ]
84
        framework: [ 'net6.0', 'net8.0' ]
85
        configuration: [ 'Debug', 'Release' ]
86
        test: [ 'Garnet.test', 'Garnet.test.cluster' ]
87
    if: needs.changes.outputs.garnet == 'true'
88
    steps:
89
      - name: Check out code
90
        uses: actions/checkout@v4
91
      - name: Setup .NET
92
        uses: actions/setup-dotnet@v4
93
        with:
94
          dotnet-version: 8.0.x
95
      - name: Install dependencies
96
        run: dotnet restore
97
      - name: Build Garnet
98
        run: dotnet build --configuration ${{ matrix.configuration }}
99
      - name: Run tests ${{ matrix.test }}
100
        run: dotnet test test/${{ matrix.test }} -f ${{ matrix.framework }} --configuration ${{ matrix.configuration }} --logger "console;verbosity=detailed" --logger trx --results-directory "GarnetTestResults-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}-${{ matrix.test }}"
101
        timeout-minutes: 30 
102
      - name: Upload test results
103
        uses: actions/upload-artifact@v4
104
        with:
105
          name: dotnet-garnet-results-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}-${{ matrix.test }}
106
          path: GarnetTestResults-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}-${{ matrix.test }}
107
        if: ${{ always() }}
108

109
  # Job to build and test Tsavorite code (only if there were changes to it)
110
  build-test-tsavorite:        
111
    name: Tsavorite
112
    needs: [changes, format-tsavorite]
113
    runs-on: ${{ matrix.os }}
114
    strategy:
115
      fail-fast: false
116
      matrix:
117
        os: [ ubuntu-latest, windows-latest ]
118
        framework: [ 'net6.0', 'net8.0' ]
119
        configuration: [ 'Debug', 'Release' ]
120
    if: needs.changes.outputs.tsavorite == 'true'   
121
    steps:
122
      - name: Check out code
123
        uses: actions/checkout@v4
124
      - name: Set environment variable for Linux
125
        run: echo "RunAzureTests=yes" >> $GITHUB_ENV
126
        if: ${{ matrix.os == 'ubuntu-latest' }}
127
      - name: Set environment variable for Windows
128
        run: echo ("RunAzureTests=yes") >> $env:GITHUB_ENV
129
        if: ${{ matrix.os == 'windows-latest' }}
130
      - name: Setup .NET
131
        uses: actions/setup-dotnet@v4
132
        with:
133
          dotnet-version: 8.0.x
134
      - name: Setup Node.js for Azurite
135
        uses: actions/setup-node@v4
136
        with:
137
          node-version: '20'
138
      - name: Install and Run Azurite
139
        shell: bash
140
        run: |
141
          npm install -g azurite
142
          azurite &
143
      - name: Install dependencies
144
        run: dotnet restore
145
      - name: Build Tsavorite
146
        run: dotnet build libs/storage/Tsavorite/cs/test/Tsavorite.test.csproj --configuration ${{ matrix.configuration }}
147
      - name: Run Tsavorite tests
148
        run: dotnet test libs/storage/Tsavorite/cs/test/Tsavorite.test.csproj -f ${{ matrix.framework }} --configuration ${{ matrix.configuration }} --logger "console;verbosity=detailed" --logger trx --results-directory "TsavoriteTestResults-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}"
149
        timeout-minutes: 30 
150
      - name: Upload test results
151
        uses: actions/upload-artifact@v4
152
        with:
153
          name: dotnet-tsavorite-results-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}
154
          path: TsavoriteTestResults-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}
155
        if: ${{ always() }}
156

157
  build-website:
158
    name: Build Website
159
    needs: changes    
160
    runs-on: ubuntu-latest
161
    defaults:
162
      run:
163
        working-directory: website
164
    if: needs.changes.outputs.website == 'true'   
165
    steps:
166
      - uses: actions/checkout@v3
167
      - uses: actions/setup-node@v3
168
        with:
169
          node-version: 18
170
          cache: yarn
171
          cache-dependency-path: ./website/yarn.lock
172
      - name: Install dependencies
173
        run: yarn install --frozen-lockfile
174
      - name: Build website
175
        run: yarn build
176

177
  pipeline-success:
178
    name: Garnet CI (Complete)
179
    runs-on: ubuntu-latest
180
    needs: [ build-test-garnet,  build-test-tsavorite, build-website ]
181
    steps:
182
    - run: echo Done!
183
    if: ${{ !(failure() || cancelled()) }}
184

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.