Skip to content

Commit db03e78

Browse files
committed
Add gotools install action
Signed-off-by: Alexander Dahmen <[email protected]>
1 parent 0890559 commit db03e78

File tree

4 files changed

+53
-5
lines changed

4 files changed

+53
-5
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Install Go Tools
2+
description: "Install Go Tools for pipeline"
3+
inputs:
4+
go-version:
5+
description: "Go version to install"
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Install Go ${{ inputs.go-version }}
11+
uses: actions/setup-go@v5
12+
with:
13+
go-version: ${{ inputs.go-version }}
14+
- name: Install project tools and dependencies
15+
shell: bash
16+
run: make project-tools

.github/workflows/ci.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ jobs:
2626
- name: Unshallow clone for tags
2727
run: git fetch --prune --unshallow --tags
2828

29-
- name: Install Go ${{ env.GO_VERSION }}
30-
uses: actions/setup-go@v5
31-
with:
32-
go-version: ${{ env.GO_VERSION }}
33-
3429
- name: Install pulumictl
3530
uses: jaxxstorm/action-install-gh-release@6096f2a2bbfee498ced520b6922ac2c06e990ed2 # tag=v2.1.0
3631
with:
3732
repo: pulumi/pulumictl
3833

3934
- name: Install pulumi
4035
uses: pulumi/actions@v4
36+
37+
- name: Install Go Tools
38+
uses: ./.github/actions/gotools
39+
with:
40+
go-version: ${{ env.GO_VERSION }}
4141

4242
- name: Build sdks
4343
run: make build

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ NODE_MODULE_NAME := @pulumi/${PACK}
88
TF_NAME := ${PACK}
99
PROVIDER_PATH := provider
1010
VERSION_PATH := ${PROVIDER_PATH}/pkg/version.Version
11+
ROOT_DIR ?= $(shell git rev-parse --show-toplevel)
12+
SCRIPTS_BASE ?= $(ROOT_DIR)/scripts
1113

1214
JAVA_GEN := pulumi-java-gen
1315
JAVA_GEN_VERSION := v0.8.0
@@ -142,3 +144,10 @@ test::
142144

143145
fmt:
144146
@gofmt -s -w .
147+
148+
# SETUP AND TOOL INITIALIZATION TASKS
149+
project-help:
150+
@$(SCRIPTS_BASE)/project.sh help
151+
152+
project-tools:
153+
@$(SCRIPTS_BASE)/project.sh tools

scripts/project.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# This script is used to manage the project, only used for installing the required tools for now
4+
# Usage: ./project.sh [action]
5+
# * tools: Install required tools to run the project
6+
set -eo pipefail
7+
8+
ROOT_DIR_PROVIDER=$(git rev-parse --show-toplevel)/provider
9+
10+
action=$1
11+
12+
if [ "$action" = "help" ]; then
13+
[ -f "$0".man ] && man "$0".man || echo "No help, please read the script in ${script}, we will add help later"
14+
elif [ "$action" = "tools" ]; then
15+
cd ${ROOT_DIR_PROVIDER}
16+
17+
go mod download
18+
19+
go install github.com/golangci/golangci-lint/cmd/[email protected]
20+
go install github.com/hashicorp/terraform-plugin-docs/cmd/[email protected]
21+
else
22+
echo "Invalid action: '$action', please use $0 help for help"
23+
fi

0 commit comments

Comments
 (0)