diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9d5f6be3..517b9ab6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ name: Release on: push: tags: - - "*" + - '*' permissions: read-all @@ -31,7 +31,7 @@ jobs: - name: Install Go uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: - go-version: ">= 1.22" + go-version: '>= 1.22' cache: true - name: Import GPG Signing Key diff --git a/CHANGELOG.md b/CHANGELOG.md index 144d7aa8..5ebc846e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), adheres t * [`761d230`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/761d230f025d6aa43d69d21a9a0f818453a3544d): Renamed `AUTHORS.md` to CONTRIBUTORS to better align with established patterns on the web. * [`2758a7e`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/2758a7e9a60c6f9909c326a71550ad5e5cefe755): Create a new `ACKNOWLEDGMENTS.md` file. * [`877ed3f`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/877ed3f137eba9f4a1706ab1e33c1037edf6b7ed): Updated the Contribution Guide. + ## 1.3.0 — 2024-02-05 [Compare: v1.2.1 → v1.3.0](https://github.com/northwood-labs/terraform-provider-corefunc/compare/v1.2.1..v1.3.0) @@ -70,9 +71,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), adheres t ### Testing * [`5d992f3`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/5d992f31b4d5566e37bb12a0d133400d75d1763f): Regenerate test artifacts. + * [`c4459ad`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/c4459ad7664dc6a1c93b3585705dc46d72cb76d2): Updated BATS tests with Shellcheck feedback. + * [`6611f3f`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/6611f3fbd38af4997fb156c22d4157024bd8d76f): Generated updated test artifacts. + * [`d6f3437`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/d6f34376297dc934e195c379786053729b8625bb): Added Terratest tests for `corefunc_url_parse`. + ## 1.2.1 — 2024-02-02 [Compare: v1.1.1 → v1.2.1](https://github.com/northwood-labs/terraform-provider-corefunc/compare/v1.1.1..v1.2.1) @@ -150,18 +155,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), adheres t * [`ae243c3`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/ae243c36dba8429a3606b223495d2f94ec5b82e9): Work on adding automated OpenTofu testing. * [`56501ef`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/56501ef5e2e26ec6ca6c1c06a1aa1eb7987cb280): Work on adding automated OpenTofu testing. * [`4a1e899`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/4a1e899979c9a3593fd741484bdf1e8b3febfe4c): Work on adding automated OpenTofu testing. + * [`a8b9724`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/a8b97249bf45c2fc71fc6d32ffc6470a5b3dc5c3): Work on adding automated OpenTofu testing. * [`d374a8c`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/d374a8c42fa2e3c20f410762f7369d41088bad6e): Work on adding automated OpenTofu testing. + * [`44c7648`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/44c76484bc48005d0484162a43bb5efa2170f724): Work on adding automated OpenTofu testing. * [`b5f2b8e`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/b5f2b8e0382900ef4a85f0e5e0052c066b9da624): Work on adding automated OpenTofu testing. + * [`6be7398`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/6be7398843e0a757ab4f0308a175843d8603c829): Work on adding automated OpenTofu testing. * [`66abdf2`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/66abdf213d2f88f3ee0e3d44b26dd0b557b25005): Work on adding automated OpenTofu testing. + * [`cc77ed9`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/cc77ed99085f9c81281dd7a6dbcc74298d4cdbe1): Improve CHANGELOG generation. * [`0182c79`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/0182c79239bb888e61e7affcd3ddfaeced41c0d2): Improve CHANGELOG generation. + * [`acee3ef`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/acee3ef09ce457f074bb25f8aada3d029e474027): Add auto-cancelation for multiple CI runs of the same test. * [`85cfb6c`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/85cfb6c8dfed8d61bf84d246ba58eacbf91cc650): Setup Terratest testing for OpenTofu from the Makefile. + * [`57b1e0e`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/57b1e0eb5f91a87e5450dba5d6f9492fb2c0b374): Improve switching between Terraform/OpenTofu in Terratest. * [`590c3bc`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/590c3bce781674b2627e494b203570b142555844): Improve switching between Terraform/OpenTofu in Terratest. + ## 1.1.1 — 2023-12-20 [Compare: v1.1.0 → v1.1.1](https://github.com/northwood-labs/terraform-provider-corefunc/compare/v1.1.0..v1.1.1) @@ -170,24 +182,29 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), adheres t * [`0c431c2`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/0c431c21046806396bfe392f32fdfa5ba67743f3): Remove the restriction to pre-1.6 versions of Terraform in examples. * [`27b9e60`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/27b9e60796e0bfdc3b972cae11bca284c4cfc8d2): Updated Go dependencies. + * [`bc39137`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/bc391374137cb742fa719bd3790288cfa4a0c7cd): Pin the version of the GoSec action. * [`aa4e217`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/aa4e2178e06786ed2a0adb21e0095326854904fb): Pin the version of the Trufflehog action. * [`1d01f26`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/1d01f2686604a931602bdd0880a640ac13d312ce): **deps**: Bump `golang.org/x/crypto` in /terratest ([#90](https://github.com/northwood-labs/terraform-provider-corefunc/issues/90)) (dependabot[bot]) + * [`2f77df9`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/2f77df906e466c58ba3d4eb7d328684da4aab20e): **deps**: Bump `golang.org/x/crypto` from 0.3.0 to 0.17.0 in /generator ([#89](https://github.com/northwood-labs/terraform-provider-corefunc/issues/89)) (dependabot[bot]) * [`07df7b9`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/07df7b911593bf1b65fbe060b005aae5b0e4faa6): **deps**: Bump `trufflesecurity/trufflehog` from 3.63.4 to 3.63.5 ([#91](https://github.com/northwood-labs/terraform-provider-corefunc/issues/91)) (dependabot[bot]) * [`956339c`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/956339c396e8b199a35d2f4eeff058dd11175be3): **deps**: Bump `golang.org/x/crypto` from 0.16.0 to 0.17.0 ([#88](https://github.com/northwood-labs/terraform-provider-corefunc/issues/88)) (dependabot[bot]) + * [`543eb0a`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/543eb0ab95e3918f034c76a99099ff0f8fcdd490): Update the `go.sum` file. ### Documentation * [`f3c07b2`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/f3c07b267eacc0cc4c3fabd81628112f8ea974f2): Updated copyright in all headers to include 2024. * [`1d00129`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/1d0012982e3c1760735a4fa53a6603781bad6930): Updated the `README.md` for the Terratest tests. + * [`1c2bc3c`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/1c2bc3c6f91b6326cd188320d8978972e2aa78dc): Updated the templates used by tfplugindocs. ### Testing * [`e0915df`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/e0915dfb90f9d2824be769dcc629501db99d1b8c): Added tests with Terratest to compare the Terraform provider with the Go library. * [`e5a810a`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/e5a810a8f9a5ffe2737928429df0be3a9a0a25c3): Make the GoSec scanning more robust. + ## 1.1.0 — 2023-12-18 [Compare: v1.0.3 → v1.1.0](https://github.com/northwood-labs/terraform-provider-corefunc/compare/v1.0.3..v1.1.0) @@ -206,6 +223,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), adheres t * [`3b7d8ca`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/3b7d8cac9ddc38904505c5c9fbbd47fc15f54df5): Updated the `README.md`. * [`d41ad2e`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/d41ad2e1dafbfac54dacf3ac9d49b50032122089): Updated the Terraform documentation to include the lockfile. + * [`00b7206`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/00b7206578b826912a4e7563d7d6caa2588432a3): Updated the CHANGELOG. * [`92a73de`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/92a73de97de90a269afd08f4369ee4c5ad4aee59): Ran Markdownlint on the CHANGELOG. * [`6b7b0a3`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/6b7b0a375e9b17be41055a4f8a2c2dce6401b674): Added a note about base10 to `corefunc_int_leftpad`. @@ -214,8 +232,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), adheres t ### Features * [`1135f94`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/1135f9439b1966e3da849c2b9272f84eb89cfd36): Begin implementations of StrLeftPad and IntLeftPad. + * [`92fbf6f`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/92fbf6f5e7f4fd17b1a33135a851143be1fd276e): Implemented the provider side of leftpad functions. ([#73](https://github.com/northwood-labs/terraform-provider-corefunc/issues/73)) * [`c047ee1`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/c047ee16b8db3378bcb76dc430d258be9730568c): Added support for `corefunc.Homedir()` and `corefunc_homedir_get`. ([#77](https://github.com/northwood-labs/terraform-provider-corefunc/issues/77)) + * [`e3985ba`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/e3985ba1d576e273a14fe930eefb81999a695c53): Added initial support for Homedir lookups. * [`290e1cc`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/290e1cc1a5138e533935d1d8160d86edecc5b065): Added `corefunc_homedir_expand`. @@ -230,6 +250,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), adheres t ### Testing * [`57a7b85`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/57a7b85c17040f880dcaf6546c11cb9acd0a7615): Lookup and run fuzz tests programmatically. + ## 1.0.3 — 2023-11-21 [Compare: v1.0.0 → v1.0.3](https://github.com/northwood-labs/terraform-provider-corefunc/compare/v1.0.0..v1.0.3) @@ -237,6 +258,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), adheres t ### Building and Dependencies * [`14759b8`](https://github.com/northwood-labs/terraform-provider-corefunc/commit/14759b8792c77530a0538d2fdb3ed2cacddd8d73): Bump `the` version number to 1.0.3. No changes from 1.0.0. + ## 1.0.0 — 2023-11-21 ### Bug Fixes diff --git a/corefunc/caps_test.go b/corefunc/caps_test.go index 9332141c..2b51c902 100644 --- a/corefunc/caps_test.go +++ b/corefunc/caps_test.go @@ -174,6 +174,7 @@ func BenchmarkStrCamel(b *testing.B) { for name, tc := range testfixtures.StrCamelTestTable { b.Run(name, func(b *testing.B) { b.ResetTimer() + for i := 0; i < b.N; i++ { _ = StrCamel(tc.Input) // lint:allow_unhandled } @@ -202,6 +203,7 @@ func BenchmarkStrConstant(b *testing.B) { for name, tc := range testfixtures.StrConstantTestTable { b.Run(name, func(b *testing.B) { b.ResetTimer() + for i := 0; i < b.N; i++ { _ = StrConstant(tc.Input) // lint:allow_unhandled } @@ -230,6 +232,7 @@ func BenchmarkStrKebab(b *testing.B) { for name, tc := range testfixtures.StrKebabTestTable { b.Run(name, func(b *testing.B) { b.ResetTimer() + for i := 0; i < b.N; i++ { _ = StrKebab(tc.Input) // lint:allow_unhandled } @@ -258,6 +261,7 @@ func BenchmarkStrPascal(b *testing.B) { for name, tc := range testfixtures.StrPascalTestTable { b.Run(name, func(b *testing.B) { b.ResetTimer() + for i := 0; i < b.N; i++ { _ = StrPascal(tc.Input, tc.AcronymCaps) // lint:allow_unhandled } @@ -286,6 +290,7 @@ func BenchmarkStrSnake(b *testing.B) { for name, tc := range testfixtures.StrSnakeTestTable { b.Run(name, func(b *testing.B) { b.ResetTimer() + for i := 0; i < b.N; i++ { _ = StrSnake(tc.Input) // lint:allow_unhandled } diff --git a/corefunc/env_ensure_test.go b/corefunc/env_ensure_test.go index ec2346d0..444f2638 100644 --- a/corefunc/env_ensure_test.go +++ b/corefunc/env_ensure_test.go @@ -103,6 +103,7 @@ func BenchmarkEnvEnsure(b *testing.B) { b.Run(name, func(b *testing.B) { b.ResetTimer() + for i := 0; i < b.N; i++ { _ = EnvEnsure(tc.EnvVarName) // lint:allow_unhandled } diff --git a/corefunc/homedir_test.go b/corefunc/homedir_test.go index aba1d0b5..7b27337b 100644 --- a/corefunc/homedir_test.go +++ b/corefunc/homedir_test.go @@ -41,6 +41,7 @@ func BenchmarkHomedir(b *testing.B) { for name := range testfixtures.HomedirGetTestTable { b.Run(name, func(b *testing.B) { b.ResetTimer() + for i := 0; i < b.N; i++ { _, _ = Homedir() // lint:allow_unhandled } diff --git a/corefunc/int_pad_test.go b/corefunc/int_pad_test.go index 87a8c785..ed24cf9b 100644 --- a/corefunc/int_pad_test.go +++ b/corefunc/int_pad_test.go @@ -55,6 +55,7 @@ func BenchmarkIntLeftPad(b *testing.B) { for name, tc := range testfixtures.IntLeftPadTestTable { b.Run(name, func(b *testing.B) { b.ResetTimer() + for i := 0; i < b.N; i++ { _ = IntLeftPad(tc.Input, tc.PadWidth) // lint:allow_unhandled } diff --git a/corefunc/str_iterative_replace_test.go b/corefunc/str_iterative_replace_test.go index b6decd21..03830da7 100644 --- a/corefunc/str_iterative_replace_test.go +++ b/corefunc/str_iterative_replace_test.go @@ -59,6 +59,7 @@ func BenchmarkStrIterativeReplace(b *testing.B) { for name, tc := range testfixtures.StrIterativeReplaceTestTable { b.Run(name, func(b *testing.B) { b.ResetTimer() + for i := 0; i < b.N; i++ { _ = StrIterativeReplace(tc.Input, tc.Replacements) // lint:allow_unhandled } diff --git a/corefunc/str_pad_test.go b/corefunc/str_pad_test.go index 99ef001c..8ad1dbd5 100644 --- a/corefunc/str_pad_test.go +++ b/corefunc/str_pad_test.go @@ -37,6 +37,7 @@ func TestStrLeftPad(t *testing.T) { for name, tc := range testfixtures.StrLeftPadTestTable { t.Run(name, func(t *testing.T) { output := "" + var emptyByte byte if tc.PadChar == emptyByte { @@ -58,6 +59,7 @@ func BenchmarkStrLeftPad(b *testing.B) { for name, tc := range testfixtures.StrLeftPadTestTable { b.Run(name, func(b *testing.B) { b.ResetTimer() + for i := 0; i < b.N; i++ { _ = StrLeftPad(tc.Input, tc.PadWidth, tc.PadChar) // lint:allow_unhandled } diff --git a/corefunc/truncate_label_test.go b/corefunc/truncate_label_test.go index eea3e2e9..c856ad9f 100644 --- a/corefunc/truncate_label_test.go +++ b/corefunc/truncate_label_test.go @@ -73,6 +73,7 @@ func TestTruncateLabel(t *testing.T) { t.Run(name, func(t *testing.T) { actual := TruncateLabel(tc.MaxLength, tc.Prefix, tc.Label) diff := cmp.Diff(tc.Expected, actual) + if diff != "" { t.Fatalf(diff) } diff --git a/corefunc/url_test.go b/corefunc/url_test.go index d10fba3d..002f73db 100644 --- a/corefunc/url_test.go +++ b/corefunc/url_test.go @@ -107,6 +107,7 @@ func TestURLParse(t *testing.T) { // lint:allow_complexity t.Run(name, func(t *testing.T) { // Handle canonicalizer-switching opts := types.Standard + if strings.EqualFold(tc.Canonicalizer, "google_safe_browsing") { opts = types.GoogleSafeBrowsing } @@ -119,42 +120,55 @@ func TestURLParse(t *testing.T) { // lint:allow_complexity if got := u.Href(false); got != tc.Href { t.Errorf("Href() = %v, want %v", got, tc.Href) } + if got := u.Protocol(); got != tc.Protocol { t.Errorf("Protocol() = %v, want %v", got, tc.Protocol) } + if got := u.Scheme(); got != tc.Scheme { t.Errorf("Scheme() = %v, want %v", got, tc.Scheme) } + if got := u.Username(); got != tc.Username { t.Errorf("Username() = %v, want %v", got, tc.Username) } + if got := u.Password(); got != tc.Password { t.Errorf("Password() = %v, want %v", got, tc.Password) } + if got := u.Hostname(); got != tc.Hostname { t.Errorf("Hostname() = %v, want %v", got, tc.Host) } + if got := u.Host(); got != tc.Host { t.Errorf("Host() = %v, want %v", got, tc.Host) } + if got := u.Port(); got != tc.Port { t.Errorf("Port() = %v, want %v", got, tc.Port) } + if got := u.DecodedPort(); got != tc.DecodedPort { t.Errorf("DecodedPort() = %v, want %v", got, tc.DecodedPort) } + if got := u.Pathname(); got != tc.Path { t.Errorf("Pathname() = %v, want %v", got, tc.Path) } + if got := u.Search(); got != tc.Search { t.Errorf("Search() = %v, want %v", got, tc.Search) } + if got := u.Query(); got != tc.Query { t.Errorf("Query() = %v, want %v", got, tc.Query) } + if got := u.Hash(); got != tc.Hash { t.Errorf("Hash() = %v, want %v", got, tc.Hash) } + if got := u.Fragment(); got != tc.Fragment { t.Errorf("Fragment() = %v, want %v", got, tc.Fragment) }