Skip to content

go-tlsdialer: initial repository setup #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[codespell]
skip = */testdata,./LICENSE
ignore-words-list = gost
count =
quiet-level = 3
72 changes: 72 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Run checks

on:
push:
pull_request:

jobs:
luacheck:
runs-on: ubuntu-latest
if: |
github.event_name == 'push' ||
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@master

- name: Setup Tarantool
uses: tarantool/setup-tarantool@v2
with:
tarantool-version: '2.8'

- name: Setup tt
run: |
curl -L https://tarantool.io/release/2/installer.sh | sudo bash
sudo apt install -y tt
tt version

- name: Setup luacheck
run: tt rocks install luacheck 0.25.0

- name: Run luacheck
run: ./.rocks/bin/luacheck .

golangci-lint:
runs-on: ubuntu-latest
if: |
github.event_name == 'push' ||
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/setup-go@v2

- uses: actions/checkout@v2

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
continue-on-error: true
with:
# The first run is for GitHub Actions error format.
args: --config=.golangci-lint.yaml

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# The second run is for human-readable error format with a file name
# and a line number.
args: --out-${NO_FUTURE}format colored-line-number --config=.golangci-lint.yaml

codespell:
runs-on: ubuntu-latest
if: |
github.event_name == 'push' ||
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@master

- name: Install codespell
run: pip3 install codespell

- name: Run codespell
run: codespell
174 changes: 174 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
name: testing

on:
push:
pull_request:
pull_request_target:
types: [labeled]
workflow_dispatch:

jobs:
run-tests-ee:
# Does not run on pull requests from forks and on forks by default.
# Tests from forks will run only when the pull request is labeled with
# `full-ci`. To avoid security problems, the label must be reset manually
# for every run.
#
# We need to use `pull_request_target` because it has access to base
# repository secrets unlike `pull_request`.
if: |
github.repository == 'tarantool/go-tlsdialer' &&
(github.event_name == 'push' ||
(github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
github.event.label.name == 'full-ci')) ||
github.event_name == 'workflow_dispatch'

runs-on: ubuntu-latest

env:
COVERAGE_FILE: 'coverage.out'

strategy:
fail-fast: false
matrix:
golang:
- '1.20'
- 'stable'
sdk-path:
- 'release/linux/x86_64/2.10/'
sdk-version:
- 'sdk-gc64-2.10.8-0-r598.linux.x86_64'
coveralls: [ false ]
include:
- golang: '1.20'
sdk-path: 'release/linux/x86_64/2.11/'
sdk-version: 'sdk-gc64-2.11.1-0-r598.linux.x86_64'
coveralls: false
- golang: 'stable'
sdk-path: 'release/linux/x86_64/2.11/'
sdk-version: 'sdk-gc64-2.11.1-0-r598.linux.x86_64'
coveralls: false
- golang: '1.20'
sdk-path: 'release/linux/x86_64/3.0/'
sdk-version: 'sdk-gc64-3.0.0-0-gf58f7d82a-r23.linux.x86_64'
coveralls: false
- golang: 'stable'
sdk-path: 'release/linux/x86_64/3.0/'
sdk-version: 'sdk-gc64-3.0.0-0-gf58f7d82a-r23.linux.x86_64'
coveralls: true

steps:
- uses: actions/checkout@v3

- name: Setup Tarantool ${{ matrix.sdk-version }}
run: |
ARCHIVE_NAME=tarantool-enterprise-${{ matrix.sdk-version }}.tar.gz
curl -O -L https://${{ secrets.SDK_DOWNLOAD_TOKEN }}@download.tarantool.io/enterprise/${{ matrix.sdk-path }}${ARCHIVE_NAME}
tar -xzf ${ARCHIVE_NAME}
rm -f ${ARCHIVE_NAME}

- name: Setup golang for the connector and tests
uses: actions/setup-go@v3
with:
go-version: ${{matrix.golang}}

