158 lines (149 loc) 路 4.76 KB
/
ci-build-sdks.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
name: Build SDKs
permissions:
contents: read
on:
workflow_call:
inputs:
ref:
required: true
description: "GitHub ref to use"
type: string
version:
required: true
description: "Version to produce"
type: string
version-set:
required: false
description: "Set of language versions to use for builds, lints, releases, etc."
type: string
# Example provided for illustration, this value is derived by scripts/get-job-matrix.py build
default: |
{
"dotnet": "6.0.x",
"go": "1.18.x",
"nodejs": "14.x",
"python": "3.9.x"
}
defaults:
run:
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULUMI_VERSION: ${{ inputs.version }}
jobs:
build_python_sdk:
name: python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Setup versioning env vars
env:
version: ${{ inputs.version }}
run: |
./scripts/versions.sh | tee -a "${GITHUB_ENV}"
- name: Set up Python ${{ fromJson(inputs.version-set).python }}
uses: actions/setup-python@v3
with:
python-version: ${{ fromJson(inputs.version-set).python }}
cache: pip
cache-dependency-path: sdk/python/requirements.txt
- name: Build Pulumi Python SDK wheel
run: |
# TODO unify with sdk/python/Makefile once that does not use pipenv
cp README.md sdk/python/lib
cd sdk/python/lib
sed -i.bak "s/\${VERSION}/$PYPI_VERSION/g" setup.py
rm setup.py.bak
python3 -m venv venv
source venv/bin/activate
python -m pip install wheel
python setup.py build bdist_wheel --python-tag py3
- name: Upload pulumi.whl
uses: actions/upload-artifact@v2
with:
name: artifacts-python-sdk
path: sdk/python/lib/dist/*.whl
retention-days: 1
if-no-files-found: error
build_node_sdk:
name: nodejs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Setup versioning env vars
env:
version: ${{ inputs.version }}
run: |
./scripts/versions.sh | tee -a "${GITHUB_ENV}"
- name: Set up Node ${{ fromJson(inputs.version-set).nodejs }}
uses: actions/setup-node@v3
with:
node-version: ${{ fromJson(inputs.version-set).nodejs }}
cache: yarn
cache-dependency-path: sdk/nodejs/yarn.lock
- name: Install yarn
run: |
npm install -g yarn
# TODO something in `cd sdk/nodejs && make ensure` executes Go
# downloads, which is unfortunate and wasteful in this context.
# When this is fixed the no-op Go command can be removed.
- name: Make no-op Go command to avoid Go builds
run: |
cd sdk/nodejs
mkdir -p bin
# shellcheck disable=SC2230 # need to locate echo binary
ln -s "$(which echo)" bin/go
- name: Ensure installed dependencies
run: |
cd sdk/nodejs
PATH=./bin:$PATH make ensure
- name: Build the Node SDK package
run: |
cd sdk/nodejs
PATH=./bin:$PATH make build_package
- name: Pack the Node SDK
run: |
cd sdk/nodejs/bin
npm pack
- name: Upload pulumi-node-sdk.tgz
uses: actions/upload-artifact@v2
with:
name: artifacts-nodejs-sdk
path: sdk/nodejs/bin/*.tgz
retention-days: 1
if-no-files-found: error
build_dotnet_sdk:
name: dotnet
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Setup versioning env vars
env:
version: ${{ inputs.version }}
run: |
./scripts/versions.sh | tee -a "${GITHUB_ENV}"
- name: Set up DotNet ${{ fromJson(inputs.version-set).dotnet }}
uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ fromJson(inputs.version-set).dotnet }}
- name: Build the .NET SDK package
run: |
cd sdk/dotnet
dotnet build --configuration Release dotnet.sln "/p:Version=${DOTNET_VERSION}"
- name: Pack the .NET SDK package
run: |
cd sdk/dotnet
dotnet pack --configuration Release --output nupkgs dotnet.sln "/p:Version=${DOTNET_VERSION}"
- name: Upload the NuGet packages
uses: actions/upload-artifact@v2
with:
name: artifacts-dotnet-sdk
path: sdk/dotnet/nupkgs/*.nupkg
retention-days: 1
if-no-files-found: error