Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ndrpnt committed Feb 9, 2022
0 parents commit c8b9bfa
Show file tree
Hide file tree
Showing 48 changed files with 4,602 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
21 changes: 21 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: codeql
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: 11 11 * * 1 # At 11:11 on Monday
jobs:
analyze:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- uses: actions/checkout@v2
- uses: github/codeql-action/init@v1
with:
languages: go
- uses: github/codeql-action/analyze@v1
72 changes: 72 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: main
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
go_build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/[email protected]
with:
go-version: 1.17
- uses: actions/[email protected]
- run: go mod download
- run: go build -v .
go_unit_tests:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/[email protected]
with:
go-version: 1.17
- uses: actions/[email protected]
- run: go mod download
- run: go test ./... -timeout 1m
go_acceptance_tests:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
terraform:
- 0.12.31
- 0.13.7
- 0.14.11
- 0.15.5
- 1.0.11
- 1.1.2
steps:
- uses: actions/[email protected]
with:
go-version: 1.17
- uses: actions/[email protected]
- run: go mod download
- name: Start Mattermost instance
run: docker compose up --wait
- name: Create Mattermost admin user
run: docker compose exec mattermost mmctl --local user create
--email [email protected]
--username admin
--password admin
--disable-welcome-email
- env:
TF_ACC: 1
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }}
MM_URL: http://localhost:8065
MM_LOGIN_ID: admin
MM_PASSWORD: admin
run: go test ./... -v -timeout 5m
go_generate:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
go-version: 1.17
- uses: actions/[email protected]
- uses: hashicorp/[email protected]
- run: go generate
- name: Check for Git differences
run: git diff --compact-summary --exit-code
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: release
on:
push:
tags: [ v* ]
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
go-version: 1.17
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Import GPG key
id: import_gpg
uses: hashicorp/[email protected]
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
- uses: goreleaser/[email protected]
with:
version: latest
args: release --rm-dist
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47 changes: 47 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
builds:
- env:
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
goos:
- freebsd
- windows
- linux
- darwin
goarch:
- amd64
- '386'
- arm
- arm64
ignore:
- goos: darwin
goarch: '386'
binary: '{{ .ProjectName }}_v{{ .Version }}'
archives:
- format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
checksum:
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256
signs:
- artifacts: checksum
args:
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}"
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
release:
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
changelog:
skip: true
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.1.0 (Unreleased)

BACKWARDS INCOMPATIBILITIES / NOTES:
34 changes: 34 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.DEFAULT_GOAL := help

# Path to the docker-compose binary
DOCKER_COMPOSE_BIN ?= docker compose

.PHONY: help
help: ## Show this help
@awk 'BEGIN {FS = ":.*?## "} /^[%a-zA-Z0-9_-]+:.*?## / {printf "%-20s%s\n", $$1, $$2}' $(MAKEFILE_LIST)

.PHONY: up
up: ## Spin up local testing infrastructure
$(DOCKER_COMPOSE_BIN) up --wait
$(DOCKER_COMPOSE_BIN) exec mattermost mmctl --local user create \
--email [email protected] \
--username admin \
--password admin \
--disable-welcome-email
$(DOCKER_COMPOSE_BIN) exec mattermost mmctl --local token generate admin 'For local testing'

.PHONY: down
down: ## Destroy local testing infrastructure
$(DOCKER_COMPOSE_BIN) down

.PHONY: testacc
testacc: export TF_ACC=1
testacc: export MM_URL=http://localhost:8065
testacc: export MM_LOGIN_ID=admin
testacc: export MM_PASSWORD=admin
testacc: ## Run acceptance tests
go test ./... -v $(TESTARGS) -timeout 2m

.PHONY: test
test: ## Run unit tests
go test ./... $(TESTARGS)
Loading

0 comments on commit c8b9bfa

Please sign in to comment.