From 216161e53de1effbc608e8150c8a6094a027db7e Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Fri, 26 Jul 2024 23:40:02 -0500 Subject: [PATCH 1/4] Update lint target --- .golangci.yml | 0 Makefile | 8 +++++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 00000000..e69de29b diff --git a/Makefile b/Makefile index 7d651752..898239d4 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,8 @@ provider_debug:: test_provider:: cd tests && go test -short -v -count=1 -cover -timeout 2h -parallel ${TESTPARALLELISM} ./... +provisioner:: bin/provisioner + dotnet_sdk:: DOTNET_VERSION := $(shell pulumictl get version --language dotnet) dotnet_sdk:: rm -rf sdk/dotnet @@ -116,7 +118,7 @@ only_build:: build lint:: for DIR in "provider" "sdk" "tests" ; do \ - pushd $$DIR && golangci-lint run -c ../.golangci.yml --timeout 10m && popd ; \ + pushd $$DIR && golangci-lint run -c ../.golangci.yml --timeout 10m; popd ; \ done install:: install_nodejs_sdk install_dotnet_sdk @@ -144,3 +146,7 @@ install_go_sdk:: install_nodejs_sdk:: -yarn unlink --cwd $(WORKING_DIR)/sdk/nodejs/bin yarn link --cwd $(WORKING_DIR)/sdk/nodejs/bin + +# ------- Real Targets ------- +bin/provisioner:: + cd provider && go build -o $@ $(PROJECT)/${PROVIDER_PATH}/cmd/provisioner From 913fce20253ec0fccdc9bd417c45546bb7d84015 Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Fri, 26 Jul 2024 23:50:45 -0500 Subject: [PATCH 2/4] Make the provisioner --- .github/workflows/ci.yml | 23 ++++++++++++++++ provider/cmd/provisioner/main.go | 3 +++ .../cmd/pulumi-resource-baremetal/main.go | 27 ++++++++----------- 3 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 provider/cmd/provisioner/main.go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..68c3e505 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,23 @@ +name: CI + +on: + pull_request: + branches: [main] + push: + branches: [main] + +jobs: + provisioner: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: provider/go.mod + cache-dependency-path: provider/go.sum + + - name: Make + run: make provisioner diff --git a/provider/cmd/provisioner/main.go b/provider/cmd/provisioner/main.go new file mode 100644 index 00000000..38dd16da --- /dev/null +++ b/provider/cmd/provisioner/main.go @@ -0,0 +1,3 @@ +package main + +func main() {} diff --git a/provider/cmd/pulumi-resource-baremetal/main.go b/provider/cmd/pulumi-resource-baremetal/main.go index 7d6358b1..4e14eb29 100644 --- a/provider/cmd/pulumi-resource-baremetal/main.go +++ b/provider/cmd/pulumi-resource-baremetal/main.go @@ -1,17 +1,3 @@ -// Copyright 2016-2023, Pulumi Corporation. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package main import ( @@ -20,5 +6,14 @@ import ( baremetal "github.com/unmango/pulumi-baremetal/provider" ) -// Serve the provider against Pulumi's Provider protocol. -func main() { p.RunProvider(baremetal.Name, baremetal.Version, baremetal.Provider()) } +func main() { + err := p.RunProvider( + baremetal.Name, + baremetal.Version, + baremetal.Provider(), + ) + + if err != nil { + panic(err) + } +} From 44d9aa521cb56aaca9150567a1fc38e9a719e688 Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Sat, 27 Jul 2024 00:02:06 -0500 Subject: [PATCH 3/4] More jobs --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68c3e505..332a3c60 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,11 +7,28 @@ on: branches: [main] jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: provider/go.mod + cache-dependency-path: provider/go.sum + + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.59 + provisioner: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Go uses: actions/setup-go@v5 @@ -21,3 +38,18 @@ jobs: - name: Make run: make provisioner + + provider: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: provider/go.mod + cache-dependency-path: provider/go.sum + + - name: Make + run: make provider From 61246d20e3385549b56ba1bddefef79a5ac9eceb Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Sat, 27 Jul 2024 00:07:11 -0500 Subject: [PATCH 4/4] More fix --- .github/workflows/ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 332a3c60..abd777ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,12 @@ on: jobs: lint: runs-on: ubuntu-latest + strategy: + matrix: + module: + - provider + - sdk + - tests steps: - name: Checkout uses: actions/checkout@v4 @@ -19,10 +25,11 @@ jobs: go-version-file: provider/go.mod cache-dependency-path: provider/go.sum - - name: golangci-lint + - name: golangci-lint ${{ matrix.module }} uses: golangci/golangci-lint-action@v6 with: version: v1.59 + working-directory: ${{ matrix.module }} provisioner: runs-on: ubuntu-latest