Skip to content

Commit

Permalink
Regenerate workflows for pulumi-unifi
Browse files Browse the repository at this point in the history
  • Loading branch information
ringods committed Jan 28, 2025
1 parent a817da4 commit d65c239
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .github/actions/setup-tools/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ runs:
steps:
- name: Install Go
if: inputs.tools == 'all' || contains(inputs.tools, 'go')
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
with:
go-version: "1.22.x"
cache-dependency-path: |
Expand All @@ -47,7 +47,7 @@ runs:

- name: Install Pulumi CLI
if: inputs.tools == 'all' || contains(inputs.tools, 'pulumicli')
uses: pulumi/actions@c7fad9e2f0b79653172b36538b8b34b3c0291952 # v6
uses: pulumi/actions@13b8b7177d6fb736766875dac9b78aab07bd785f # v6
with:
pulumi-version: "dev"

Expand All @@ -59,7 +59,7 @@ runs:

- name: Setup Node
if: inputs.tools == 'all' || contains(inputs.tools, 'nodejs')
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
with:
node-version: 20.x
registry-url: https://registry.npmjs.org
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/upload-sdk/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ runs:
shell: bash
run: tar -zcf sdk/${{ inputs.language }}.tar.gz -C sdk/${{ inputs.language }} .
- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: ${{ inputs.language }}-sdk.tar.gz
path: ${{ github.workspace}}/sdk/${{ inputs.language }}.tar.gz
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/build_provider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
# Without ldid cross-compiling Node binaries on a Linux worker intended to work on darwin-arm64 fails to sign the
# binaries properly and they do not work as expected. See https://github.com/pulumi/pulumi-awsx/issues/1490
- uses: MOZGIII/install-ldid-action@v1
with:
tag: v2.1.5-procursus2
- name: Setup tools
uses: ./.github/actions/setup-tools
with:
Expand Down Expand Up @@ -66,7 +71,7 @@ jobs:
run: make provider_dist-${{ matrix.platform.os }}-${{ matrix.platform.arch }}

- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: pulumi-resource-unifi-v${{ inputs.version }}-${{ matrix.platform.os }}-${{ matrix.platform.arch }}.tar.gz
path: bin/pulumi-resource-unifi-v${{ inputs.version }}-${{ matrix.platform.os }}-${{ matrix.platform.arch }}.tar.gz
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/build_sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ jobs:
uses: ./.github/actions/download-codegen
- name: Update path
run: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH"
- name: Download schema-embed.json
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
# Use a pattern to avoid failing if the artifact doesn't exist
pattern: schema-embed.*
# Avoid creating directories for each artifact
merge-multiple: true
path: provider/cmd/pulumi-resource-unifi
- name: Restore makefile progress
run: make --touch provider schema
- name: Build SDK
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
with:
persist-credentials: false
- name: Install go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
with:
# The versions of golangci-lint and setup-go here cross-depend and need to update together.
go-version: 1.23
Expand All @@ -48,7 +48,7 @@ jobs:
continue-on-error: true
run: make prepare_local_workspace
- name: golangci-lint
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6
uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6
with:
version: v1.60
working-directory: provider
6 changes: 3 additions & 3 deletions .github/workflows/prerequisites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: pulumi/provider-version-action@0391d47b9b0d865d33dd0a295b1fcf9f7021dd4c # v1.5.3
- uses: pulumi/provider-version-action@f96d032a2758fdda7939e5728eff6c0d980ae894 # v1.6.0
id: provider-version
with:
set-env: 'PROVIDER_VERSION'
Expand Down Expand Up @@ -96,14 +96,14 @@ jobs:
Maintainer note: consult the [runbook](https://github.com/pulumi/platform-providers-team/blob/main/playbooks/tf-provider-updating.md) for dealing with any breaking changes.
- name: Upload codegen binary for unifi
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: pulumi-tfgen-unifi
path: ${{ github.workspace }}/bin/pulumi-tfgen-unifi
retention-days: 30

- name: Upload schema-embed.json
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: schema-embed.json
path: provider/cmd/pulumi-resource-unifi/schema-embed.json
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,6 @@ jobs:
with:
providerVersion: ${{ inputs.version }}
# Prelease is run often but we only have 5 concurrent macos runners, so we only test after the stable release.
enableMacosRunner: ${{ inputs.isPrerelease == false }}
enableMacRunner: ${{ inputs.isPrerelease == false }}
skipGoSdk: ${{ inputs.skipGoSdk }}
pythonVersion: ${{ needs.publish_sdk.outputs.python_version }}
4 changes: 3 additions & 1 deletion .github/workflows/verify-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ on:
description: "The version of the provider to verify"
required: true
type: string
enableMacosRunner:
enableMacRunner:
description: "Enable the macos-latest runner in addition to ubuntu-latest and windows-latest. Defaults to 'false'."
required: false
type: boolean
Expand Down Expand Up @@ -76,6 +76,8 @@ jobs:
runner: ["ubuntu-latest"]
runs-on: ${{ matrix.runner }}
steps:
- name: Configure Git to checkout files with long names
run: git config --global core.longpaths true
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand Down
48 changes: 25 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CODEGEN := pulumi-tfgen-$(PACK)
PROVIDER := pulumi-resource-$(PACK)
JAVA_GEN := pulumi-java-gen
TESTPARALLELISM := 10
GOTESTARGS := ""
WORKING_DIR := $(shell pwd)
PULUMI_PROVIDER_BUILD_PARALLELISM ?=
PULUMI_CONVERT := 1
Expand All @@ -18,7 +19,7 @@ PULUMICTL_VERSION := v0.0.46
PULUMICTL := $(shell which pulumictl || \
(test ! -e $(WORKING_DIR)/bin/pulumictl && \
GOPATH="$(WORKING_DIR)" go install "github.com/pulumi/pulumictl/cmd/pulumictl@$(PULUMICTL_VERSION)"; \
echo "$(WORKING_DIR)/bin/puluimctl"))
echo "$(WORKING_DIR)/bin/pulumictl"))

