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 the provisioner and CI jobs #3

Merged
merged 4 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
Empty file added .golangci.yml
Empty file.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
3 changes: 3 additions & 0 deletions provider/cmd/provisioner/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package main

func main() {}
27 changes: 11 additions & 16 deletions provider/cmd/pulumi-resource-baremetal/main.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -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)
}
}