Skip to content

Commit

Permalink
Generate provider docs (argoproj-labs#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
onematchfox authored and MrLuje committed Apr 23, 2023
1 parent 16a40e9 commit e02838d
Show file tree
Hide file tree
Showing 52 changed files with 2,009 additions and 1,184 deletions.
Binary file added .github/argo-cd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/tf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
fetch-depth: 0

Expand Down
55 changes: 43 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,57 @@ on:
branches: [master]

jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5

steps:

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

- name: Set up Go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version-file: 'go.mod'
id: go

# TODO: Add linting (in upcoming PR)
# - name: Run linters
# uses: golangci/golangci-lint-action@0ad9a0988b3973e851ab0a07adf248ec2e100376 # v3.3.1
# with:
# version: latest

- name: Generate
run: make generate

- name: Confirm no diff
run: |
git diff --compact-summary --exit-code || \
(echo "*** Unexpected differences after code generation. Run 'make generate' and commit."; exit 1)
- name: Build
run: make build

acceptance_tests:
name: Acceptance Tests
needs: build
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
argocd_version: ["v2.5.0", "v2.4.12", "v2.3.9"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.19
id: go
- name: Restore Go cache
uses: actions/cache@v1
- name: Check out code
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

- name: Setup Go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version-file: 'go.mod'
check-latest: true

- name: Install Kustomize
run: |
Expand All @@ -51,4 +82,4 @@ jobs:
- name: Run acceptance tests
env:
ARGOCD_VERSION: ${{ matrix.argocd_version }}
run: sh scripts/testacc.sh
run: make testacc
93 changes: 28 additions & 65 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,80 +1,43 @@
TEST?=./...
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
PKG_NAME=pass
default: build

BINARY=terraform-provider-argocd
VERSION = $(shell git describe --always)
ARGOCD_INSECURE?=true
ARGOCD_SERVER?=127.0.0.1:8080
ARGOCD_AUTH_USERNAME?=admin
ARGOCD_AUTH_PASSWORD?=acceptancetesting
ARGOCD_CONTEXT?=kind-argocd
ARGOCD_VERSION?=v2.5.0

default: build-all
export

build-all: linux windows darwin freebsd
build:
go build -v ./...

install: fmtcheck
go install
install: build
go install -v ./...

linux: fmtcheck
@mkdir -p bin/
GOOS=linux GOARCH=amd64 go build -v -o bin/$(BINARY)_$(VERSION)_linux_amd64
GOOS=linux GOARCH=386 go build -v -o bin/$(BINARY)_$(VERSION)_linux_x86

windows: fmtcheck
@mkdir -p bin/
GOOS=windows GOARCH=amd64 go build -v -o bin/$(BINARY)_$(VERSION)_windows_amd64
GOOS=windows GOARCH=386 go build -v -o bin/$(BINARY)_$(VERSION)_windows_x86

darwin: fmtcheck
@mkdir -p bin/
GOOS=darwin GOARCH=amd64 go build -v -o bin/$(BINARY)_$(VERSION)_darwin_amd64
GOOS=darwin GOARCH=arm64 go build -v -o bin/$(BINARY)_$(VERSION)_darwin_arm64

freebsd: fmtcheck
@mkdir -p bin/
GOOS=freebsd GOARCH=amd64 go build -v -o bin/$(BINARY)_$(VERSION)_freebsd_amd64
GOOS=freebsd GOARCH=386 go build -v -o bin/$(BINARY)_$(VERSION)_freebsd_x86
# See https://golangci-lint.run/
lint:
golangci-lint run

release: clean linux windows darwin freebsd
for f in $(shell ls bin/); do zip bin/$${f}.zip bin/$${f}; done
generate:
go generate ./...

clean:
git clean -fXd -e \!vendor -e \!vendor/**/* -e \!.vscode
fmt:
gofmt -s -w -e .

test: fmtcheck
go test $(TEST) -timeout=30s -parallel=4

testacc_prepare_env:
sh scripts/testacc_prepare_env.sh
test:
go test -v -cover -timeout=120s -parallel=4 ./...

testacc:
sh scripts/testacc.sh
TF_ACC=1 go test -v -cover -timeout 8m ./...

testacc_clean_env:
kind delete cluster --name argocd

fmt:
@echo "==> Fixing source code with gofmt..."
gofmt -s -w ./$(PKG_NAME)

# Currently required by tf-deploy compile
fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"

lint:
@echo "==> Checking source code against linters..."
@GOGC=30 golangci-lint run ./$(PKG_NAME)

test-compile:
@if [ "$(TEST)" = "./..." ]; then \
echo "ERROR: Set TEST to a specific package. For example,"; \
echo " make test-compile TEST=./$(PKG_NAME)"; \
exit 1; \
fi
go test -c $(TEST) $(TESTARGS)

vendor:
go mod tidy
go mod vendor

vet:
go vet $<
testacc_prepare_env:
sh scripts/testacc_prepare_env.sh

clean:
git clean -fXd -e \!vendor -e \!vendor/**/* -e \!.vscode

.PHONY: build test testacc_prepare_env testacc testacc_clean_env fmt fmtcheck lint test-compile vendor
.PHONY: build install lint generate fmt test testacc testacc_clean_env testacc_prepare_env clean
Loading

0 comments on commit e02838d

Please sign in to comment.