# Override during CI using `make [TARGET] PROVIDER_VERSION=""` or by setting a PROVIDER_VERSION environment variable
# Local & branch builds will just used this fixed default version unless specified
Expand Down Expand Up @@ -215,29 +216,30 @@ lint_provider: provider
lint_provider.fix:
cd provider && golangci-lint run --path-prefix provider -c ../.golangci.yml --fix
.PHONY: lint_provider lint_provider.fix
build_provider_cmd = cd provider && GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o "$(3)" -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)

provider: bin/$(PROVIDER)

# `make provider_no_deps` builds the provider binary directly, without ensuring that
# `cmd/pulumi-resource-unifi/schema.json` is valid and up to date.
# To create a release ready binary, you should use `make provider`.
build_provider_cmd = cd provider && CGO_ENABLED=0 go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o "$(1)" -ldflags "$(LDFLAGS)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)
provider: bin/$(PROVIDER)
provider_no_deps:
$(call build_provider_cmd,$(WORKING_DIR)/bin/$(PROVIDER))
$(call build_provider_cmd,$(shell go env GOOS),$(shell go env GOARCH),$(WORKING_DIR)/bin/$(PROVIDER))
bin/$(PROVIDER): .make/schema
$(call build_provider_cmd,$(WORKING_DIR)/bin/$(PROVIDER))
$(call build_provider_cmd,$(shell go env GOOS),$(shell go env GOARCH),$(WORKING_DIR)/bin/$(PROVIDER))
.PHONY: provider provider_no_deps

test: export PATH := $(WORKING_DIR)/bin:$(PATH)
test:
cd examples && go test -v -tags=all -parallel $(TESTPARALLELISM) -timeout 2h
cd examples && go test -v -tags=all -parallel $(TESTPARALLELISM) -timeout 2h $(value GOTESTARGS)
.PHONY: test

test_provider_cmd = cd provider && go test -v -short \
-coverprofile="coverage.txt" \
-coverpkg="./...,github.com/hashicorp/terraform-provider-..." \
-parallel $(TESTPARALLELISM) \
./...
test_provider:
cd provider && go test -v -short \
-coverprofile="coverage.txt" \
-coverpkg="./...,github.com/hashicorp/terraform-provider-..." \
-parallel $(TESTPARALLELISM) \
./...
$(call test_provider_cmd)
.PHONY: test_provider

tfgen: schema
Expand Down Expand Up @@ -316,18 +318,18 @@ SKIP_SIGNING ?=

# These targets assume that the schema-embed.json exists - it's generated by tfgen.
# We disable CGO to ensure that the binary is statically linked.
bin/linux-amd64/$(PROVIDER): export GOOS := linux
bin/linux-amd64/$(PROVIDER): export GOARCH := amd64
bin/linux-arm64/$(PROVIDER): export GOOS := linux
bin/linux-arm64/$(PROVIDER): export GOARCH := arm64
bin/darwin-amd64/$(PROVIDER): export GOOS := darwin
bin/darwin-amd64/$(PROVIDER): export GOARCH := amd64
bin/darwin-arm64/$(PROVIDER): export GOOS := darwin
bin/darwin-arm64/$(PROVIDER): export GOARCH := arm64
bin/windows-amd64/$(PROVIDER).exe: export GOOS := windows
bin/windows-amd64/$(PROVIDER).exe: export GOARCH := amd64
bin/linux-amd64/$(PROVIDER): GOOS := linux
bin/linux-amd64/$(PROVIDER): GOARCH := amd64
bin/linux-arm64/$(PROVIDER): GOOS := linux
bin/linux-arm64/$(PROVIDER): GOARCH := arm64
bin/darwin-amd64/$(PROVIDER): GOOS := darwin
bin/darwin-amd64/$(PROVIDER): GOARCH := amd64
bin/darwin-arm64/$(PROVIDER): GOOS := darwin
bin/darwin-arm64/$(PROVIDER): GOARCH := arm64
bin/windows-amd64/$(PROVIDER).exe: GOOS := windows
bin/windows-amd64/$(PROVIDER).exe: GOARCH := amd64
bin/%/$(PROVIDER) bin/%/$(PROVIDER).exe: bin/jsign-6.0.jar
$(call build_provider_cmd,$(WORKING_DIR)/$@)
$(call build_provider_cmd,$(GOOS),$(GOARCH),$(WORKING_DIR)/$@)

@# Only sign windows binary if fully configured.
@# Test variables set by joining with | between and looking for || showing at least one variable is empty.
Expand Down

0 comments on commit d65c239

Please sign in to comment.