Skip to content

Commit

Permalink
ci: Add fmt and gen linting (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
mafredri authored Feb 10, 2023
1 parent 951cd3c commit 47888bd
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 54 deletions.
111 changes: 72 additions & 39 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,33 @@ name: Tests
on:
pull_request:
paths-ignore:
- 'README.md'
- "README.md"
push:
paths-ignore:
- 'README.md'
- "README.md"

jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
id: go

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.17'
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Get dependencies
run: |
go mod download
- name: Get dependencies
run: |
go mod download
- name: Build
run: |
go build -v .
- name: Build
run: |
go build -v .
# run acceptance tests in a matrix with Terraform core versions
test:
Expand All @@ -44,31 +43,65 @@ jobs:
fail-fast: false
matrix:
terraform:
- '1.0.*'
- '1.1.*'
- "1.0.*"
- "1.1.*"
- "1.2.*"
- "1.3.*"
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
id: go

- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false

- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Get dependencies
run: |
go mod download
- name: TF acceptance tests
timeout-minutes: 10
env:
TF_ACC: "1"
run: |
go test -v -cover ./provider/
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
id: go

- uses: hashicorp/setup-terraform@v2
with:
terraform_version: "1.3.*"
terraform_wrapper: false

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.17'
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3

- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- name: Get dependencies
run: |
go mod download
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Lint fmt
run: |
make fmt
git diff --exit-code
- name: Get dependencies
run: |
go mod download
- name: TF acceptance tests
timeout-minutes: 10
env:
TF_ACC: "1"
run: |
go test -v -cover ./provider/
- name: Lint gen
run: |
make gen
git diff --exit-code
30 changes: 15 additions & 15 deletions examples/resources/coder_parameter/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ data "coder_parameter" "example" {
}

data "coder_parameter" "ami" {
name = "Machine Image"
name = "Machine Image"
description = <<-EOT
# Provide the machine image
See the [registry](https://container.registry.blah/namespace) for options.
Expand All @@ -33,39 +33,39 @@ data "coder_parameter" "ami" {
}

data "coder_parameter" "is_public_instance" {
name = "Is public instance?"
type = "bool"
icon = "/icon/docker.svg"
name = "Is public instance?"
type = "bool"
icon = "/icon/docker.svg"
default = false
}

data "coder_parameter" "cores" {
name = "CPU Cores"
type = "number"
icon = "/icon/cpu.svg"
name = "CPU Cores"
type = "number"
icon = "/icon/cpu.svg"
default = 3
}

data "coder_parameter" "disk_size" {
name = "Disk Size"
type = "number"
name = "Disk Size"
type = "number"
default = "5"
validation {
# This can apply to number.
min = 0
max = 10
min = 0
max = 10
monotonic = "increasing"
}
}

data "coder_parameter" "cat_lives" {
name = "Cat Lives"
type = "number"
name = "Cat Lives"
type = "number"
default = "9"
validation {
# This can apply to number.
min = 0
max = 10
min = 0
max = 10
monotonic = "decreasing"
}
}

0 comments on commit 47888bd

Please sign in to comment.