Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add split Go SDK #1934

Merged
merged 19 commits into from Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/build.yml
Expand Up @@ -230,6 +230,15 @@ jobs:
with:
name: ${{ matrix.language }}-sdk.tar.gz
path: ${{ github.workspace}}/sdk/${{ matrix.language }}.tar.gz
- name: Tar split Go SDK folder
if: ${{ matrix.language == 'go' }}
run: tar -zcf sdk/pulumi-azure-native-sdk.tar.gz -C sdk/pulumi-azure-native-sdk .
- name: Upload split Go artifacts
uses: actions/upload-artifact@v2
if: ${{ matrix.language == 'go' }}
with:
name: pulumi-azure-native-sdk.tar.gz
path: ${{ github.workspace}}/sdk/pulumi-azure-native-sdk.tar.gz
- if: failure() && github.event_name == 'push'
name: Notify Slack
uses: 8398a7/action-slack@v3
Expand Down Expand Up @@ -321,6 +330,17 @@ jobs:
- name: UnTar SDK folder
run: tar -zxf ${{ github.workspace}}/sdk/${{ matrix.language}}.tar.gz -C ${{
github.workspace}}/sdk/${{ matrix.language}}
- name: Download Go split SDK
uses: actions/download-artifact@v2
if: ${{ matrix.language == 'go' }}
with:
name: pulumi-azure-native-sdk.tar.gz
path: ${{ github.workspace}}/sdk/
- name: UnTar Go split SDK folder
if: ${{ matrix.language == 'go' }}
run: |
mkdir -p ${{github.workspace}}/sdk/pulumi-azure-native-sdk
tar -zxf ${{ github.workspace}}/sdk/pulumi-azure-native-sdk.tar.gz -C ${{github.workspace}}/sdk/pulumi-azure-native-sdk
- name: Update path
run: echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Install Node dependencies
Expand Down Expand Up @@ -504,6 +524,39 @@ jobs:
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
build-root-directory: ./sdk/java
gradle-version: 7.4.1
- name: Checkout Go SDK repo
uses: actions/checkout@v2
with:
token: ${{ secrets.PULUMI_BOT_TOKEN }}
repository: pulumi/pulumi-azure-native-sdk
path: sdk/pulumi-azure-native-sdk
fetch-depth: 0
- name: Prepare Go SDK repo
run: |
cd sdk/pulumi-azure-native-sdk
find . -maxdepth 1 -not -name '.*' -exec rm -rf {} \;
- name: Download Go split SDK
uses: actions/download-artifact@v2
with:
name: pulumi-azure-native-sdk.tar.gz
path: ${{ github.workspace}}/sdk/
- name: UnTar Go split SDK folder
run: |
mkdir -p ${{github.workspace}}/sdk/pulumi-azure-native-sdk
tar -zxf ${{ github.workspace}}/sdk/pulumi-azure-native-sdk.tar.gz -C ${{github.workspace}}/sdk/pulumi-azure-native-sdk
- name: Publish Split Go SDK
run: |
make prepublish_go
cd sdk/pulumi-azure-native-sdk
VERSION="$(cat version.txt)"
git config user.name "Pulumi Bot"
git config user.email "bot@pulumi.com"
git add .
git commit -m "$VERSION"
git tag "$VERSION"
# Find go.mod's, get parent dir name, concat with version, set as a tag
find */go.mod -type f -exec sh -c "dirname {} | xargs basename | xargs printf "%s/$VERSION" | xargs git tag" \;
git push --tags
- if: failure() && github.event_name == 'push'
name: Notify Slack
uses: 8398a7/action-slack@v3
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/prerelease.yml
Expand Up @@ -221,6 +221,15 @@ jobs:
with:
name: ${{ matrix.language }}-sdk.tar.gz
path: ${{ github.workspace}}/sdk/${{ matrix.language }}.tar.gz
- name: Tar split Go SDK folder
if: ${{ matrix.language == 'go' }}
run: tar -zcf sdk/pulumi-azure-native-sdk.tar.gz -C sdk/pulumi-azure-native-sdk .
- name: Upload split Go artifacts
uses: actions/upload-artifact@v2
if: ${{ matrix.language == 'go' }}
with:
name: pulumi-azure-native-sdk.tar.gz
path: ${{ github.workspace}}/sdk/pulumi-azure-native-sdk.tar.gz
- if: failure() && github.event_name == 'push'
name: Notify Slack
uses: 8398a7/action-slack@v3
Expand Down Expand Up @@ -312,6 +321,17 @@ jobs:
- name: UnTar SDK folder
run: tar -zxf ${{ github.workspace}}/sdk/${{ matrix.language}}.tar.gz -C ${{
github.workspace}}/sdk/${{ matrix.language}}
- name: Download Go split SDK
uses: actions/download-artifact@v2
if: ${{ matrix.language == 'go' }}
with:
name: pulumi-azure-native-sdk.tar.gz
path: ${{ github.workspace}}/sdk/
- name: UnTar Go split SDK folder
if: ${{ matrix.language == 'go' }}
run: |
mkdir -p ${{github.workspace}}/sdk/pulumi-azure-native-sdk
tar -zxf ${{ github.workspace}}/sdk/pulumi-azure-native-sdk.tar.gz -C ${{github.workspace}}/sdk/pulumi-azure-native-sdk
- name: Update path
run: echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Install Node dependencies
Expand Down Expand Up @@ -495,6 +515,40 @@ jobs:
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
build-root-directory: ./sdk/java
gradle-version: 7.4.1
- name: Checkout Go SDK repo
uses: actions/checkout@v2
with:
token: ${{ secrets.PULUMI_BOT_TOKEN }}
repository: pulumi/pulumi-azure-native-sdk
path: sdk/pulumi-azure-native-sdk
fetch-depth: 0
- name: Prepare Go SDK repo
run: |
cd sdk/pulumi-azure-native-sdk
git checkout master
find . -maxdepth 1 -not -name '.*' -exec rm -rf {} \;
- name: Download Go split SDK
uses: actions/download-artifact@v2
with:
name: pulumi-azure-native-sdk.tar.gz
path: ${{ github.workspace}}/sdk/
- name: UnTar Go split SDK folder
run: |
mkdir -p ${{github.workspace}}/sdk/pulumi-azure-native-sdk
tar -zxf ${{ github.workspace}}/sdk/pulumi-azure-native-sdk.tar.gz -C ${{github.workspace}}/sdk/pulumi-azure-native-sdk
- name: Publish Split Go SDK
run: |
make prepublish_go
cd sdk/pulumi-azure-native-sdk
VERSION="$(cat version.txt)"
git config user.name "Pulumi Bot"
git config user.email "bot@pulumi.com"
git add .
git commit -m "$VERSION"
git tag "$VERSION"
# Find go.mod's, get parent dir name, concat with version, set as a tag
find */go.mod -type f -exec sh -c "dirname {} | xargs basename | xargs printf "%s/$VERSION" | xargs git tag" \;
git push --tags
- if: failure() && github.event_name == 'push'
name: Notify Slack
uses: 8398a7/action-slack@v3
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Expand Up @@ -222,6 +222,15 @@ jobs:
with:
name: ${{ matrix.language }}-sdk.tar.gz
path: ${{ github.workspace}}/sdk/${{ matrix.language }}.tar.gz
- name: Tar split Go SDK folder
if: ${{ matrix.language == 'go' }}
run: tar -zcf sdk/pulumi-azure-native-sdk.tar.gz -C sdk/pulumi-azure-native-sdk .
- name: Upload split Go artifacts
uses: actions/upload-artifact@v2
if: ${{ matrix.language == 'go' }}
with:
name: pulumi-azure-native-sdk.tar.gz
path: ${{ github.workspace}}/sdk/pulumi-azure-native-sdk.tar.gz
- if: failure() && github.event_name == 'push'
name: Notify Slack
uses: 8398a7/action-slack@v3
Expand Down Expand Up @@ -313,6 +322,17 @@ jobs:
- name: UnTar SDK folder
run: tar -zxf ${{ github.workspace}}/sdk/${{ matrix.language}}.tar.gz -C ${{
github.workspace}}/sdk/${{ matrix.language}}
- name: Download Go split SDK
uses: actions/download-artifact@v2
if: ${{ matrix.language == 'go' }}
with:
name: pulumi-azure-native-sdk.tar.gz
path: ${{ github.workspace}}/sdk/
- name: UnTar Go split SDK folder
if: ${{ matrix.language == 'go' }}
run: |
mkdir -p ${{github.workspace}}/sdk/pulumi-azure-native-sdk
tar -zxf ${{ github.workspace}}/sdk/pulumi-azure-native-sdk.tar.gz -C ${{github.workspace}}/sdk/pulumi-azure-native-sdk
- name: Update path
run: echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Install Node dependencies
Expand Down Expand Up @@ -502,6 +522,40 @@ jobs:
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
build-root-directory: ./sdk/java
gradle-version: 7.4.1
- name: Checkout Go SDK repo
uses: actions/checkout@v2
with:
token: ${{ secrets.PULUMI_BOT_TOKEN }}
repository: pulumi/pulumi-azure-native-sdk
path: sdk/pulumi-azure-native-sdk
fetch-depth: 0
- name: Prepare Go SDK repo
run: |
cd sdk/pulumi-azure-native-sdk
git checkout master
find . -maxdepth 1 -not -name '.*' -exec rm -rf {} \;
- name: Download Go split SDK
uses: actions/download-artifact@v2
with:
name: pulumi-azure-native-sdk.tar.gz
path: ${{ github.workspace}}/sdk/
- name: UnTar Go split SDK folder
run: |
mkdir -p ${{github.workspace}}/sdk/pulumi-azure-native-sdk
tar -zxf ${{ github.workspace}}/sdk/pulumi-azure-native-sdk.tar.gz -C ${{github.workspace}}/sdk/pulumi-azure-native-sdk
- name: Publish Split Go SDK
run: |
make prepublish_go
cd sdk/pulumi-azure-native-sdk
VERSION="$(cat version.txt)"
git config user.name "Pulumi Bot"
git config user.email "bot@pulumi.com"
git add .
git commit -m "$VERSION"
git tag "$VERSION"
# Find go.mod's, get parent dir name, concat with version, set as a tag
find */go.mod -type f -exec sh -c "dirname {} | xargs basename | xargs printf "%s/$VERSION" | xargs git tag" \;
git push --tags
- if: failure() && github.event_name == 'push'
name: Notify Slack
uses: 8398a7/action-slack@v3
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/run-acceptance-tests.yml
Expand Up @@ -251,6 +251,15 @@ jobs:
with:
name: ${{ matrix.language }}-sdk.tar.gz
path: ${{ github.workspace}}/sdk/${{ matrix.language }}.tar.gz
- name: Tar split Go SDK folder
if: ${{ matrix.language == 'go' }}
run: tar -zcf sdk/pulumi-azure-native-sdk.tar.gz -C sdk/pulumi-azure-native-sdk .
- name: Upload split Go artifacts
uses: actions/upload-artifact@v2
if: ${{ matrix.language == 'go' }}
with:
name: pulumi-azure-native-sdk.tar.gz
path: ${{ github.workspace}}/sdk/pulumi-azure-native-sdk.tar.gz
- if: failure() && github.event_name == 'push'
name: Notify Slack
uses: 8398a7/action-slack@v3
Expand Down Expand Up @@ -345,6 +354,17 @@ jobs:
- name: UnTar SDK folder
run: tar -zxf ${{ github.workspace}}/sdk/${{ matrix.language}}.tar.gz -C ${{
github.workspace}}/sdk/${{ matrix.language}}
- name: Download Go split SDK
uses: actions/download-artifact@v2
if: ${{ matrix.language == 'go' }}
with:
name: pulumi-azure-native-sdk.tar.gz
path: ${{ github.workspace}}/sdk/
- name: UnTar Go split SDK folder
if: ${{ matrix.language == 'go' }}
run: |
mkdir -p ${{github.workspace}}/sdk/pulumi-azure-native-sdk
tar -zxf ${{ github.workspace}}/sdk/pulumi-azure-native-sdk.tar.gz -C ${{github.workspace}}/sdk/pulumi-azure-native-sdk
- name: Update path
run: echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Install Node dependencies
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -31,3 +31,4 @@ sdk/java/.gradle
sdk/java/gradle
sdk/java/gradlew
sdk/java/gradlew.bat
pulumi-azure-native-sdk
15 changes: 12 additions & 3 deletions Makefile
Expand Up @@ -41,7 +41,7 @@ ensure:: init_submodules


