Skip to content

Commit

Permalink
chore: Move sloctl code to this repository (#16)
Browse files Browse the repository at this point in the history
* initial commit

* add CI

* format and correct imports

* correct cspell

* remove trailing whitepsace

* fix markdown

* correct goreleaser

* sort out bats tests

* correct bats tests

* fix bats testing for good

* split e2e tests

* add issue templates

* remove unneeded yaml deps

* add dist to cspell

* remove CF config and update README

* typo
  • Loading branch information
nieomylnieja authored Jan 12, 2024
1 parent 07b226a commit bbcbfa3
Show file tree
Hide file tree
Showing 95 changed files with 5,602 additions and 59 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Who's the owner of this repository?
* @nieomylnieja
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug report
about: Create a bug report to help us solve the issue.
title: "[BUG]"
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior, ideally a minimal working working example.

**Expected behavior**
A clear and concise description of what you expected to happen.

**System details (please complete the following information):**
- OS (with version): [e.g. OS X 14.2.1, Ubuntu 22.04]
- `sloctl` version [e.g. v1.0.2]

**Additional context**
Add any other context about the problem here.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Nobl9 Support
url: https://www.nobl9.com/contact/support
about: If you need help related to the whole Nobl9 platform or want to problem to remain private, contact us here.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Feature request
about: Suggest an idea to help us improve the sloctl.
title: "[FEAT]"
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
If you're willing to contribute with a PR of your own, let us know!

**Additional context**
Add any other context or screenshots about the feature request here.
25 changes: 25 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Motivation

Describe what is the motivation behind the proposed changes. If possible reference the current solution/state of affairs.

## Summary

Recap of changed code.

## Related changes

List related changes from other PRs (if any).

## Testing

- Describe how to check introduced code changes manually. Provide example invocations and applied YAML configs.
- Take care of test coverage on unit and end-to-end levels.

## Checklist

- [ ] Include this change in Release Notes?
- If yes, write 1-3 sentences about the changes here and explicitly list all changes that can surprise our users.
- [ ] Are these changes required to be in sync with the API? Example of such can be extending adding support of new API.
It won't be usable until Nobl9 platform version is rolled out which exposes this API.
- If yes, you **MUST NOT** create an official release, instead, use a pre-release version, like `v1.1.0-rc1`.
- If the changes are independent of Nobl9 platform version, you can release an offical version, like `v1.1.0`.
67 changes: 67 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"schedule:nonOfficeHours", // https://docs.renovatebot.com/presets-schedule/#schedulenonofficehours
":enableVulnerabilityAlertsWithLabel(security)", // https://docs.renovatebot.com/presets-default/#enablevulnerabilityalertswithlabelarg0
"group:recommended", // https://docs.renovatebot.com/presets-group/#grouprecommended
"workarounds:all", // https://docs.renovatebot.com/presets-workarounds/#workaroundsall
],
"reviewersFromCodeOwners": true,
"dependencyDashboard": true,
"semanticCommits": "disabled",
"labels": ["dependencies", "renovate"],
"prHourlyLimit": 1,
"prConcurrentLimit": 5,
"rebaseWhen": "conflicted",
"rangeStrategy": "pin",
"branchPrefix": "renovate_",
// Auto-merge section.
// Only
"automergeType": "pr",
"lockFileMaintenance": {
"automerge": true
},
"minor": {
"automerge": true
},
"patch": {
"automerge": true
},
"pin": {
"automerge": true
},
// This will run go mod tidy after each go.mod update.
"postUpdateOptions": ["gomodTidy"],
// Groups:
"packageRules": [
{
"matchManagers": ["gomod"],
"matchUpdateTypes": [
"minor",
"patch",
],
"groupName": "minor and patch golang dependencies",
},
{
"matchManagers": ["github-actions"],
"addLabels": ["github-actions"],
},
{
"matchManagers": ["gomod"],
"addLabels": ["golang"],
},
{
"matchManagers": ["npm"],
"addLabels": ["javascript"],
},
],
// Custom version extraction from Makefile.
"regexManagers": [
{
"fileMatch": ["^Makefile$"],
"matchStrings": [
".*renovate datasource=(?<datasource>.*?) depName=(?<depName>.*?)\\n.*?_VERSION\\s?:=\\s?(?<currentValue>.*)\\s"
]
}
],
}
44 changes: 44 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Checks
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
check:
name: Run all checks for static analysis
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Check out code
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Set up prerequisites - node and yarn
uses: actions/setup-node@v3
- name: Set up yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run spell and markdown checkers
run: make check/spell check/trailing check/markdown
- name: Check generated code
run: make check/generate
- name: Check formatting
run: make check/format
- name: Run go vet
run: make check/vet
- name: Run golangci-lint
run: make check/lint
- name: Run Gosec Security Scanner
run: make check/gosec
21 changes: 21 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: End-to-end tests
on:
push:
tags:
- "v*"
jobs:
test:
name: Run e2e tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: false
- name: Run tests
run: make test/e2e
env:
SLOCTL_CLIENT_ID: "${{ secrets.SLOCTL_CLIENT_ID }}"
SLOCTL_CLIENT_SECRET: "${{ secrets.SLOCTL_CLIENT_ID }}"
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release
on:
push:
tags:
- "^v[0-9]+.[0-9]+.[0-9]+$"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: nobl9/sloctl
flavor: |
latest=true
tags: |
type=sha
type=semver,pattern={{version}}
- name: Release Binaries
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64, linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: GO_VERSION='-s -w -X github.com/nobl9/sloctl/internal/sloctl.BuildVersion=${{ github.ref_name }}'
21 changes: 21 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Unit tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: false
- name: Run tests
run: make test/unit
25 changes: 25 additions & 0 deletions .github/workflows/vulns.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Vulnerabilities
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
# Run at 8:00 AM every weekday.
- cron: '0 8 * * 1-5'
jobs:
scan:
name: Run Golang vulnerability check
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Run Golang Vulncheck
run: make check/vulns
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test
dist/

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Code generation binaries
bin/

# Dependency directories (remove the comment below to include it)
# vendor/

# IDE
.idea/
.vscode/

# JS
node_modules/
yarn.lock
yarn-error.log
Loading

0 comments on commit bbcbfa3

Please sign in to comment.