-
Notifications
You must be signed in to change notification settings - Fork 17
122 lines (109 loc) · 4.36 KB
/
dotnet.yaml
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
name: .NET Features Testing
on:
workflow_call:
inputs:
dotnet-repo-path:
type: string
default: 'temporalio/sdk-dotnet'
version:
required: true
type: string
# When true, the version refers to a repo tag/ref. When false, NPM package version.
version-is-repo-ref:
required: true
type: boolean
features-repo-path:
type: string
default: 'temporalio/features'
features-repo-ref:
type: string
default: 'main'
# If set, download the docker image for server from the provided artifact name
docker-image-artifact-name:
type: string
required: false
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./features
steps:
- name: Print git info
run: 'echo head_ref: "$GITHUB_HEAD_REF", ref: "$GITHUB_REF", ts version: ${{ inputs.version }}'
working-directory: '.'
- name: Download docker artifacts
if: ${{ inputs.docker-image-artifact-name }}
uses: actions/download-artifact@v4
with:
name: ${{ inputs.docker-image-artifact-name }}
path: /tmp/server-docker
- name: Load server Docker image
if: ${{ inputs.docker-image-artifact-name }}
run: docker load --input /tmp/server-docker/temporal-autosetup.tar
working-directory: '.'
- name: Override IMAGE_TAG environment variable
if: ${{ inputs.docker-image-artifact-name }}
run: |
image_tag=latest
# image_tag won't exist on older builds (like 1.22.0), so default to latest
if [ -f /tmp/server-docker/image_tag ]; then
image_tag=$(cat /tmp/server-docker/image_tag)
fi
echo "IMAGE_TAG=${image_tag}" >> $GITHUB_ENV
working-directory: '.'
- name: Checkout SDK features repo
uses: actions/checkout@v4
with:
path: features
repository: ${{ inputs.features-repo-path }}
ref: ${{ inputs.features-repo-ref }}
- name: Checkout .NET SDK repo
if: ${{ inputs.version-is-repo-ref }}
uses: actions/checkout@v4
with:
repository: ${{ inputs.dotnet-repo-path }}
submodules: recursive
path: sdk-dotnet
ref: ${{ inputs.version }}
- uses: actions/setup-dotnet@v4
- name: Install protoc
if: ${{ inputs.version-is-repo-ref }}
uses: arduino/setup-protoc@v3
with:
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
version: '23.x'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@v5
with:
go-version: '^1.21'
- uses: Swatinem/rust-cache@v2
if: ${{ inputs.version-is-repo-ref }}
with:
workspaces: sdk-dotnet/src/Temporalio/Bridge
# Build .NET SDK if using repo
# Don't build during install phase since we're going to explicitly build
- run: dotnet build
if: ${{ inputs.version-is-repo-ref }}
working-directory: ./sdk-dotnet
- name: Start containerized server and dependencies
if: inputs.docker-image-artifact-name
run: |
docker compose \
-f ./dockerfiles/docker-compose.for-server-image.yaml \
-f /tmp/server-docker/docker-compose.yml \
up -d temporal-server cassandra elasticsearch
- name: Run SDK-features tests directly
if: inputs.docker-image-artifact-name == ''
run: go run . run --lang cs ${{ inputs.docker-image-artifact-name && '--server localhost:7233 --namespace default' || ''}} --version "${{ inputs.version-is-repo-ref && '$(realpath ../sdk-dotnet)' || inputs.version }}"
# Running the tests in their own step keeps the logs readable
- name: Run containerized SDK-features tests
if: inputs.docker-image-artifact-name
run: |
docker compose \
-f ./dockerfiles/docker-compose.for-server-image.yaml \
-f /tmp/server-docker/docker-compose.yml \
up --no-log-prefix --exit-code-from features-tests-cs features-tests-cs
- name: Tear down docker compose
if: inputs.docker-image-artifact-name && (success() || failure())
run: docker compose -f ./dockerfiles/docker-compose.for-server-image.yaml -f /tmp/server-docker/docker-compose.yml down -v