Skip to content

Commit

Permalink
Merge pull request #2 from ydb-platform/fixes
Browse files Browse the repository at this point in the history
fixes
  • Loading branch information
asmyasnikov authored Aug 29, 2023
2 parents d7c7801 + abc231c commit a8e689e
Show file tree
Hide file tree
Showing 33 changed files with 3,750 additions and 411 deletions.
42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/01_BUG_REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Bug Report
about: Create a report to help YDB GO SDK to improve
title: "bug: "
labels: "bug"
assignees: ""

---

# Bug Report

**YDB GO SDK version:**

<!-- Please specify commit or tag version. -->

**Environment**

<!-- Please specify Operation System, CPU arcitecture -->

**Current behavior:**

<!-- Describe how the bug manifests. -->

**Expected behavior:**

<!-- Describe what the behavior would be without the bug. -->

**Steps to reproduce:**

<!-- Please explain the steps required to duplicate the issue, especially if you are able to provide a sample application. -->

**Related code:**

<!-- If you are able to illustrate the bug or feature request with an example, please provide it here. -->

```
insert short code snippets here
```

**Other information:**

<!-- List any other information that is relevant to your issue. Related issues, suggestions on how to fix, Stack Overflow links, forum links, etc. -->
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/02_FEATURE_REQUEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Feature Request
about: Suggest an idea for this project
title: "feat: "
labels: "enhancement"
assignees: ""

---

# Feature Request

**Describe the Feature Request**

<!-- A clear and concise description of what the feature request is. Please include if your feature request is related to a problem. -->

**Describe Preferred Solution**

<!-- A clear and concise description of what you want to happen. -->

**Describe Alternatives**

<!-- A clear and concise description of any alternative solutions or features you've considered. -->

**Related Code**

<!-- If you are able to illustrate the bug or feature request with an example, please provide it here. -->

**Additional Context**

<!-- List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to add, use case, Stack Overflow links, forum links, screenshots, OS if applicable, etc. -->

**If the feature request is approved, would you be willing to submit a PR?**
Yes / No _(Help can be provided if you need assistance submitting a PR)_
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/03_CODEBASE_IMPROVEMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: Codebase improvement
about: Provide your feedback for the existing codebase. Suggest a better solution for algorithms, development tools, etc.
title: "dev: "
labels: "enhancement"
assignees: ""

---
35 changes: 35 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

<!--- Please provide a general summary of your changes in the title above -->

## Pull request type

<!-- Please try to limit your pull request to one types, submit multiple pull requests if needed. -->

Please check the type of change your PR introduces:

- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other (please describe):

## What is the current behavior?

<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->

Issue Number: N/A

## What is the new behavior?

<!-- Please describe the behavior or changes that are being added by this PR. -->

-
-
-

## Other information

