pulumi/.github/workflows/ci-build-sdks.yml

77 lines
2.1 KiB
YAML

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 = .*/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