diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..abd777ae --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,62 @@ +name: CI + +on: + pull_request: + branches: [main] + push: + branches: [main] + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + matrix: + module: + - provider + - sdk + - tests + 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 ${{ matrix.module }} + uses: golangci/golangci-lint-action@v6 + with: + version: v1.59 + working-directory: ${{ matrix.module }} + + provisioner: + 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 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 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 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) + } +}