This repository has been archived by the owner on May 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from OpenVPN/update-user
Update user, add CI
- Loading branch information
Showing
16 changed files
with
366 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
name: golangci-lint | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
lint: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: "go.mod" | ||
cache: true | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Tests | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- "README.md" | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- "README.md" | ||
# We test at a regular interval to ensure we are alerted to something breaking due | ||
# to an API change, even if the code did not change. | ||
schedule: | ||
- cron: "0 0 * * *" | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
# ensure the code builds... | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: "go.mod" | ||
cache: true | ||
- name: Get dependencies | ||
run: | | ||
go mod download | ||
- name: Build | ||
run: | | ||
go build -v . | ||
# run acceptance tests in a matrix with Terraform core versions | ||
test: | ||
name: Matrix Test | ||
needs: build | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
terraform: | ||
- "1.2.*" | ||
- "1.3.*" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: "go.mod" | ||
cache: true | ||
|
||
- uses: hashicorp/setup-terraform@v2 | ||
with: | ||
terraform_version: ${{ matrix.terraform }} | ||
terraform_wrapper: false | ||
|
||
- name: Get dependencies | ||
run: | | ||
go mod download | ||
- name: TF acceptance tests | ||
timeout-minutes: 10 | ||
env: | ||
TF_ACC: "1" | ||
OPENVPNCLOUD_TEST_ORGANIZATION: "terraform-community" | ||
OPENVPN_CLOUD_CLIENT_ID: ${{ secrets.CVPN_CLIENT_ID }} | ||
OPENVPN_CLOUD_CLIENT_SECRET: ${{ secrets.CVPN_CLIENT_SECRET }} | ||
run: | | ||
go test -v -cover ./openvpncloud |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
issues: | ||
exclude-rules: | ||
- linters: | ||
- errcheck | ||
text: "Error return value of `d.Set` is not checked" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package openvpncloud | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
const alphabet = "abcdefghigklmnopqrstuvwxyz" | ||
|
||
var testCloudID = os.Getenv("OPENVPNCLOUD_TEST_ORGANIZATION") | ||
var testAccProvider *schema.Provider | ||
var testAccProviders map[string]*schema.Provider | ||
var testAccProviderFactories map[string]func() (*schema.Provider, error) | ||
|
||
func init() { | ||
testAccProvider = Provider() | ||
testAccProviders = map[string]*schema.Provider{ | ||
"openvpncloud": testAccProvider, | ||
} | ||
testAccProviderFactories = map[string]func() (*schema.Provider, error){ | ||
"openvpncloud": func() (*schema.Provider, error) { | ||
return testAccProvider, nil | ||
}, | ||
} | ||
} | ||
|
||
func TestProvider(t *testing.T) { | ||
if err := Provider().InternalValidate(); err != nil { | ||
t.Fatalf("err: %s", err) | ||
} | ||
} | ||
|
||
func testAccPreCheck(t *testing.T) { | ||
if v := os.Getenv("OPENVPN_CLOUD_CLIENT_ID"); v == "" { | ||
t.Fatal("OPENVPN_CLOUD_CLIENT_ID must be set for acceptance tests") | ||
} | ||
if v := os.Getenv("OPENVPN_CLOUD_CLIENT_SECRET"); v == "" { | ||
t.Fatal("OPENVPN_CLOUD_CLIENT_SECRET must be set for acceptance tests") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.