Skip to content

Commit 926bfe6

Browse files
authored
Merge pull request #37765 from hashicorp/d-makefile-cheat-sheet
docs: Makefile cheat sheet
2 parents 39adfb7 + 2c14af8 commit 926bfe6

23 files changed

+326
-25
lines changed

.github/workflows/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# GitHub Workflows
22

3+
## This README Is Out-of-Date
4+
5+
This README is not maintained. Instead, refer to the Contributor Guide:
6+
7+
* [Continuous integration](https://hashicorp.github.io/terraform-provider-aws/continuous-integration/)
8+
* [Makefile cheat sheet](https://hashicorp.github.io/terraform-provider-aws/makefile-cheat-sheet/)
9+
310
## Using the `setup-terraform` action
411

512
By default, the [`setup-terraform` action](https://github.com/hashicorp/setup-terraform) adds a wrapper for the `terraform` command that allows passing results to subsequent steps. This will prevent using the output of a `terraform` command as the input to another command in the same step.

.github/workflows/acctest-terraform-lint.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ on:
1313
- go.sum
1414
- 'internal/service/**/*_test.go'
1515

16+
## NOTE: !!!
17+
## When changing these workflows, ensure that the following is updated:
18+
## - Documentation: docs/continuous-integration.md
19+
## - Documentation: docs/makefile-cheat-sheet.md
20+
## - Makefile: ./GNUmakefile
21+
1622
jobs:
1723
terrafmt:
1824
runs-on: ubuntu-latest

.github/workflows/changelog.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ on:
66
- 'release/**'
77
pull_request_target:
88

9+
## NOTE: !!!
10+
## When changing these workflows, ensure that the following is updated:
11+
## - Documentation: docs/continuous-integration.md
12+
## - Documentation: docs/makefile-cheat-sheet.md
13+
## - Makefile: ./GNUmakefile
14+
915
jobs:
1016
community_check:
1117
if: github.event_name == 'pull_request_target'

.github/workflows/changelog_misspell.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ on:
1010
- go.sum
1111
- CHANGELOG.md
1212

13+
## NOTE: !!!
14+
## When changing these workflows, ensure that the following is updated:
15+
## - Documentation: docs/continuous-integration.md
16+
## - Documentation: docs/makefile-cheat-sheet.md
17+
## - Makefile: ./GNUmakefile
18+
1319
jobs:
1420
misspell:
1521
runs-on: ubuntu-latest

.github/workflows/community-check.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ on:
1919
description: Whether or not the user is a partner
2020
value: ${{ jobs.community_check.outputs.is_partner }}
2121

22+
## NOTE: !!!
23+
## When changing these workflows, ensure that the following is updated:
24+
## - Documentation: docs/continuous-integration.md
25+
## - Documentation: docs/makefile-cheat-sheet.md
26+
## - Makefile: ./GNUmakefile
27+
2228
jobs:
2329
community_check:
2430
name: Check community lists for username

.github/workflows/copyright.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ on:
1414
- infrastructure/repository/labels-service.tf
1515
- .goreleaser.yml
1616

17+
## NOTE: !!!
18+
## When changing these workflows, ensure that the following is updated:
19+
## - Documentation: docs/continuous-integration.md
20+
## - Documentation: docs/makefile-cheat-sheet.md
21+
## - Makefile: ./GNUmakefile
22+
1723
jobs:
1824
copywrite:
1925
name: add headers check

.github/workflows/dependencies.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
- 'release/**'
88
pull_request_target:
99

10+
## NOTE: !!!
11+
## When changing these workflows, ensure that the following is updated:
12+
## - Documentation: docs/continuous-integration.md
13+
## - Documentation: docs/makefile-cheat-sheet.md
14+
## - Makefile: ./GNUmakefile
15+
1016
jobs:
1117
community_check:
1218
if: github.event_name == 'pull_request_target'

.github/workflows/documentation.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ on:
1111
- docs/**
1212
- go.mod
1313

14+
## NOTE: !!!
15+
## When changing these workflows, ensure that the following is updated:
16+
## - Documentation: docs/continuous-integration.md
17+
## - Documentation: docs/makefile-cheat-sheet.md
18+
## - Makefile: ./GNUmakefile
19+
1420
jobs:
1521
markdown-link-check:
1622
runs-on: ubuntu-latest

.github/workflows/examples.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ on:
1111
- examples/**
1212
- go.mod
1313

14+
## NOTE: !!!
15+
## When changing these workflows, ensure that the following is updated:
16+
## - Documentation: docs/continuous-integration.md
17+
## - Documentation: docs/makefile-cheat-sheet.md
18+
## - Makefile: ./GNUmakefile
19+
1420
env:
1521
AWS_DEFAULT_REGION: us-west-2
1622

.github/workflows/golangci-lint.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ on:
1616
- names/**
1717
- tools/**
1818

19+
## NOTE: !!!
20+
## When changing these workflows, ensure that the following is updated:
21+
## - Documentation: docs/continuous-integration.md
22+
## - Documentation: docs/makefile-cheat-sheet.md
23+
## - Makefile: ./GNUmakefile
24+
1925
jobs:
2026
golangci-linta:
2127
name: 1 of 2

.github/workflows/library_versions.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ on:
1313
branches:
1414
- main
1515

16+
## NOTE: !!!
17+
## When changing these workflows, ensure that the following is updated:
18+
## - Documentation: docs/continuous-integration.md
19+
## - Documentation: docs/makefile-cheat-sheet.md
20+
## - Makefile: ./GNUmakefile
21+
1622
jobs:
1723
diffgrep:
1824
runs-on: ubuntu-latest

.github/workflows/provider.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ on:
2222
- names/**
2323
- website/**
2424

25+
## NOTE: !!!
26+
## When changing these workflows, ensure that the following is updated:
27+
## - Documentation: docs/continuous-integration.md
28+
## - Documentation: docs/makefile-cheat-sheet.md
29+
## - Makefile: ./GNUmakefile
30+
2531
env:
2632
AWS_DEFAULT_REGION: us-west-2
2733
TERRAFORM_VERSION: "1.8.3"

.github/workflows/providerlint.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ on:
1313
- internal/**
1414
- names/**
1515

16+
## NOTE: !!!
17+
## When changing these workflows, ensure that the following is updated:
18+
## - Documentation: docs/continuous-integration.md
19+
## - Documentation: docs/makefile-cheat-sheet.md
20+
## - Makefile: ./GNUmakefile
21+
1622
jobs:
1723
providerlint:
1824
runs-on: custom-linux-medium

.github/workflows/semgrep-ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ on:
1111
- .semgrep*yml
1212
- .github/workflows/semgrep-ci.yml
1313

14+
## NOTE: !!!
15+
## When changing these workflows, ensure that the following is updated:
16+
## - Documentation: docs/continuous-integration.md
17+
## - Documentation: docs/makefile-cheat-sheet.md
18+
## - Makefile: ./GNUmakefile
19+
1420
env:
1521
SEMGREP_SEND_METRICS: "off"
1622
SEMGREP_ENABLE_VERSION_CHECK: false

.github/workflows/skaff.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ on:
1010
- names/**
1111
- skaff/**
1212

13+
## NOTE: !!!
14+
## When changing these workflows, ensure that the following is updated:
15+
## - Documentation: docs/continuous-integration.md
16+
## - Documentation: docs/makefile-cheat-sheet.md
17+
## - Makefile: ./GNUmakefile
18+
1319
jobs:
1420
compile_skaff:
1521
name: Compile skaff

.github/workflows/website.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ on:
1616
- .markdownlint.yml
1717
- website/docs/**
1818

19+
## NOTE: !!!
20+
## When changing these workflows, ensure that the following is updated:
21+
## - Documentation: docs/continuous-integration.md
22+
## - Documentation: docs/makefile-cheat-sheet.md
23+
## - Makefile: ./GNUmakefile
24+
1925
jobs:
2026
markdown-link-check-a-h-markdown:
2127
runs-on: ubuntu-latest

.github/workflows/workflow-lint.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ on:
88
paths:
99
- .github/workflows/*
1010
- .ci/tools/go.mod
11+
12+
## NOTE: !!!
13+
## When changing these workflows, ensure that the following is updated:
14+
## - Documentation: docs/continuous-integration.md
15+
## - Documentation: docs/makefile-cheat-sheet.md
16+
## - Makefile: ./GNUmakefile
17+
1118
jobs:
1219
actionlint:
1320
runs-on: ubuntu-latest

.github/workflows/yamllint.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ on:
99
- "**/*.yml"
1010
- "**/*.yaml"
1111
- ".yamllint"
12+
13+
## NOTE: !!!
14+
## When changing these workflows, ensure that the following is updated:
15+
## - Documentation: docs/continuous-integration.md
16+
## - Documentation: docs/makefile-cheat-sheet.md
17+
## - Makefile: ./GNUmakefile
18+
1219
jobs:
1320
yamllint:
1421
runs-on: ubuntu-latest

.markdownlint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ no-hard-tabs:
1818
no-inline-html:
1919
allowed_elements:
2020
- br
21+
- sup
2122

2223
# Disabled Rules
2324
# https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md

GNUmakefile

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
SHELL := /bin/bash
22

3-
SWEEP ?= us-west-2,us-east-1,us-east-2,us-west-1
4-
TEST ?= ./...
5-
SWEEP_DIR ?= ./internal/sweep
6-
PKG_NAME ?= internal
7-
SVC_DIR ?= ./internal/service
8-
TEST_COUNT ?= 1
9-
ACCTEST_TIMEOUT ?= 360m
103
ACCTEST_PARALLELISM ?= 20
11-
P ?= 20
4+
ACCTEST_TIMEOUT ?= 360m
5+
BASE_REF ?= main
126
GO_VER ?= $(shell echo go`cat .go-version | xargs`)
13-
SWEEP_TIMEOUT ?= 360m
7+
P ?= 20
8+
PKG_NAME ?= internal
149
SEMGREP_ARGS ?= --error
15-
SEMGREP_SEND_METRICS ?= off
1610
SEMGREP_ENABLE_VERSION_CHECK ?= false
11+
SEMGREP_SEND_METRICS ?= off
1712
SEMGREP_TIMEOUT ?= 900 # 15 minutes, some runs go over 5 minutes
18-
BASE_REF ?= main
13+
SVC_DIR ?= ./internal/service
14+
SWEEP ?= us-west-2,us-east-1,us-east-2,us-west-1
15+
SWEEP_DIR ?= ./internal/sweep
16+
SWEEP_TIMEOUT ?= 360m
17+
TEST ?= ./...
18+
TEST_COUNT ?= 1
19+
20+
# NOTE:
21+
# 1. Keep targets in alphabetical order
22+
# 2. For any changes, also update:
23+
# - docs/makefile-cheat-sheet.md
24+
# - docs/continuous-integration.md
1925

2026
ifneq ($(origin PKG), undefined)
2127
PKG_NAME = internal/service/$(PKG)
@@ -41,6 +47,10 @@ ifneq ($(origin SWEEPERS), undefined)
4147
SWEEPARGS = -sweep-run='$(SWEEPERS)'
4248
endif
4349

50+
ifeq ($(origin CURDIR), undefined)
51+
CURDIR = $(PWD)
52+
endif
53+
4454
ifeq ($(PKG_NAME), internal/service/ebs)
4555
PKG_NAME = internal/service/ec2
4656
SVC_DIR = ./internal/service/ec2
@@ -89,8 +99,6 @@ endif
8999

90100
default: build ## build
91101

92-
# Please keep targets in alphabetical order
93-
94102
acctest-lint: testacc-lint testacc-tflint ## [CI] Run all CI acceptance test checks
95103

96104
awssdkpatch: prereq-go ## Install awssdkpatch
@@ -112,6 +120,10 @@ build: prereq-go fmt-check ## Build provider
112120
@echo "make: Building provider..."
113121
@$(GO_VER) install
114122

123+
changelog-misspell: ## [CI] CHANGELOG Misspell / misspell
124+
@echo "make: CHANGELOG Misspell / misspell..."
125+
@misspell -error -source text CHANGELOG.md .changelog
126+
115127
ci: tools go-build gen-check acctest-lint copyright deps-check docs examples-tflint gh-workflow-lint golangci-lint import-lint preferred-lib provider-lint provider-markdown-lint semgrep skaff-check-compile sweeper-check test tfproviderdocs website yamllint ## [CI] Run all CI checks
116128

117129
ci-quick: tools go-build testacc-lint copyright deps-check docs examples-tflint gh-workflow-lint golangci-lint1 import-lint preferred-lib provider-lint provider-markdown-lint semgrep-code-quality semgrep-naming semgrep-naming-cae website-markdown-lint website-misspell website-terrafmt yamllint ## [CI] Run quicker CI checks
@@ -171,7 +183,7 @@ copyright: ## [CI] Copyright Checks / add headers check
171183

172184
deps-check: clean-tidy ## [CI] Dependency Checks / go_mod
173185
@echo "make: Dependency Checks / go_mod..."
174-
@git diff --exit-code -- go.mod go.sum || \
186+
@git diff origin/$(BASE_REF) --exit-code -- go.mod go.sum || \
175187
(echo; echo "Unexpected difference in go.mod/go.sum files. Run 'go mod tidy' command or revert any go.mod/go.sum changes and commit."; exit 1)
176188

177189
docs: docs-link-check docs-markdown-lint docs-misspell ## [CI] Run all CI documentation checks
@@ -258,6 +270,7 @@ fmt: ## Fix Go source formatting
258270

259271
# Currently required by tf-deploy compile
260272
fmt-check: ## Verify Go source is formatted
273+
@echo "make: Verifying source code with gofmt..."
261274
@sh -c "'$(CURDIR)/.ci/scripts/gofmtcheck.sh'"
262275

263276
fumpt: ## Run gofumpt
@@ -274,7 +287,7 @@ gen: prereq-go ## Run all Go generators
274287
gen-check: gen ## [CI] Provider Checks / go_generate
275288
@echo "make: Provider Checks / go_generate..."
276289
@echo "make: NOTE: commit any changes before running this check"
277-
@git diff --compact-summary --exit-code || \
290+
@git diff origin/$(BASE_REF) --compact-summary --exit-code || \
278291
(echo; echo "Unexpected difference in directories after code generation. Run 'make gen' command and commit."; exit 1)
279292

280293
generate-changelog: ## Generate changelog
@@ -319,14 +332,10 @@ install: build ## build
319332

320333
lint: golangci-lint provider-lint import-lint ## Legacy target, use caution
321334

322-
lint-fix: testacc-lint-fix website-lint-fix docs-lint-fix ## Fix all linter findings
335+
lint-fix: testacc-lint-fix website-lint-fix docs-lint-fix ## Fix acceptance test, website, and docs linter findings
323336

324337
misspell: changelog-misspell docs-misspell website-misspell go-misspell ## [CI] Run all CI misspell checks
325338

326-
changelog-misspell: ## [CI] CHANGELOG Misspell / misspell
327-
@echo "make: CHANGELOG Misspell / misspell..."
328-
@misspell -error -source text CHANGELOG.md .changelog
329-
330339
preferred-lib: ## [CI] Preferred Library Version Check / diffgrep
331340
@echo "make: Preferred Library Version Check / diffgrep..."
332341
@found=`git diff origin/$(BASE_REF) internal/ | grep '^\+\s*"github.com/aws/aws-sdk-go/'` ; \
@@ -492,11 +501,11 @@ semgrep-constants: semgrep-validate ## Fix constants with Semgrep --autofix
492501
--config .ci/.semgrep-constants.yml \
493502
--config .ci/.semgrep-test-constants.yml
494503

495-
semgrep-docker: semgrep-validate ## Run semgrep (Legacy, use caution)
504+
semgrep-docker: semgrep-validate ## Run Semgrep (Legacy, use caution)
496505
@echo "make: Legacy target, use caution..."
497506
@docker run --rm --volume "${PWD}:/src" returntocorp/semgrep semgrep --config .ci/.semgrep.yml --config .ci/.semgrep-constants.yml --config .ci/.semgrep-test-constants.yml
498507

499-
semgrep-fix: semgrep-validate ## Run semgrep on all files
508+
semgrep-fix: semgrep-validate ## Fix Semgrep issues that have fixes
500509
@echo "make: Running Semgrep checks locally (must have semgrep installed)..."
501510
@echo "make: Applying fixes with --autofix"
502511
@echo "make: WARNING: This will not fix rules that don't have autofixes"
@@ -543,7 +552,7 @@ semgrep-service-naming: semgrep-validate ## [CI] Semgrep Checks / Service Name S
543552
--config .ci/.semgrep-service-name2.yml \
544553
--config .ci/.semgrep-service-name3.yml
545554

546-
semgrep-validate: ## Validate semgrep configuration files
555+
semgrep-validate: ## Validate Semgrep configuration files
547556
@echo "make: Validating Semgrep configuration files..."
548557
@SEMGREP_TIMEOUT=300 semgrep --error --validate \
549558
--config .ci/.semgrep.yml \
@@ -596,12 +605,12 @@ sweeper-unlinked: go-build ## [CI] Provider Checks / Sweeper Functions Not Linke
596605
[ $$count -eq 0 ] || \
597606
(echo "Expected `strings` to detect no sweeper function names in provider binary."; exit 1)
598607

599-
t: prereq-go fmt-check ## Run acceptance tests
608+
t: prereq-go fmt-check ## Run acceptance tests (similar to testacc)
600609
TF_ACC=1 $(GO_VER) test ./$(PKG_NAME)/... -v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) $(RUNARGS) $(TESTARGS) -timeout $(ACCTEST_TIMEOUT)
601610

602611
test: prereq-go fmt-check ## Run unit tests
603612
@echo "make: Running unit tests..."
604-
$(GO_VER) test $(TEST) $(TESTARGS) -timeout=5m
613+
$(GO_VER) test -count $(TEST_COUNT) $(TEST) $(TESTARGS) -timeout=5m
605614

606615
test-compile: prereq-go ## Test package compilation
607616
@if [ "$(TEST)" = "./..." ]; then \

0 commit comments

Comments
 (0)