Skip to content

Commit 74a8a0a

Browse files
DerekBumoleg-jukovec
authored andcommitted
ci: setup ci workflow
In this commit the ci workflow is created for the repository.
1 parent 02359d7 commit 74a8a0a

File tree

5 files changed

+299
-0
lines changed

5 files changed

+299
-0
lines changed

.codespellrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[codespell]
2+
skip = */testdata,./LICENSE
3+
ignore-words-list = gost
4+
count =
5+
quiet-level = 3

.github/workflows/check.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Run checks
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
luacheck:
9+
runs-on: ubuntu-latest
10+
if: |
11+
github.event_name == 'push' ||
12+
github.event_name == 'pull_request' &&
13+
github.event.pull_request.head.repo.full_name != github.repository
14+
steps:
15+
- uses: actions/checkout@master
16+
17+
- name: Setup Tarantool
18+
uses: tarantool/setup-tarantool@v2
19+
with:
20+
tarantool-version: '2.8'
21+
22+
- name: Setup tt
23+
run: |
24+
curl -L https://tarantool.io/release/2/installer.sh | sudo bash
25+
sudo apt install -y tt
26+
tt version
27+
28+
- name: Setup luacheck
29+
run: tt rocks install luacheck 0.25.0
30+
31+
- name: Run luacheck
32+
run: ./.rocks/bin/luacheck .
33+
34+
golangci-lint:
35+
runs-on: ubuntu-latest
36+
if: |
37+
github.event_name == 'push' ||
38+
github.event_name == 'pull_request' &&
39+
github.event.pull_request.head.repo.full_name != github.repository
40+
steps:
41+
- uses: actions/setup-go@v2
42+
43+
- uses: actions/checkout@v2
44+
45+
- name: golangci-lint
46+
uses: golangci/golangci-lint-action@v3
47+
continue-on-error: true
48+
with:
49+
# The first run is for GitHub Actions error format.
50+
args: --config=.golangci-lint.yaml
51+
52+
- name: golangci-lint
53+
uses: golangci/golangci-lint-action@v3
54+
with:
55+
# The second run is for human-readable error format with a file name
56+
# and a line number.
57+
args: --out-${NO_FUTURE}format colored-line-number --config=.golangci-lint.yaml
58+
59+
codespell:
60+
runs-on: ubuntu-latest
61+
if: |
62+
github.event_name == 'push' ||
63+
github.event_name == 'pull_request' &&
64+
github.event.pull_request.head.repo.full_name != github.repository
65+
steps:
66+
- uses: actions/checkout@master
67+
68+
- name: Install codespell
69+
run: pip3 install codespell
70+
71+
- name: Run codespell
72+
run: codespell

