forked from temporalio/sdk-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (159 loc) · 6.6 KB
/
package.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Build Package
on:
push:
branches:
- main
- "releases/*"
jobs:
build-bridge-libraries:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest]
include:
- os: ubuntu-latest
out-file: libtemporal_sdk_bridge.so
out-prefix: linux-x64
# We use the Python manylinux image for glibc compatibility
container: quay.io/pypa/manylinux2014_x86_64
protobuf-url: https://github.com/protocolbuffers/protobuf/releases/download/v22.3/protoc-22.3-linux-x86_64.zip
curl-download: https://github.com/stunnel/static-curl/releases/download/8.8.0/curl-linux-x86_64-8.8.0.tar.xz
- os: ubuntu-arm
out-file: libtemporal_sdk_bridge.so
out-prefix: linux-arm64
runsOn: buildjet-4vcpu-ubuntu-2204-arm
# We use the Python manylinux image for glibc compatibility
container: quay.io/pypa/manylinux2014_aarch64
protobuf-url: https://github.com/protocolbuffers/protobuf/releases/download/v22.3/protoc-22.3-linux-aarch_64.zip
curl-download: https://github.com/stunnel/static-curl/releases/download/8.8.0/curl-linux-aarch64-8.8.0.tar.xz
- os: macos-intel
out-file: libtemporal_sdk_bridge.dylib
out-prefix: osx-x64
runsOn: macos-12
- os: macos-arm
out-file: libtemporal_sdk_bridge.dylib
out-prefix: osx-arm64
runsOn: macos-14
- os: windows-latest
out-file: temporal_sdk_bridge.dll
out-prefix: win-x64
runs-on: ${{ matrix.runsOn || matrix.os }}
container: ${{ matrix.container }}
env:
# This is required to allow continuing usage of Node 16 for actions,
# as Node 20 won't run on the docker image we use for linux builds
# (Node 20 require glibc 2.28+, but container image has glibc 2.17).
# https://github.blog/changelog/2024-05-17-updated-dates-for-actions-runner-using-node20-instead-of-node16-by-default/
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- name: Checkout repository
# FIXME: v4+ requires Node 20
uses: actions/checkout@v3
with:
submodules: recursive
# Need to update cURL on Linux for the Rust install step
- name: Update cURL
if: ${{ matrix.curl-download }}
run: |
curl --fail -L "${{ matrix.curl-download }}" -o curl.tar.xz
tar -xJvf curl.tar.xz -C /usr/local/bin
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Setup Rust cache
# FIXME: v2.7.2+ requires Node 20
# Fixed version due to https://github.com/Swatinem/rust-cache/issues/183#issuecomment-1893979126
uses: Swatinem/rust-cache@v2.7.1
with:
workspaces: src/Temporalio/Bridge
key: ${{ matrix.os }}
- name: Install protoc
# FIXME: v3+ requires Node 20
uses: arduino/setup-protoc@v2
with:
version: "23.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: cargo build --manifest-path src/Temporalio/Bridge/Cargo.toml --release
- name: Upload bridge library
# FIXME: v4+ requires Node 20
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.out-prefix }}-bridge
path: src/Temporalio/Bridge/target/release/${{ matrix.out-file }}
build-nuget-package:
needs:
- build-bridge-libraries
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download bridge libraries
# Need v3 here to stay compatible with the compile-native-binaries job.
uses: actions/download-artifact@v3-node20
with:
path: bridge-libraries
- name: Setup .NET
uses: actions/setup-dotnet@v4
- name: Build package
run: dotnet pack -c Release /p:BridgeLibraryRoot=${{ github.workspace }}/bridge-libraries
- name: Upload NuGet artifact
uses: actions/upload-artifact@v4
with:
name: nuget-package
path: |
src/Temporalio/bin/Release/*.nupkg
src/Temporalio/bin/Release/*.snupkg
src/Temporalio.Extensions.DiagnosticSource/bin/Release/*.nupkg
src/Temporalio.Extensions.DiagnosticSource/bin/Release/*.snupkg
src/Temporalio.Extensions.Hosting/bin/Release/*.nupkg
src/Temporalio.Extensions.Hosting/bin/Release/*.snupkg
src/Temporalio.Extensions.OpenTelemetry/bin/Release/*.nupkg
src/Temporalio.Extensions.OpenTelemetry/bin/Release/*.snupkg
run-smoke-test:
needs:
- build-nuget-package
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest]
include:
- os: ubuntu-arm
runsOn: buildjet-4vcpu-ubuntu-2204-arm
- os: macos-intel
runsOn: macos-12
- os: macos-arm
runsOn: macos-14
runs-on: ${{ matrix.runsOn || matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download NuGet artifact
uses: actions/download-artifact@v4
with:
name: nuget-package
path: nuget-package
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
# Specific .NET version required because GitHub macos ARM image has
# bad pre-installed .NET version
dotnet-version: 6.x
- name: Run smoke test
run: |
dotnet add tests/Temporalio.SmokeTest package Temporalio -s "${{ github.workspace }}/nuget-package/Temporalio/bin/Release;https://api.nuget.org/v3/index.json" --prerelease
dotnet run --project tests/Temporalio.SmokeTest
- name: Setup msbuild (Windows only)
if: ${{ matrix.os == 'windows-latest' }}
uses: microsoft/setup-msbuild@v2
- name: Run .NET framework smoke test (Windows only)
if: ${{ matrix.os == 'windows-latest' }}
run: |
dotnet add tests/Temporalio.SmokeTestDotNetFramework package Temporalio -s "${{ github.workspace }}/nuget-package/Temporalio/bin/Release;https://api.nuget.org/v3/index.json" --prerelease
msbuild tests/Temporalio.SmokeTestDotNetFramework -t:restore,build -p:Platform=x64
tests/Temporalio.SmokeTestDotNetFramework/bin/x64/Debug/Temporalio.SmokeTestDotNetFramework.exe