215 lines
7 KiB
YAML
215 lines
7 KiB
YAML
name: Builds CLI and SDK binaries.
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
go-version:
|
|
description: 'Version of the Go toolchain for the build'
|
|
default: '1.17.x'
|
|
required: false
|
|
type: string
|
|
python-version:
|
|
description: 'Version of the Python toolchain for the build'
|
|
default: '3.9.x'
|
|
required: false
|
|
type: string
|
|
node-version:
|
|
description: 'Version of the Node toolchain for the build'
|
|
default: '14.x'
|
|
required: false
|
|
type: string
|
|
dotnet-version:
|
|
description: 'Version of the .NET toolchain for the build'
|
|
default: '3.1.x'
|
|
required: false
|
|
type: string
|
|
goreleaser-flags:
|
|
description: 'Command-line flags to pass to goreleaser'
|
|
default: '-p 3 -f .goreleaser.build.yml --snapshot --skip-validate'
|
|
required: false
|
|
type: string
|
|
secrets: {}
|
|
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
jobs:
|
|
build_pulumi_go_binaries:
|
|
name: Build Pulumi Go binaries
|
|
|
|
# Due to the use of CGO in `pulumi` this cross-compilation step
|
|
# cannot proceed on `ubuntu-latest`, which would have been
|
|
# preferable.
|
|
# runs-on: macos-latest
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ env.PR_COMMIT_SHA }}
|
|
- name: Fetch Tags
|
|
run: |
|
|
git fetch --quiet --prune --unshallow --tags
|
|
- name: Install pulumictl
|
|
uses: jaxxstorm/action-install-gh-release@v1.2.0
|
|
with:
|
|
repo: pulumi/pulumictl
|
|
- name: Set up Go ${{ inputs.go-version }}
|
|
uses: actions/setup-go@v1
|
|
with:
|
|
go-version: ${{ inputs.go-version }}
|
|
- name: Compute current version to inform GoReleaser
|
|
run: |
|
|
echo "GORELEASER_CURRENT_TAG=v$(pulumictl get version --language generic -o)" >> $GITHUB_ENV
|
|
- name: Run GoReleaser to build Go Pulumi binaries
|
|
uses: goreleaser/goreleaser-action@v2
|
|
with:
|
|
version: latest
|
|
args: ${{ inputs.goreleaser-flags }}
|
|
- name: Upload pulumi-darwin-arm64.tar.gz
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: pulumi-darwin-arm64.tar.gz
|
|
path: goreleaser/pulumi*-darwin-arm64.tar.gz
|
|
- name: Upload pulumi-darwin-x64.tar.gz
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: pulumi-darwin-x64.tar.gz
|
|
path: goreleaser/pulumi*-darwin-x64.tar.gz
|
|
- name: Upload pulumi-linux-arm64.tar.gz
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: pulumi-linux-arm64.tar.gz
|
|
path: goreleaser/pulumi*-linux-arm64.tar.gz
|
|
- name: Upload pulumi-linux-x64.tar.gz
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: pulumi-linux-x64.tar.gz
|
|
path: goreleaser/pulumi*-linux-x64.tar.gz
|
|
- name: Upload pulumi-windows-x64.zip
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: pulumi-windows-x64.zip
|
|
path: goreleaser/pulumi*-windows-x64.zip
|
|
|
|
build_python_sdk:
|
|
name: Build Pulumi Python SDK wheel
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ env.PR_COMMIT_SHA }}
|
|
- name: Fetch Tags
|
|
run: |
|
|
git fetch --quiet --prune --unshallow --tags
|
|
- name: Install pulumictl
|
|
uses: jaxxstorm/action-install-gh-release@v1.2.0
|
|
with:
|
|
repo: pulumi/pulumictl
|
|
- name: Set up Python ${{ inputs.python-version }}
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: ${{ inputs.python-version }}
|
|
- name: Compute current version to inform wheel build
|
|
run: |
|
|
echo "PYPY_VERSION=$(pulumictl get version --language python)" >> $GITHUB_ENV
|
|
- 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}/$PYPY_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: pulumi.whl
|
|
path: sdk/python/lib/dist/*.whl
|
|
|
|
build_node_sdk:
|
|
name: Build Pulumi Node SDK tarball
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ env.PR_COMMIT_SHA }}
|
|
- name: Fetch Tags
|
|
run: |
|
|
git fetch --quiet --prune --unshallow --tags
|
|
- name: Install pulumictl
|
|
uses: jaxxstorm/action-install-gh-release@v1.2.0
|
|
with:
|
|
repo: pulumi/pulumictl
|
|
- name: Set up Node ${{ inputs.node-version }}
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: ${{ inputs.node-version }}
|
|
- name: Install yarn
|
|
run: |
|
|
npm install -g yarn
|
|
- name: Make no-op Go command to avoid Go builds
|
|
run: |
|
|
cd sdk/nodejs
|
|
mkdir -p bin
|
|
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: pulumi-node-sdk.tgz
|
|
path: sdk/nodejs/bin/*.tgz
|
|
|
|
build_dotnet_sdk:
|
|
name: Build Pulumi .NET SDK NuGet packages
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ env.PR_COMMIT_SHA }}
|
|
- name: Fetch Tags
|
|
run: |
|
|
git fetch --quiet --prune --unshallow --tags
|
|
- name: Install pulumictl
|
|
uses: jaxxstorm/action-install-gh-release@v1.2.0
|
|
with:
|
|
repo: pulumi/pulumictl
|
|
- name: Set up DotNet ${{ inputs.dotnet-version }}
|
|
uses: actions/setup-dotnet@v1
|
|
with:
|
|
dotnet-version: ${{ inputs.dotnet-version }}
|
|
- name: Compute current version to inform the NuGet package build
|
|
run: |
|
|
echo "DOTNET_VERSION=$(pulumictl get version --language dotnet)" >> $GITHUB_ENV
|
|
- 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: pulumi-nuget-packages
|
|
path: sdk/dotnet/nupkgs/*.nupkg
|