.github/workflows/testing.yml

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
name: testing
2+
3+
on:
4+
push:
5+
pull_request:
6+
pull_request_target:
7+
types: [labeled]
8+
workflow_dispatch:
9+
10+
jobs:
11+
run-tests-ee:
12+
# Does not run on pull requests from forks and on forks by default.
13+
# Tests from forks will run only when the pull request is labeled with
14+
# `full-ci`. To avoid security problems, the label must be reset manually
15+
# for every run.
16+
#
17+
# We need to use `pull_request_target` because it has access to base
18+
# repository secrets unlike `pull_request`.
19+
if: |
20+
github.repository == 'tarantool/go-tlsdialer' &&
21+
(github.event_name == 'push' ||
22+
(github.event_name == 'pull_request_target' &&
23+
github.event.pull_request.head.repo.full_name != github.repository &&
24+
github.event.label.name == 'full-ci')) ||
25+
github.event_name == 'workflow_dispatch'
26+
27+
runs-on: ubuntu-latest
28+
29+
env:
30+
COVERAGE_FILE: 'coverage.out'
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
golang:
36+
- '1.20'
37+
- 'stable'
38+
sdk-path:
39+
- 'release/linux/x86_64/2.10/'
40+
sdk-version:
41+
- 'sdk-gc64-2.10.8-0-r598.linux.x86_64'
42+
coveralls: [ false ]
43+
include:
44+
- golang: '1.20'
45+
sdk-path: 'release/linux/x86_64/2.11/'
46+
sdk-version: 'sdk-gc64-2.11.1-0-r598.linux.x86_64'
47+
coveralls: false
48+
- golang: 'stable'
49+
sdk-path: 'release/linux/x86_64/2.11/'
50+
sdk-version: 'sdk-gc64-2.11.1-0-r598.linux.x86_64'
51+
coveralls: false
52+
- golang: '1.20'
53+
sdk-path: 'release/linux/x86_64/3.0/'
54+
sdk-version: 'sdk-gc64-3.0.0-0-gf58f7d82a-r23.linux.x86_64'
55+
coveralls: false
56+
- golang: 'stable'
57+
sdk-path: 'release/linux/x86_64/3.0/'
58+
sdk-version: 'sdk-gc64-3.0.0-0-gf58f7d82a-r23.linux.x86_64'
59+
coveralls: true
60+
61+
steps:
62+
- uses: actions/checkout@v3
63+
64+
- name: Setup Tarantool ${{ matrix.sdk-version }}
65+
run: |
66+
ARCHIVE_NAME=tarantool-enterprise-${{ matrix.sdk-version }}.tar.gz
67+
curl -O -L https://${{ secrets.SDK_DOWNLOAD_TOKEN }}@download.tarantool.io/enterprise/${{ matrix.sdk-path }}${ARCHIVE_NAME}
68+
tar -xzf ${ARCHIVE_NAME}
69+
rm -f ${ARCHIVE_NAME}
70+
71+
- name: Setup golang for the connector and tests
72+
uses: actions/setup-go@v3
73+
with:
74+
go-version: ${{matrix.golang}}
75+
76+
- name: Run regression tests
77+
run: |
78+
source tarantool-enterprise/env.sh
79+
go test -v -count=1 -shuffle=on ./...
80+
go test -race -v -count=1 -shuffle=on ./...
81+
82+
- name: Run tests, collect code coverage data and send to Coveralls
83+
if: ${{ matrix.coveralls }}
84+
env:
85+
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
run: |
87+
source tarantool-enterprise/env.sh
88+
go clean -testcache
89+
go get golang.org/x/tools/cmd/cover
90+
go test ./... -v -count=1 -shuffle=on -covermode=atomic -coverprofile=${COVERAGE_FILE}
91+
go tool cover -func=${COVERAGE_FILE}
92+
go get github.com/mattn/goveralls
93+
go install github.com/mattn/goveralls
94+
goveralls -coverprofile=${COVERAGE_FILE} -service=github
95+
96+
testing_mac_os:
97+
# We want to run on external PRs, but not on our own internal
98+
# PRs as they'll be run by the push to the branch.
99+
#
100+
# The main trick is described here:
101+
# https://github.com/Dart-Code/Dart-Code/pull/2375
102+
if: |
103+
github.repository == 'tarantool/go-tlsdialer' &&
104+
(github.event_name == 'push' ||
105+
(github.event_name == 'pull_request_target' &&
106+
github.event.pull_request.head.repo.full_name != github.repository &&
107+
github.event.label.name == 'full-ci')) ||
108+
github.event_name == 'workflow_dispatch'
109+
110+
strategy:
111+
fail-fast: false
112+
matrix:
113+
golang:
114+
- '1.20'
115+
- 'stable'
116+
runs-on:
117+
- macos-11
118+
- macos-12
119+
tarantool-ee:
120+
- 'gc64-2.11.2-0-r613'
121+
122+
env:
123+
# Set as absolute paths to avoid any possible confusion
124+
# after changing a current directory.
125+
SRCDIR: ${{ format('{0}/{1}', github.workspace, github.repository) }}
126+
127+
runs-on: ${{ matrix.runs-on }}
128+
steps:
129+
- name: Clone the connector
130+
uses: actions/checkout@v3
131+
with:
132+
path: ${{ env.SRCDIR }}
133+
134+
- name: Install latest tt from brew
135+
run: brew install tt
136+
137+
- name: Install tarantool
138+
env:
139+
TT_CLI_EE_USERNAME: ${{ secrets.TT_EE_USERNAME }}
140+
TT_CLI_EE_PASSWORD: ${{ secrets.TT_EE_PASSWORD }}
141+
run: |
142+
tt init
143+
tt -V install tarantool-ee ${{ matrix.tarantool-ee }}
144+
# Delete the tt config so that it does not affect the test environment.
145+
rm -f tt.yaml
146+
147+
- name: Add Tarantool to Path
148+
run: |
149+
echo "${GITHUB_WORKSPACE}/bin" >> $GITHUB_PATH
150+
151+
- name: Set Tarantool include directory to the environment
152+
run: |
153+
echo "TT_CLI_TARANTOOL_PREFIX=${GITHUB_WORKSPACE}/include/" >> $GITHUB_ENV
154+
155+
- name: Setup golang for the connector and tests
156+
uses: actions/setup-go@v3
157+
with:
158+
go-version: ${{ matrix.golang }}
159+
160+
# Workaround for Mac OS 12 testrace failure
161+
# https://github.com/golang/go/issues/49138
162+
- name: disable MallocNanoZone for macos-12
163+
run: echo "MallocNanoZone=0" >> $GITHUB_ENV
164+
if: matrix.runs-on == 'macos-12'
165+
166+
- name: Install test dependencies
167+
run: |
168+
brew install tt
169+
170+
- name: Run regression tests
171+
run: |
172+
cd "${SRCDIR}"
173+
go test -v -count=1 -shuffle=on ./...
174+
go test -race -v -count=1 -shuffle=on ./...

.golangci-lint.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
run:
2+
timeout: 3m
3+
4+
linters:
5+
enable:
6+
- errorlint
7+
- forbidigo
8+
- gocritic
9+
- godot
10+
- goimports
11+
- lll
12+
- reassign
13+
- revive
14+
- stylecheck
15+
- testpackage
16+
- unconvert
17+
- unused
18+
19+
linters-settings:
20+
lll:
21+
line-length: 100
22+
tab-width: 4
23+
24+
issues:
25+
exclude-rules:
26+
- linters:
27+
- lll
28+
source: "\t?// *(see )?https://"

.luacheckrc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
redefined = false
2+
3+
globals = {
4+
'box',
5+
'utf8',
6+
'checkers',
7+
'_TARANTOOL'
8+
}
9+
10+
include_files = {
11+
'**/*.lua',
12+
'*.luacheckrc',
13+
'*.rockspec'
14+
}
15+
16+
exclude_files = {
17+
'**/*.rocks/'
18+
}
19+
20+
max_line_length = 120

0 commit comments

Comments
 (0)