local_generate_code:: clean bin/pulumi-java-gen
$(WORKING_DIR)/bin/$(CODEGEN) schema,nodejs,dotnet,python,go $(VERSION)
$(WORKING_DIR)/bin/$(CODEGEN) schema,nodejs,dotnet,python,go,go-split $(VERSION)
$(WORKING_DIR)/bin/$(JAVA_GEN) generate --schema $(WORKING_DIR)/provider/cmd/$(PROVIDER)/schema.json --out sdk/java --build gradle-nexus
cd ${PACKDIR}/go/ && find . -type f -exec sed -i '' -e '/^\/\/.*/g' {} \;
cd ${PACKDIR}/dotnet/ && \
Expand All @@ -53,7 +53,7 @@ local_generate_code:: clean bin/pulumi-java-gen
echo "Finished generating."

local_generate:: clean bin/pulumi-java-gen
$(WORKING_DIR)/bin/$(CODEGEN) schema,docs,nodejs,dotnet,python,go $(VERSION)
$(WORKING_DIR)/bin/$(CODEGEN) schema,docs,nodejs,dotnet,python,go,go-split $(VERSION)
$(WORKING_DIR)/bin/$(JAVA_GEN) generate --schema $(WORKING_DIR)/provider/cmd/$(PROVIDER)/schema.json --out sdk/java --build gradle-nexus
cd ${PACKDIR}/go/ && find . -type f -exec sed -i '' -e '/^\/\/.*/g' {} \;
cd ${PACKDIR}/dotnet/ && \
Expand Down Expand Up @@ -190,13 +190,22 @@ bin/pulumi-java-gen::
$(shell pulumictl download-binary -n pulumi-language-java -v $(JAVA_GEN_VERSION) -r pulumi/pulumi-java)

