Skip to content

Commit

Permalink
fix(ci): separate release-please and goreleaser, also update all the …
Browse files Browse the repository at this point in the history
…things (#134)

Aside from splitting apart release-please and goreleaser into separate
jobs, we also just update all the various CI dependencies and tools.
  • Loading branch information
jimehk authored Jun 21, 2024
1 parent f36dacd commit 2a86d40
Show file tree
Hide file tree
Showing 34 changed files with 63 additions and 108 deletions.
100 changes: 57 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,32 @@ jobs:
lint:
name: Lint
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
checks: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: 1.21
go-version-file: "go.mod"
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: v1.55
version: v1.59
env:
VERBOSE: "true"

## TODO: Enable when this issue is resolved:
## https://github.com/bflad/tfproviderlint/issues/255
# lint-provider:
# name: Lint Provider
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-go@v3
# with:
# go-version: 1.21
# - uses: actions/cache@v3
# with:
# path: ~/go/pkg/mod
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
# - name: Run tfproviderlint
# run: make lint-provider
lint-provider:
name: Lint Provider
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Run tfproviderlint
run: make lint-provider

tidy:
name: Tidy
Expand All @@ -42,7 +40,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
go-version-file: "go.mod"
- name: Check if mods are tidy
run: make check-tidy

Expand All @@ -54,6 +52,8 @@ jobs:
matrix:
terraform_version:
- "" # latest
- "1.8.5"
- "1.7.5"
- "1.6.6"
- "1.5.7"
- "1.4.7"
Expand All @@ -62,8 +62,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- uses: hashicorp/setup-terraform@v2
go-version-file: "go.mod"
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.terraform_version }}
terraform_wrapper: false
Expand All @@ -83,42 +83,56 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
go-version-file: "go.mod"
- name: Validate documentation
run: make check-docs
- name: Ensure generated documentation is up to date
run: mv docs docs-current && make docs && diff -rN docs-current docs

release-please:
needs: [lint, tidy, test, docs]
name: Release Please
runs-on: ubuntu-latest
needs: [lint, lint-provider, tidy, test, docs]
if: github.ref == 'refs/heads/main'
outputs:
release_created: ${{ steps.release-please.outputs.release_created }}
tag_name: ${{ steps.release-please.outputs.tag_name }}
version: ${{ steps.release-please.outputs.version }}
permissions:
contents: write
pull-requests: write
steps:
- uses: google-github-actions/release-please-action@v3
- uses: krystal/release-please-manifest-action@v1
id: release-please
with:
command: manifest
- if: ${{ steps.release-please.outputs.release_created }}
uses: actions/checkout@v4
app-id: ${{ vars.RELEASE_PLEASE_GITHUB_APP_ID }}
private-key: ${{ secrets.RELEASE_PLEASE_GITHUB_APP_PRIVATE_KEY }}

release:
name: Release
runs-on: ubuntu-latest
needs: [release-please]
if: needs.release-please.outputs.release_created
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- if: ${{ steps.release-please.outputs.release_created }}
uses: actions/setup-go@v5
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- if: ${{ steps.release-please.outputs.release_created }}
name: Import GPG key
go-version-file: "go.mod"
- name: Import GPG key
id: import_gpg
uses: paultyng/ghaction-import-gpg@v2.1.0
env:
GPG_PRIVATE_KEY: "${{ secrets.GPG_PRIVATE_KEY }}"
PASSPHRASE: "${{ secrets.PASSPHRASE }}"
- if: ${{ steps.release-please.outputs.release_created }}
name: goreleaser
uses: goreleaser/goreleaser-action@v3
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: "${{ secrets.GPG_PRIVATE_KEY }}"
passphrase: "${{ secrets.PASSPHRASE }}"
- name: goreleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --rm-dist
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GPG_FINGERPRINT: "${{ steps.import_gpg.outputs.fingerprint }}"
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ linters-settings:
golint:
min-confidence: 0
govet:
check-shadowing: true
enable-all: true
disable:
- fieldalignment
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ $(TOOLDIR)/$(1): Makefile
GOBIN="$(CURDIR)/$(TOOLDIR)" go install "$(2)"
endef

