-
Notifications
You must be signed in to change notification settings - Fork 1
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
81bbd60
commit c02324d
Showing
14 changed files
with
480 additions
and
11 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
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
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,60 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
workdir: | ||
required: false | ||
default: "./" | ||
type: "string" | ||
description: "Specify all of steps where are run" | ||
GOOS: | ||
required: false | ||
default: "linux" | ||
type: "string" | ||
description: "GOOS target os" | ||
GOARCH: | ||
required: true | ||
type: "string" | ||
description: "GOARCH arch" | ||
ENTRANCE: | ||
required: false | ||
default: "main.go" | ||
type: string | ||
description: "main.go relative path" | ||
|
||
outputs: | ||
version: | ||
description: "Rust application version" | ||
value: ${{ jobs.build.outputs.version }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ${{ inputs.workdir }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
- name: test | ||
run: go test ./... -v -cover -coverprofile=coverage.out && go tool cover -html=coverage.out -o coverage.html | ||
- name: build binary | ||
run: | | ||
echo "$GOOS" | ||
echo "$GOARCH" | ||
mkdir build | ||
CGO_ENABLE=0 GOOS=linux GOARCH=amd64 go build -a -o build/${{ github.repository }} ${{ inputs.ENTRANCE }} | ||
- id: environments | ||
name: environments | ||
run: | | ||
echo " | ||
project=${{ github.repository }} | ||
version=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null) | ||
" >> "$GITHUB_OUTPUT" | ||
- name: upload target | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: target | ||
path: | | ||
${{ inputs.workdir }}build/${{ steps.environments.outputs.project }} |
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,74 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
workdir: | ||
required: false | ||
default: "./" | ||
type: "string" | ||
description: "Specify all of steps where are run" | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ${{ inputs.workdir }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
- name: build dependencies | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.1 | ||
curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.18.2 | ||
golangci-lint version | ||
- name: cache dependencies cache | ||
id: heliannuuthus-cargo-cache | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: | | ||
~/go | ||
key: ${{ runner.os }}-heliannuuthus-golang-cache | ||
|
||
lint: | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ${{ inputs.workdir }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
- name: cache registry cache | ||
id: heliannuuthus-golang-cache | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: | | ||
~/go | ||
key: ${{ runner.os }}-heliannuuthus-golang-cache | ||
- name: golangci-lint | ||
run: go version && tree $(go env GOPATH)/bin && golangci-lint -vv | ||
|
||
security: | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ${{ inputs.workdir }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
- name: cache registry cache | ||
id: heliannuuthus-golang-cache | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: | | ||
~/go | ||
key: ${{ runner.os }}-heliannuuthus-golang-cache | ||
- name: gosec checkout | ||
run: go version && tree $(go env GOPATH)/bin && gosec -fmt=sarif -out=gosec.sarif ./... |
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
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
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
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,30 @@ | ||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
lint: | ||
uses: ./.github/workflows/call-golang-lint.yml | ||
with: | ||
workdir: "tests/golang/" | ||
|
||
|
||
build: | ||
uses: ./.github/workflows/call-golang-build.yml | ||
with: | ||
workdir: "tests/golang/" | ||
GOOS: linux | ||
GOARCH: amd64 | ||
ENTRANCE: cmd/main.go | ||
|
||
|
||
containeraized: | ||
needs: build | ||
permissions: | ||
contents: read | ||
packages: write | ||
uses: ./.github/workflows/call-containerize.yml | ||
with: | ||
version: ${{ needs.build.outputs.version }} | ||
workdir: "tests/golang/" | ||
target: "tests/golang/build" |
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
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,117 @@ | ||
run: | ||
# The default concurrency value is the number of available CPU. | ||
concurrency: 4 | ||
# Timeout for analysis, e.g. 30s, 5m. | ||
# Default: 1m | ||
timeout: 5m | ||
# Exit code when at least one issue was found. | ||
# Default: 1 | ||
issues-exit-code: 2 | ||
go: '1.20' | ||
output: | ||
path-prefix: "" | ||
linters: | ||
# Disable all linters. | ||
# Default: false | ||
disable-all: true | ||
enable: | ||
- asasalint | ||
- asciicheck | ||
- bidichk | ||
- bodyclose | ||
- containedctx | ||
- contextcheck | ||
- cyclop | ||
- decorder | ||
- dogsled | ||
- dupl | ||
- dupword | ||
- durationcheck | ||
- errcheck | ||
- errchkjson | ||
- errname | ||
- errorlint | ||
- execinquery | ||
- exhaustive | ||
- exhaustruct | ||
- exportloopref | ||
- forbidigo | ||
- funlen | ||
- gci | ||
- ginkgolinter | ||
- gocheckcompilerdirectives | ||
- gochecknoinits | ||
- gochecksumtype | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- godot | ||
- godox | ||
- goerr113 | ||
- gofmt | ||
- gofumpt | ||
- goheader | ||
- goimports | ||
- gomnd | ||
- gomoddirectives | ||
- gomodguard | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- gosmopolitan | ||
- govet | ||
- grouper | ||
- importas | ||
- inamedparam | ||
- ineffassign | ||
- interfacebloat | ||
- ireturn | ||
- lll | ||
- loggercheck | ||
- maintidx | ||
- makezero | ||
- mirror | ||
- misspell | ||
- musttag | ||
- nakedret | ||
- nestif | ||
- nilerr | ||
- nilnil | ||
- nlreturn | ||
- noctx | ||
- nolintlint | ||
- nonamedreturns | ||
- nosprintfhostport | ||
- paralleltest | ||
- perfsprint | ||
- prealloc | ||
- predeclared | ||
- promlinter | ||
- protogetter | ||
- reassign | ||
- revive | ||
- rowserrcheck | ||
- sloglint | ||
- sqlclosecheck | ||
- staticcheck | ||
- stylecheck | ||
- tagalign | ||
- tagliatelle | ||
- tenv | ||
- testableexamples | ||
- testifylint | ||
- testpackage | ||
- thelper | ||
- tparallel | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- usestdlibvars | ||
- wastedassign | ||
- whitespace | ||
- wrapcheck | ||
- wsl | ||
- zerologlint | ||
fast: 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,7 @@ | ||
FROM rust:latest | ||
|
||
WORKDIR / | ||
|
||
COPY build/workflow . | ||
|
||
CMD ["./workflow"] |
Oops, something went wrong.