generate_go::
$(WORKING_DIR)/bin/$(CODEGEN) go $(VERSION)
$(WORKING_DIR)/bin/$(CODEGEN) go,go-split $(VERSION)

cd ${PACKDIR}/go/ && find . -type f -exec sed -i '' -e '/^\/\/.*/g' {} \;

build_go::
# Only building the top level packages and building 1 package at a time to avoid OOMing
cd sdk/ && \
GOGC=50 go list github.com/pulumi/pulumi-azure-native/sdk/go/azure/... | grep -v "latest\|\/v.*"$ | xargs -L 1 go build
find sdk/pulumi-azure-native-sdk -type d -maxdepth 1 -exec sh -c "cd \"{}\" && go mod tidy && go build" \;
danielrbradley marked this conversation as resolved.
Show resolved Hide resolved

prepublish_go:
@# must use `sed -i -e` to be portable - but leaves go.mod-e behind on macos
find sdk/pulumi-azure-native-sdk -maxdepth 2 -type f -name go.mod -exec sed -i -e '/replace github\.com\/pulumi\/pulumi-azure-native-sdk /d' {} \;
find sdk/pulumi-azure-native-sdk -maxdepth 2 -type f -name go.mod-e -delete
find sdk/pulumi-azure-native-sdk -maxdepth 2 -type f -name go.sum -delete
danielrbradley marked this conversation as resolved.
Show resolved Hide resolved
cp README.md LICENSE sdk/pulumi-azure-native-sdk/

clean::
rm -rf $$(find sdk/nodejs -mindepth 1 -maxdepth 1 ! -name "go.mod")
Expand Down