$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55))
$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59))
$(eval $(call tool,gomod,github.com/Helcaraxan/gomod@latest))
$(eval $(call tool,tfplugindocs,github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@v0.14))
$(eval $(call tool,tfproviderlint,github.com/bflad/tfproviderlint/cmd/tfproviderlint@latest))
$(eval $(call tool,tfplugindocs,github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@v0.19.4))
$(eval $(call tool,tfproviderlint,github.com/bflad/tfproviderlint/cmd/tfproviderlint@v0.30.0))

.PHONY: tools
tools: $(TOOLS)
Expand Down
2 changes: 0 additions & 2 deletions docs/data-sources/data_center.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,3 @@ data "katapult_data_center" "lon" {
- `country_id` (String)
- `country_name` (String)
- `name` (String)


2 changes: 0 additions & 2 deletions docs/data-sources/disk_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,3 @@ data "katapult_disk_template" "ubuntu-18-04" {
- `os_family` (String)
- `template_version` (Number)
- `universal` (Boolean)


2 changes: 0 additions & 2 deletions docs/data-sources/disk_templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,3 @@ Read-Only:
- `permalink` (String)
- `template_version` (Number)
- `universal` (Boolean)


2 changes: 0 additions & 2 deletions docs/data-sources/file_storage_volume.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,3 @@ data "katapult_file_storage_volume" "web" {
- `name` (String) Unique name to help identify the volume. Must be unique within the organization.
- `nfs_location` (String) The NFS location indicating where to mount the volume from. This is where the volume must be mounted from inside of virtual machines referenced in `associations`.
- `size` (Number) The size of the volume in bytes.


2 changes: 0 additions & 2 deletions docs/data-sources/file_storage_volumes.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,3 @@ Read-Only:
- `name` (String)
- `nfs_location` (String)
- `size` (Number)


2 changes: 0 additions & 2 deletions docs/data-sources/ip.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,3 @@ data "katapult_ip" "web-2" {
- `reverse_dns` (String)
- `version` (Number) IPv4 or IPv6.
- `vip` (Boolean)


2 changes: 0 additions & 2 deletions docs/data-sources/load_balancer.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,3 @@ data "katapult_load_balancer" "db-replicas" {
- `tag_ids` (Set of String)
- `virtual_machine_group_ids` (Set of String)
- `virtual_machine_ids` (Set of String)


2 changes: 0 additions & 2 deletions docs/data-sources/load_balancer_rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,3 @@ data "katapult_load_balancer_rule" "web-redirect" {
- `passthrough_ssl` (Boolean)
- `protocol` (String)
- `proxy_protocol` (Boolean)


2 changes: 0 additions & 2 deletions docs/data-sources/load_balancer_rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,3 @@ Read-Only:
- `passthrough_ssl` (Boolean)
- `protocol` (String)
- `proxy_protocol` (Boolean)


2 changes: 0 additions & 2 deletions docs/data-sources/load_balancers.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,3 @@ Read-Only:
- `tag_ids` (Set of String)
- `virtual_machine_group_ids` (Set of String)
- `virtual_machine_ids` (Set of String)


2 changes: 0 additions & 2 deletions docs/data-sources/network_speed_profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,3 @@ data "katapult_network_speed_profile" "10gbps" {
- `download_speed` (Number) Download speed in Mbit. A value of `0` means unrestricted.
- `name` (String)
- `upload_speed` (Number) Upload speed in Mbit. A value of `0` means unrestricted.


2 changes: 0 additions & 2 deletions docs/data-sources/network_speed_profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,3 @@ Read-Only:
- `name` (String)
- `permalink` (String)
- `upload_speed` (Number)


2 changes: 0 additions & 2 deletions docs/data-sources/security_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,3 @@ Read-Only:
- `ports` (String)
- `protocol` (String)
- `targets` (Set of String)


2 changes: 0 additions & 2 deletions docs/data-sources/security_group_rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,3 @@ data "katapult_security_group_rule" "ssh" {
- `protocol` (String) The protocol of the rule (`TCP`, `UDP`, or `ICMP`).
- `security_group_id` (String) The ID of the security group to which the rule applies.
- `targets` (Set of String) The targets to which the rule applies. Can be IP addresses, CIDR blocks, IDs for virtual machines, virtual machine groups, tags, address lists, or `all:ipv4` and `all:ipv6`.


2 changes: 0 additions & 2 deletions docs/data-sources/security_group_rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,3 @@ Read-Only:
- `ports` (String)
- `protocol` (String)
- `targets` (Set of String)


2 changes: 0 additions & 2 deletions docs/data-sources/security_groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,3 @@ Read-Only:
- `ports` (String)
- `protocol` (String)
- `targets` (Set of String)


2 changes: 0 additions & 2 deletions docs/data-sources/virtual_machine.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,3 @@ data "katapult_virtual_machine" "web-1" {
- `package` (String) Permalink or ID of a Virtual Machine Package.
- `state` (String)
- `tags` (Set of String)


2 changes: 0 additions & 2 deletions docs/data-sources/virtual_machine_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,3 @@ data "katapult_virtual_machine_group" "group-1" {

- `name` (String)
- `segregate` (Boolean)


2 changes: 0 additions & 2 deletions docs/data-sources/virtual_machine_groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,3 @@ Read-Only:
- `id` (String)
- `name` (String)
- `segregate` (Boolean)


2 changes: 0 additions & 2 deletions docs/data-sources/virtual_machine_package.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,3 @@ data "katapult_virtual_machine_package" "rock3" {
- `name` (String)
- `privacy` (String)
- `storage_in_gb` (Number) Storage in GB.


2 changes: 0 additions & 2 deletions docs/data-sources/virtual_machine_packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,3 @@ Read-Only:
- `permalink` (String)
- `privacy` (String)
- `storage_in_gb` (Number)


1 change: 0 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "Katapult Provider"
subcategory: ""
description: Terraform provider for Katapult (https://katapult.io/)
---

Expand Down
2 changes: 0 additions & 2 deletions docs/resources/file_storage_volume.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,3 @@ Optional:
- `create` (String)
- `delete` (String)
- `update` (String)


2 changes: 0 additions & 2 deletions docs/resources/ip.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,3 @@ resource "katapult_ip" "primary-db" {
- `allocation_type` (String)
- `id` (String) The ID of this resource.
- `reverse_dns` (String)


2 changes: 0 additions & 2 deletions docs/resources/load_balancer.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,3 @@ resource "katapult_load_balancer" "by-tag" {

- `id` (String) The ID of this resource.
- `ip_address` (String)


2 changes: 0 additions & 2 deletions docs/resources/load_balancer_rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,3 @@ resource "katapult_load_balancer_rule" "complete_rule" {
### Read-Only

- `id` (String) The ID of this resource.


2 changes: 0 additions & 2 deletions docs/resources/security_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,3 @@ Read-Only:

- `direction` (String) The direction of the rule (`inbound` or `outbound`).
- `id` (String) The ID of the security group rule. This is automatically generated by the API.


2 changes: 0 additions & 2 deletions docs/resources/security_group_rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,3 @@ resource "katapult_security_group_rule" "http_out" {
### Read-Only

- `id` (String) The ID of the security group rule. This is automatically generated by the API.


2 changes: 0 additions & 2 deletions docs/resources/virtual_machine.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,3 @@ Optional:
- `create` (String)
- `delete` (String)
- `update` (String)


2 changes: 0 additions & 2 deletions docs/resources/virtual_machine_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,3 @@ resource "katapult_virtual_machine_group" "web-1" {
### Read-Only

- `id` (String) The ID of this resource.


5 changes: 3 additions & 2 deletions templates/index.md.tmpl
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "Katapult Provider"
subcategory: ""
description: Terraform provider for Katapult (https://katapult.io/)
---

# Katapult Provider

Terraform provider for [Katapult](https://katapult.io/).

{{ if .HasExample -}}
## Example Usage

{{ tffile "examples/provider/provider.tf" }}
{{tffile .ExampleFile }}
{{- end }}

{{ .SchemaMarkdown | trimspace }}

0 comments on commit 2a86d40

Please sign in to comment.