-
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
Showing
3 changed files
with
135 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,18 @@ | ||
|
||
<!--- Provide a general summary of your changes in the Title above --> | ||
|
||
## Why did we need it? | ||
<!--- Describe your changes in detail --> | ||
|
||
## Related Issue | ||
<!--- This project only accepts pull requests related to open issues --> | ||
<!--- If suggesting a new feature or change, please discuss it in an issue first --> | ||
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce --> | ||
<!--- Please link to the issue here: --> | ||
|
||
## How Has This Been Tested? | ||
<!--- Please describe in detail how you tested your changes. --> | ||
<!--- Include details of your testing environment, and the tests you ran to --> | ||
<!--- see how your change affects other areas of the code, etc. --> | ||
|
||
## Screenshots (if appropriate): |
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,50 @@ | ||
name: Go Project CI | ||
|
||
concurrency: | ||
group: ci-workflow-${{ github.ref }}-${{ github.event_name }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
- release-v** | ||
pull_request: | ||
|
||
env: | ||
SERVICE: logger | ||
|
||
jobs: | ||
lint: | ||
name: Run golangci-lint | ||
runs-on: [ ubuntu-22.04 ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.19.x" | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.52.2 | ||
skip-pkg-cache: true | ||
skip-build-cache: true | ||
args: --timeout=2m | ||
test: | ||
runs-on: [ ubuntu-22.04 ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.19.x" | ||
- name: Run tests | ||
run: go test -race -coverprofile cover.out -vet=off ./... | ||
|
||
- name: Print coverage | ||
run: | | ||
go tool cover -func cover.out | grep total | awk '{notice="Statement Coverage: " substr($3, 1, length($3))} END {print notice}' |
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,67 @@ | ||
name: 'Release' | ||
|
||
permissions: write-all | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Release version' | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
prepare: | ||
runs-on: [ ubuntu-22.04 ] | ||
outputs: | ||
version_tag: ${{ steps.version_tag.outputs.value }} | ||
build_date: ${{ steps.build_date.outputs.value }} | ||
steps: | ||
- name: Format version tag | ||
shell: bash | ||
id: version_tag | ||
env: | ||
INPUT_TAG: ${{ github.event.inputs.version }} | ||
run: | | ||
TAG=${INPUT_TAG#v} | ||
echo "::set-output name=value::v$TAG" | ||
- name: Build date | ||
shell: bash | ||
id: build_date | ||
run: echo "::set-output name=value::$(date +%FT%T%z)" | ||
|
||
release: | ||
needs: | ||
- prepare | ||
runs-on: [ ubuntu-22.04 ] | ||
env: | ||
VERSION_TAG: ${{ needs.prepare.outputs.version_tag }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.19.x" | ||
|
||
- name: Setup Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Create tag | ||
run: | | ||
git tag -d "$VERSION_TAG" 2> /dev/null || echo "Release tag '$VERSION_TAG' does NOT exist" | ||
git tag --annotate --message "dmm-aggregator-backend $VERSION_TAG" "$VERSION_TAG" | ||
git push origin "refs/tags/$VERSION_TAG" | ||
- name: Create release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag_name: ${{ env.VERSION_TAG }} | ||
prerelease: false | ||
name: "Logger ${{ env.VERSION_TAG }}" |