Skip to content

Commit

Permalink
github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
vodolaz095 committed Aug 24, 2024
1 parent 3f7ba6b commit 87b9010
Show file tree
Hide file tree
Showing 5 changed files with 195 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: ['https://www.tinkoff.ru/rm/ostroumov.anatoliy2/4HFzm76801/']
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

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

**Application version**
Version identifier as reported in stdout or on main dashboard page. Something like this
```
14:06:00 INF main.go:60 > Starting dashboard v development. GOOS: linux. ARCH: amd64. Go Version: go1.22.0. Please, report bugs here: https://github.com/vodolaz095/dashboard/issues
```

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

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

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
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.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
95 changes: 95 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: make release

on:
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
services:

redis:
image: mirror.gcr.io/redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.6'
cache-dependency-path: go.sum

- name: install govulncheck utility
run: go install golang.org/x/vuln/cmd/govulncheck@latest

- name: scan for vulnerable packages
run: make vuln

- name: run unit test
env:
REDIS_URL: redis://127.0.0.1:6379
run: make test

- name: build binary for linux on AMD64
env:
GOOS: linux
CGO_ENABLED: 0
GOARCH: amd64
run: go build -ldflags "-X main.Version=${{ github.sha }}" -o build/stocks_broadcaster_linux_amd64 main.go

- name: build binary for linux on ARM 6
env:
GOOS: linux
CGO_ENABLED: 0
GOARCH: arm
GOARM: 6
run: go build -ldflags "-X main.Version=${{ github.sha }}" -o build/stocks_broadcaster_linux_arm6 main.go

- name: build binary for linux on ARM 7
env:
GOOS: linux
CGO_ENABLED: 0
GOARCH: arm
GOARM: 7
run: go build -ldflags "-X main.Version=${{ github.sha }}" -o build/stocks_broadcaster_linux_arm7 main.go

- name: build binary for windows on amd64
env:
GOOS: windows
CGO_ENABLED: 0
GOARCH: amd64
run: go build -ldflags "-X main.Version=${{ github.sha }}" -o build/stocks_broadcaster.exe main.go

- name: build binary for macos on amd64
env:
GOOS: darwin
GOARCH: amd64
CGO_ENABLED: 0
run: go build -ldflags "-X main.Version=${{ github.sha }}" -o build/stocks_broadcaster_darwin_amd64 main.go

- name: make md5 signature file
run: md5sum build/* > build/stocks_broadcaster.md5

- name: expose build result
run: ls -l build/

- name: release
uses: ncipollo/release-action@v1
with:
draft: true
name: "Temporary release"
body: "Code is generated from commit https://github.com/vodolaz095/stocks_broadcaster/commit/${{ github.sha }}"
generateReleaseNotes: true
commit: "${{ github.sha }}"
tag: "${{ github.ref }}"
artifacts: "build/stocks_broadcaster*"
46 changes: 46 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: unit test

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:

test:
runs-on: ubuntu-latest
services:

redis:
image: mirror.gcr.io/redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.6'
cache-dependency-path: go.sum

- name: install govulncheck utility
run: go install golang.org/x/vuln/cmd/govulncheck@latest

- name: scan for vulnerable packages
run: make vuln

- name: run unit test
env:
REDIS_URL: redis://127.0.0.1:6379
run: make test

0 comments on commit 87b9010

Please sign in to comment.