<!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
20 changes: 20 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: changelog
on:
pull_request_target:
jobs:
changelog:
name: changelog
concurrency:
group: changelog-${{ github.ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Changelog updated
uses: Zomzog/[email protected]
with:
fileName: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79 changes: 79 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches:
- master
- release-*
pull_request:
# The branches below must be a subset of the branches above
branches:
- master
- release-*
schedule:
- cron: '36 3 * * 0'

jobs:
analyze:
name: Analyze
concurrency:
group: codeql-${{ github.ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
21 changes: 21 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: lint
on:
push:
branches:
- master
- release-*
pull_request:
workflow_dispatch:
jobs:
golangci:
name: golangci-lint
concurrency:
group: lint-golangci-${{ github.ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.0
83 changes: 83 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: publish
on:
workflow_dispatch:
inputs:
version-change:
description: Version part
required: true
type: choice
options:
- PATCH
- MINOR
release-candidate:
description: Release candidate
required: true
type: boolean
default: True

permissions:
contents: write

jobs:
publish:
runs-on: ubuntu-latest
env:
VERSION_CHANGE: ${{ github.event.inputs.version-change }}
RELEASE_CANDIDATE: ${{ github.event.inputs.release-candidate }}
VERSION_FILE: version.go
CHANGELOG_FILE: CHANGELOG.md
GITHUB_TOKEN: ${{ secrets.YDB_PLATFORM_BOT_TOKEN_REPO }}
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.YDB_PLATFORM_BOT_TOKEN_REPO }}
fetch-depth: 0
- run: |
CHANGELOG=$(cat $CHANGELOG_FILE | sed -e '/^## v.*$/,$d')
if [[ -z "$CHANGELOG" ]]
then
echo "CHANGELOG empty"
exit 1;
fi;
MAJOR=$(cat $VERSION_FILE | grep Major | sed -e 's/^.*\ \(=\ \)*\(\"\)*\([0-9]*\)\(\"\)*.*/\3/g');
MINOR=$(cat $VERSION_FILE | grep Minor | sed -e 's/^.*\ \(=\ \)*\(\"\)*\([0-9]*\)\(\"\)*.*/\3/g');
PATCH=$(cat $VERSION_FILE | grep Patch | sed -e 's/^.*\ \(=\ \)*\(\"\)*\([0-9]*\)\(\"\)*.*/\3/g');
LAST_TAG="v$MAJOR.$MINOR.$PATCH";
if [ "$VERSION_CHANGE" = "MINOR" ]
then
MINOR=$((MINOR+1));
PATCH=0;
fi;
if [ "$VERSION_CHANGE" = "PATCH" ]
then
PATCH=$((PATCH+1));
fi;
if [ "$RELEASE_CANDIDATE" = true ]
then
RC=$(git tag | grep "v$MAJOR.$MINOR.$PATCH-rc" | wc -l);
TAG="v$MAJOR.$MINOR.$PATCH-rc$RC";
else
sed -e 's/Minor = "\([0-9]*\)"/Minor = "'$MINOR'"/g' -i $VERSION_FILE;
sed -e 's/Patch = "\([0-9]*\)"/Patch = "'$PATCH'"/g' -i $VERSION_FILE;
git add $VERSION_FILE;
echo "## v$MAJOR.$MINOR.$PATCH" >> $CHANGELOG_FILE.tmp
cat $CHANGELOG_FILE >> $CHANGELOG_FILE.tmp
mv $CHANGELOG_FILE.tmp $CHANGELOG_FILE;
git add $CHANGELOG_FILE;
git config --global user.email "robot@umbrella";
git config --global user.name "robot";
git commit -m "Release v$MAJOR.$MINOR.$PATCH";
TAG="v$MAJOR.$MINOR.$PATCH";
fi;
git tag $TAG
git push --tags && git push
CHANGELOG="$CHANGELOG
Full Changelog: [$LAST_TAG...$TAG](https://github.com/ydb-platform/ydb-go-sdk/compare/$LAST_TAG...$TAG)"
if [ "$RELEASE_CANDIDATE" = true ]
then
gh release create -d $TAG -t "$TAG" --notes "$CHANGELOG"
else
gh release create $TAG -t "$TAG" --notes "$CHANGELOG"
fi;
37 changes: 37 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: tests
on:
push:
branches:
- master
- release-*
pull_request:
workflow_dispatch:
jobs:
unit:
concurrency:
group: unit-${{ github.ref }}-${{ matrix.os }}-${{ matrix.go-version }}
cancel-in-progress: true
strategy:
matrix:
go-version: [1.20.x]
os: [ubuntu, windows, macOS]
env:
OS: ${{ matrix.os }}-latest
GO: ${{ matrix.go-version }}
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Test
run: go test -race -coverprofile unit.txt -covermode atomic ./...
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
file: ./unit.txt
flags: unit,${{ matrix.os }},go-${{ matrix.go-version }}
name: unit
Loading

0 comments on commit a8e689e

Please sign in to comment.