- name: Run regression tests
run: |
source tarantool-enterprise/env.sh
go test -v -count=1 -shuffle=on ./...
go test -race -v -count=1 -shuffle=on ./...

- name: Run tests, collect code coverage data and send to Coveralls
if: ${{ matrix.coveralls }}
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
source tarantool-enterprise/env.sh
go clean -testcache
go get golang.org/x/tools/cmd/cover
go test ./... -v -count=1 -shuffle=on -covermode=atomic -coverprofile=${COVERAGE_FILE}
go tool cover -func=${COVERAGE_FILE}
go get github.com/mattn/goveralls
go install github.com/mattn/goveralls
goveralls -coverprofile=${COVERAGE_FILE} -service=github

testing_mac_os:
# We want to run on external PRs, but not on our own internal
# PRs as they'll be run by the push to the branch.
#
# The main trick is described here:
# https://github.com/Dart-Code/Dart-Code/pull/2375
if: |
github.repository == 'tarantool/go-tlsdialer' &&
(github.event_name == 'push' ||
(github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
github.event.label.name == 'full-ci')) ||
github.event_name == 'workflow_dispatch'

strategy:
fail-fast: false
matrix:
golang:
- '1.20'
- 'stable'
runs-on:
- macos-11
- macos-12
tarantool-ee:
- 'gc64-2.11.2-0-r613'

env:
# Set as absolute paths to avoid any possible confusion
# after changing a current directory.
SRCDIR: ${{ format('{0}/{1}', github.workspace, github.repository) }}

runs-on: ${{ matrix.runs-on }}
steps:
- name: Clone the connector
uses: actions/checkout@v3
with:
path: ${{ env.SRCDIR }}

- name: Install latest tt from brew
run: brew install tt

- name: Install tarantool
env:
TT_CLI_EE_USERNAME: ${{ secrets.TT_EE_USERNAME }}
TT_CLI_EE_PASSWORD: ${{ secrets.TT_EE_PASSWORD }}
run: |
tt init
tt -V install tarantool-ee ${{ matrix.tarantool-ee }}
# Delete the tt config so that it does not affect the test environment.
rm -f tt.yaml

- name: Add Tarantool to Path
run: |
echo "${GITHUB_WORKSPACE}/bin" >> $GITHUB_PATH

- name: Set Tarantool include directory to the environment
run: |
echo "TT_CLI_TARANTOOL_PREFIX=${GITHUB_WORKSPACE}/include/" >> $GITHUB_ENV

- name: Setup golang for the connector and tests
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.golang }}

# Workaround for Mac OS 12 testrace failure
# https://github.com/golang/go/issues/49138
- name: disable MallocNanoZone for macos-12
run: echo "MallocNanoZone=0" >> $GITHUB_ENV
if: matrix.runs-on == 'macos-12'

- name: Install test dependencies
run: |
brew install tt

- name: Run regression tests
run: |
cd "${SRCDIR}"
go test -v -count=1 -shuffle=on ./...
go test -race -v -count=1 -shuffle=on ./...
28 changes: 28 additions & 0 deletions .golangci-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
run:
timeout: 3m

linters:
enable:
- errorlint
- forbidigo
- gocritic
- godot
- goimports
- lll
- reassign
- revive
- stylecheck
- testpackage
- unconvert
- unused

linters-settings:
lll:
line-length: 100
tab-width: 4

issues:
exclude-rules:
- linters:
- lll
source: "\t?// *(see )?https://"
20 changes: 20 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
redefined = false

globals = {
'box',
'utf8',
'checkers',
'_TARANTOOL'
}

include_files = {
'**/*.lua',
'*.luacheckrc',
'*.rockspec'
}

exclude_files = {
'**/*.rocks/'
}

max_line_length = 120
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic
Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.

## [Unreleased]

### Added

* `OpenSSLDialer` type to use SSL transport for `tarantool/go-tarantool/v2`
connection (#1).

### Changed

### Removed

### Fixed
Loading