Skip to content

Commit 5eb708f

Browse files
ci: run tests on dev branch manually (#2264)
* ci: run tests on dev branch manually * Potential fix for code scanning alert no. 10: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent ce092b0 commit 5eb708f

File tree

1 file changed

+176
-0
lines changed

1 file changed

+176
-0
lines changed

.github/workflows/dev-tests.yml

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
name: Build and test dev branch
2+
# Manually run the full PR test suite against the dev branch
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1
8+
TERM: xterm
9+
10+
permissions:
11+
contents: read
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
services:
17+
redis:
18+
image: redis
19+
ports:
20+
- 6379/tcp
21+
options: --entrypoint redis-server
22+
mongodb:
23+
image: mongo
24+
ports:
25+
- 27017/tcp
26+
27+
steps:
28+
- uses: actions/checkout@v3
29+
with:
30+
fetch-depth: 1
31+
ref: dev
32+
- uses: actions/setup-dotnet@v4
33+
with:
34+
dotnet-version: |
35+
8.0.x
36+
cache: true
37+
cache-dependency-path: |
38+
Directory.Packages.props
39+
**/*.csproj
40+
41+
- name: Restore bin/obj cache
42+
id: cache
43+
uses: actions/cache/restore@v3
44+
with:
45+
path: |
46+
**/bin
47+
**/obj
48+
key: ${{ hashFiles('**/*.csproj', 'Directory.Packages.props') }}
49+
50+
- name: Restore dependencies
51+
run: dotnet restore ProtoActor.sln
52+
53+
- name: Build
54+
run: dotnet build ProtoActor.sln -c Release
55+
56+
- name: Save bin/obj cache
57+
if: steps.cache.outputs.cache-hit != 'true'
58+
uses: actions/cache/save@v3
59+
with:
60+
path: |
61+
**/bin
62+
**/obj
63+
key: ${{ steps.cache.outputs.cache-primary-key }}
64+
65+
test-slow: # slow tests that should run in parallel
66+
runs-on: ubuntu-latest
67+
68+
services:
69+
redis:
70+
image: redis
71+
ports:
72+
- 6379/tcp
73+
options: --entrypoint redis-server
74+
75+
strategy:
76+
matrix:
77+
dotnet:
78+
- net8.0
79+
test:
80+
- "tests/Proto.Cluster.Tests/*.csproj"
81+
- "tests/Proto.Cluster.PartitionIdentity.Tests/*.csproj"
82+
- "tests/Proto.Cluster.RedisIdentity.Tests/*.csproj"
83+
- "tests/Proto.Cluster.PubSub.Tests/*.csproj"
84+
85+
steps:
86+
- uses: actions/checkout@v3
87+
with:
88+
fetch-depth: 1
89+
ref: dev
90+
- uses: actions/setup-dotnet@v4
91+
with:
92+
dotnet-version: |
93+
8.0.x
94+
cache: true
95+
cache-dependency-path: |
96+
Directory.Packages.props
97+
**/*.csproj
98+
99+
- name: Restore bin/obj cache
100+
id: cache
101+
uses: actions/cache/restore@v3
102+
with:
103+
path: |
104+
**/bin
105+
**/obj
106+
key: ${{ hashFiles('**/*.csproj', 'Directory.Packages.props') }}
107+
108+
- name: Restore dependencies
109+
run: dotnet restore ProtoActor.sln
110+
111+
- name: Run tests ${{ matrix.test }}
112+
timeout-minutes: 15
113+
env:
114+
ConnectionStrings__Redis: localhost:${{ job.services.redis.ports[6379] }},syncTimeout=10000
115+
run: |
116+
dotnet test ${{ matrix.test }} -c Release -f ${{ matrix.dotnet }} --logger GitHubActions
117+
118+
- name: Save bin/obj cache
119+
if: steps.cache.outputs.cache-hit != 'true'
120+
uses: actions/cache/save@v3
121+
with:
122+
path: |
123+
**/bin
124+
**/obj
125+
key: ${{ steps.cache.outputs.cache-primary-key }}
126+
127+
test-fast: # fast tests where setting up a parallel job run is more overhead than just running the tests side by side
128+
runs-on: ubuntu-latest
129+
130+
strategy:
131+
matrix:
132+
test:
133+
- "tests/Proto.Actor.Tests/*.csproj"
134+
- "tests/Proto.Remote.Tests/*.csproj"
135+
# "tests/Proto.Persistence.Tests/*.csproj"
136+
- "tests/Proto.OpenTelemetry.Tests/*.csproj"
137+
- "tests/Proto.Cluster.CodeGen.Tests/*.csproj"
138+
139+
steps:
140+
- uses: actions/checkout@v3
141+
with:
142+
fetch-depth: 1
143+
ref: dev
144+
- uses: actions/setup-dotnet@v4
145+
with:
146+
dotnet-version: |
147+
8.0.x
148+
cache: true
149+
cache-dependency-path: |
150+
Directory.Packages.props
151+
**/*.csproj
152+
153+
- name: Restore bin/obj cache
154+
id: cache
155+
uses: actions/cache/restore@v3
156+
with:
157+
path: |
158+
**/bin
159+
**/obj
160+
key: ${{ hashFiles('**/*.csproj', 'Directory.Packages.props') }}
161+
162+
- name: Restore dependencies
163+
run: dotnet restore ProtoActor.sln
164+
- name: Run tests ${{ matrix.test }}
165+
timeout-minutes: 15
166+
run: |
167+
dotnet test ${{ matrix.test }} -c Release --logger GitHubActions
168+
169+
- name: Save bin/obj cache
170+
if: steps.cache.outputs.cache-hit != 'true'
171+
uses: actions/cache/save@v3
172+
with:
173+
path: |
174+
**/bin
175+
**/obj
176+
key: ${{ steps.cache.outputs.cache-primary-key }}

0 commit comments

Comments
 (0)