-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
14ffa5a
commit b0913e7
Showing
15 changed files
with
483 additions
and
0 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,6 @@ | ||
FROM bhojpur/platform-full | ||
ENV TRIGGER_REBUILD=1 | ||
RUN curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sudo BINDIR=/usr/local/bin sh | ||
RUN sudo su -c "cd /usr; curl -L https://github.com/moby/buildkit/releases/download/v0.9.3/buildkit-v0.9.3.linux-amd64.tar.gz | tar xvz" | ||
# NOTE: remove when platform-full includes golangci | ||
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo BINDIR=/usr/local/bin sh |
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,12 @@ | ||
version = 1 | ||
|
||
test_patterns = ["**/*_test.go"] | ||
|
||
exclude_patterns = ["scripts/**"] | ||
|
||
[[analyzers]] | ||
name = "go" | ||
enabled = true | ||
|
||
[analyzers.meta] | ||
import_paths = ["github.com/bhojpur/acs"] |
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,16 @@ | ||
Please use English, because others could join the discussion, if they got similar issue! | ||
|
||
Please answer these questions before submitting your issue. | ||
|
||
1. Which version of Go and Bhojpur ACS are you using (`acsctl version`)? | ||
|
||
2. Which operating system and processor architecture are you using (`go env`)? | ||
|
||
3. What did you do? | ||
|
||
If possible, provide a recipe for reproducing the error. A complete runnable program is better. | ||
Please provide the database schemas, if it is an ORM issue. | ||
|
||
4. What did you expect to see? | ||
|
||
5. What did you see instead? |
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,17 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
open-pull-requests-limit: 10 | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
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,43 @@ | ||
run: | ||
timeout: 5m | ||
skip-files: | ||
- generated.* | ||
|
||
issues: | ||
new: true | ||
|
||
linters: | ||
enable: | ||
- asciicheck | ||
- bodyclose | ||
- deadcode | ||
- depguard | ||
- gci | ||
- gocritic | ||
- gofmt | ||
- gofumpt | ||
- goimports | ||
- goprintffuncname | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- nilerr | ||
- rowserrcheck | ||
- staticcheck | ||
- structcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
- unused | ||
- unparam | ||
- varcheck | ||
- whitespace | ||
disable: | ||
- errcheck | ||
|
||
linters-settings: | ||
gci: | ||
local-prefixes: github.com/bhojpur/acs | ||
goimports: | ||
local-prefixes: github.com/bhojpur/acs |
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,154 @@ | ||
name: Unit tests | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
check-go: | ||
name: Check Go code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup Golang | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ^1.17 | ||
- name: Download all Go modules | ||
run: | | ||
go mod download | ||
- name: Check for tidyness of go.mod and go.sum | ||
run: | | ||
go mod tidy | ||
git diff --exit-code -- . | ||
build-go: | ||
name: Build & cache Go code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup Golang | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ^1.17 | ||
- name: Restore go build cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cache/go-build | ||
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }} | ||
- name: Download all Go modules | ||
run: | | ||
go mod download | ||
lint-go: | ||
name: Lint Go code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Run golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: v1.39.0 | ||
args: --timeout 5m | ||
|
||
test-go: | ||
name: Run unit tests | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build-go | ||
services: | ||
# Local registry | ||
registr: | ||
# Docker Hub image | ||
image: registry:2 | ||
ports: | ||
- 5000:5000 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup Golang | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ^1.17 | ||
- name: Restore go build cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cache/go-build | ||
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }} | ||
- name: Download and vendor all required packages | ||
run: | | ||
go mod download | ||
- name: Build the protobuf | ||
run: pushd pkg/api/v1; sudo chmod 764 ./generate.sh; popd | ||
- name: Install the latest buildkit release | ||
run: | | ||
BUILDKIT_URL="$(curl -sL https://api.github.com/repos/moby/buildkit/releases \ | ||
| jq -r 'map(select(.name|startswith("v")))|sort_by(.name)[-1].assets[]|select(.name|endswith(".linux-amd64.tar.gz")).browser_download_url')" | ||
curl -L "${BUILDKIT_URL}" | sudo tar -xz -C /usr/local | ||
- name: Start buildkit daemon | ||
run: | | ||
sudo --non-interactive --shell <<END_SUDO | ||
install -d -m 0750 -o root -g docker /run/buildkit | ||
buildkitd & | ||
while ! test -S /run/buildkit/buildkitd.sock; do sleep 0.1; done | ||
chgrp docker /run/buildkit/buildkitd.sock | ||
END_SUDO | ||
- name: Run all unit tests | ||
env: | ||
BUILDKIT_ADDR: unix:///run/buildkit/buildkitd.sock | ||
TARGET_REF: 127.0.0.1:5000 | ||
run: go test -v -coverprofile=coverage.out $(go list ./...) | ||
- name: Generate code coverage artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: code-coverage | ||
path: coverage.out | ||
|
||
test-go-race: | ||
name: Run unit tests with -race | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build-go | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup Golang | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ^1.17 | ||
- name: Restore go build cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cache/go-build | ||
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }} | ||
- name: Download and vendor all required packages | ||
run: | | ||
go mod download | ||
- name: Run all unit tests | ||
run: go test -race -v $(go list ./...) | ||
|
||
analyze: | ||
name: Process & analyze test artifacts | ||
runs-on: ubuntu-latest | ||
needs: | ||
- test-go | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Create test-results directory | ||
run: | | ||
mkdir -p test-results | ||
- name: Get code coverage artifiact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: code-coverage | ||
- name: Upload code coverage information to codecov.io | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
file: coverage.out |
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,34 @@ | ||
# This action requires that any PR targeting the master branch should touch at | ||
# least one CHANGELOG file. If a CHANGELOG entry is not required, add the "Skip | ||
# Changelog" label to disable this action. | ||
|
||
name: changelog | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, labeled, unlabeled] | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
changelog: | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.pull_request.labels.*.name, 'Skip Changelog')" | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Check for CHANGELOG changes | ||
run: | | ||
# Only the latest commit of the feature branch is available | ||
# automatically. To diff with the base branch, we need to | ||
# fetch that too (and we only need its latest commit). | ||
git fetch origin ${{ github.base_ref }} --depth=1 | ||
if [[ $(git diff --name-only FETCH_HEAD | grep CHANGELOG) ]] | ||
then | ||
echo "A CHANGELOG was modified. Looks good!" | ||
else | ||
echo "No CHANGELOG was modified." | ||
echo "Please add a CHANGELOG entry, or add the \"Skip Changelog\" label if not required." | ||
false | ||
fi |
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,26 @@ | ||
name: golangci-lint | ||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- "**/*.go" | ||
- ".github/workflows/golangci-lint.yml" | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
paths: | ||
- "**/*.go" | ||
- ".github/workflows/golangci-lint.yml" | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout codebase | ||
uses: actions/checkout@v2 | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: latest | ||
args: --config=.github/linters/.golangci.yml | ||
only-new-issues: true |
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,19 @@ | ||
name: need-feeback-issues | ||
|
||
on: | ||
schedule: | ||
- cron: "0 * * * *" # pick a cron here, this is every 1h | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: luanpotter/changes-requested@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
# these are optional, if you want to configure: | ||
days-until-close: 5 | ||
trigger-label: status/need-feedback | ||
closing-comment: This issue was closed by the need-feedback bot due to without feedbacks. | ||
dry-run: false |
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,19 @@ | ||
name: need-translation-issues | ||
|
||
on: | ||
schedule: | ||
- cron: "0 * * * *" # pick a cron here, this is every 1h | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: luanpotter/changes-requested@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
# these are optional, if you want to configure: | ||
days-until-close: 5 | ||
trigger-label: status/need-translation | ||
closing-comment: This issue was closed by the need-translation bot. Please transalate your issue to English so it could help others. | ||
dry-run: false |
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,38 @@ | ||
name: Release Go project | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" # triggers only if push new tag version, like `0.8.4` or else | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: Set up Go 1.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.17 | ||
- | ||
name: Docker Login | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
# either 'goreleaser' (default) or 'goreleaser-pro' | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Oops, something went wrong.