Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
optik-aper authored Sep 12, 2023
2 parents 9ad771e + 0d07411 commit 5b80411
Show file tree
Hide file tree
Showing 703 changed files with 9,757 additions and 318,326 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
52 changes: 52 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Unit/Coverage Tests"

on: pull_request_target

jobs:
coverage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.20"

- name: Run unit tests and coverage test
id: test-coverage
run: |
go test -cover -v > output.txt
- name: Transform output
id: results
if: always()
run: |
CONTENT=$(cat output.txt)
CONTENT="${CONTENT//'%'/'%25'}"
CONTENT="${CONTENT//$'\n'/'%0A'}"
CONTENT="${CONTENT//$'\r'/'%0D'}"
echo "::set-output name=content::$CONTENT"
- name: Add Comment
uses: actions/github-script@v5
if: always()
with:
script: |
const output = `### Unit Tests and Coverage
<details><summary>Show Output</summary>
\`\`\`
${{ steps.results.outputs.content }}
\`\`\`
</details>
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
47 changes: 47 additions & 0 deletions .github/workflows/gochecks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Checks

on:
pull_request:
branches:
- master

jobs:
Golangci-Lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.20"

- name: Install dependencies
run: |
go version
go install github.com/golangci/golangci-lint/cmd/[email protected]
- name: Run golangci-lint
run: |
golangci-lint run cmd/...
Go-Fmt:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.20"

- name: Run fmt
run: |
gofmt_files=$(gofmt -l cmd)
if [[ -n ${gofmt_files} ]]; then
echo 'gofmt needs running on the following files:'
echo "${gofmt_files}"
exit 1
fi
exit 0
18 changes: 18 additions & 0 deletions .github/workflows/notify-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: notify-issue

on:
issues:
types: [opened]

jobs:
issue:
runs-on: ubuntu-latest
name: New Issue Notification
steps:
- run: |
echo "{\"text\":\"Vultr-CLI : New Issue https://github.com/vultr/vultr-cli/issues/${{ github.event.issue.number }} \"}" > mattermost.json
- uses: mattermost/action-mattermost-notify@master
env:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_USERNAME: ${{ secrets.MATTERMOST_USERNAME}}
MATTERMOST_ICON: ${{ secrets.MATTERMOST_ICON }}
16 changes: 16 additions & 0 deletions .github/workflows/notify-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: notify-pr

on: pull_request_target

jobs:
pr:
runs-on: ubuntu-latest
name: Pull Request Notification
steps:
- run: |
echo "{\"text\":\"Vultr-CLI : PR https://github.com/vultr/vultr-cli/pull/${{ github.event.number }} \"}" > mattermost.json
- uses: mattermost/action-mattermost-notify@master
env:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_USERNAME: ${{ secrets.MATTERMOST_USERNAME}}
MATTERMOST_ICON: ${{ secrets.MATTERMOST_ICON }}
95 changes: 95 additions & 0 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: "Automatic Releaser"

on:
push:
branches:
- master

permissions:
contents: write

jobs:
check-commit:
runs-on: ubuntu-latest
outputs:
msg_check: ${{ steps.check-msg.outputs.match }}
steps:
- name: Check Message
id: check-msg
run: |
pattern="^Release v[0-9]+.[0-9]+.[0-9]+ #(minor|major|patch)$"
if [[ "${{ github.event.head_commit.message }}" =~ ${pattern} ]]; then
echo ::set-output name=match::true
fi
create-tag:
runs-on: ubuntu-latest
if: needs.check-commit.outputs.msg_check == 'true'
needs: check-commit
outputs:
new_tag: ${{ steps.tagger.outputs.new_tag }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'

- name: Bump version and push tag
id: tagger
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: "none"

goreleaser:
runs-on: ubuntu-latest
needs: create-tag
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.20"
-
name: Docker Login
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.VULTRBOT_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
-
name: Clear
if: always()
run: |
rm -f ${HOME}/.docker/config.json
release:
runs-on: ubuntu-latest
needs: ["goreleaser", "create-tag"]
name: Release Notification
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- run: |
echo "{\"text\":\"Vultr-CLI : Release https://github.com/${{ github.repository }}/releases/tag/${{ needs.create-tag.outputs.new_tag }} \"}" > mattermost.json
- uses: mattermost/action-mattermost-notify@master
env:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_USERNAME: ${{ secrets.MATTERMOST_USERNAME}}
MATTERMOST_ICON: ${{ secrets.MATTERMOST_ICON }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
.vscode/
.idea
builds/
dist/
dist/
vendor/
50 changes: 26 additions & 24 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
before:
hooks:
- go mod download
- go generate ./...
builds:
-
env:
- CGO_ENABLED=0

binary: vultr-cli

asmflags:
- -D mysymbol
- all=-trimpath={{.Env.GOPATH}}

gcflags:
- all=-trimpath={{.Env.GOPATH}}
- ./dontoptimizeme=-N
flags:
- -trimpath #removes all file system paths from the compiled executable

goos:
- linux
Expand All @@ -24,16 +15,22 @@ builds:

goarch:
- amd64
- 386
- arm64
- arm

goarm:
- 6
- 7

archives:
-
replacements:
darwin: macOs
linux: linux
windows: windows
386: 32-bit
amd64: 64-bit
name_template: >-
{{- .ProjectName }}_v
{{- .Version }}_
{{- if eq .Os "darwin" }}macOs
{{- else }}{{ .Os }}{{ end }}_
{{- if eq .Arch "arm" }}arm32-v{{ .Arm }}
{{- else }}{{ .Arch }}{{ end }}
format: tar.gz

Expand All @@ -44,7 +41,6 @@ archives:
- goos: windows
format: zip


checksum:
name_template: "{{ .ProjectName }}_v{{ .Version }}_checksums.txt"
algorithm: sha256
Expand All @@ -63,11 +59,10 @@ brews:
-
name: vultr-cli

github:
repository:
owner: vultr
name: homebrew-vultr-cli


url_template: "https://github.com/vultr/vultr-cli/releases/download/{{ .Tag }}/{{ .ArtifactName }}"

commit_author:
Expand All @@ -78,16 +73,23 @@ brews:

description: "Official command-line tool for Vultr services"

dependencies:

test: |
output = shell_output("#{bin}/vultr-cli version 2>&1", 1)
assert_match "Please export your VULTR API key as an environment variable, eg:\nexport VULTR_API_KEY='<api_key_from_vultr_account>'\n", output
assert_match "Please export your VULTR API key as an environment variable or add `api-key` to your config file, eg:\nexport VULTR_API_KEY='<api_key_from_vultr_account>'\n", output
install: |
bin.install "vultr-cli"
prefix.install_metafiles
dockers:
- dockerfile: Dockerfile.goreleaser
image_templates:
- "vultr/vultr-cli:release"
- "vultr/vultr-cli:latest"
- "vultr/vultr-cli:{{ .Tag }}"
extra_files:
- scripts/entrypoint.sh

release:
github:
owner: vultr
Expand Down
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 5b80411

Please sign in to comment.