Skip to content

Commit

Permalink
ci: setup pipeline
Browse files Browse the repository at this point in the history
Closes #4
  • Loading branch information
askalt committed Jul 17, 2023
1 parent 030cc7f commit 31bb64d
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 62 deletions.
15 changes: 15 additions & 0 deletions .github/actions/prepare-test-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Prepare test environment"
description: "Prepares test environment"

runs:
using: "composite"
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '${{ env.PYTHON_VERSION }}'
29 changes: 29 additions & 0 deletions .github/actions/static-code-check/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Run static code check"
description: "Performs static code checks."

runs:
using: "composite"
steps:
- name: Setup virtual environment
run: |
python3 -m venv venv
./venv/bin/activate
- name: Install tests requirements
run: |
pip3 install -r test/requirements.txt
shell: bash

- name: Log versions
run: |
go version
shell: bash

- name: Go Linter
uses: golangci/golangci-lint-action@v3
with:
args: --config=golangci-lint.yml --out-${NO_FUTURE}format colored-line-number
skip-cache: true

- name: Python Linter
run: python3 -m flake8 test
shell: bash
62 changes: 0 additions & 62 deletions .github/workflows/test.yml

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: Tests

on: [push, pull_request]

env:
GO_VERSION: 1.14
PYTHON_VERSION: '3.x'

jobs:
tests:
if: |
(github.event_name == 'push') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.owner.login != 'tarantool')
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master

- name: Prepare env
uses: ./.github/actions/prepare-test-env

- name: Static code check
uses: ./.github/actions/static-code-check

- name: Unit tests
run: make test

- name: Integration tests
run: make integration

tests-mac-os:
if: |
(github.event_name == 'push') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.owner.login != 'tarantool')
runs-on: macos-12
steps:
- uses: actions/checkout@master

- name: Prepare env
uses: ./.github/actions/prepare-test-env

- name: Install additional dependencies
run: brew install tmux

- name: Static code check
uses: ./.github/actions/static-code-check

- name: Unit tests
run: make test

- name: Integration tests
run: make integration
30 changes: 30 additions & 0 deletions golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
run:
timeout: 3m

linters:
disable-all: true
enable:
- lll
- govet
- gofmt
- stylecheck
- godot

linters-settings:
lll:
line-length: 100
tab-width: 4
gofmt:
simplify: false
stylecheck:
# Temporary disable "Poorly chosen identifier" check.
checks: ["all", "-ST1003"]
godot:
scope: toplevel
period: true

issues:
exclude-rules:
- linters:
- lll
source: "\t?// (see )?https://"
4 changes: 4 additions & 0 deletions test/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pytest==6.2.5
flake8==3.8.1
flake8-unused-arguments==0.0.6
flake8-isort==4.0.0

0 comments on commit 31bb64d

Please sign in to comment.