2020-11-26 13:28:34 +03:00
|
|
|
name: ci
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- '**'
|
|
|
|
tags-ignore:
|
|
|
|
- '*.*'
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
env:
|
|
|
|
RETAILCRM_URL: https://test.retailcrm.pro
|
|
|
|
RETAILCRM_KEY: key
|
|
|
|
|
|
|
|
jobs:
|
2021-02-09 16:10:58 +03:00
|
|
|
golangci:
|
|
|
|
name: lint
|
|
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Check out code into the Go module directory
|
|
|
|
uses: actions/checkout@v2
|
2022-04-12 15:37:15 +03:00
|
|
|
- name: Set up Go 1.17
|
2021-02-09 16:10:58 +03:00
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2022-04-12 15:37:15 +03:00
|
|
|
go-version: '1.17'
|
2021-02-09 16:10:58 +03:00
|
|
|
- name: Get dependencies
|
|
|
|
run: |
|
2021-04-16 14:25:25 +03:00
|
|
|
go mod tidy
|
2021-02-09 16:10:58 +03:00
|
|
|
cp .env.dist .env
|
|
|
|
- name: Lint code with golangci-lint
|
2022-04-12 15:37:15 +03:00
|
|
|
uses: golangci/golangci-lint-action@v3
|
2021-02-09 16:10:58 +03:00
|
|
|
with:
|
2022-04-12 15:37:15 +03:00
|
|
|
version: v1.45.2
|
2021-02-09 16:10:58 +03:00
|
|
|
only-new-issues: true
|
2021-04-16 14:25:25 +03:00
|
|
|
skip-pkg-cache: true
|
2022-12-08 16:24:52 +03:00
|
|
|
args: --build-tags=testutils
|
2020-11-26 13:28:34 +03:00
|
|
|
tests:
|
|
|
|
name: Tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-10-27 15:49:06 +03:00
|
|
|
go-version: ['1.13', '1.14', '1.15', '1.16', '1.17']
|
2020-11-26 13:28:34 +03:00
|
|
|
include:
|
2021-09-06 16:39:14 +03:00
|
|
|
- go-version: '1.17'
|
2020-11-26 13:28:34 +03:00
|
|
|
coverage: 1
|
|
|
|
steps:
|
|
|
|
- name: Set up Go ${{ matrix.go-version }}
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- name: Check out code into the Go module directory
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Get dependencies
|
|
|
|
run: |
|
2021-04-16 14:25:25 +03:00
|
|
|
go mod tidy
|
2020-11-26 13:28:34 +03:00
|
|
|
cp .env.dist .env
|
|
|
|
- name: Tests
|
|
|
|
env:
|
|
|
|
COVERAGE: ${{ matrix.coverage }}
|
|
|
|
if: env.COVERAGE != 1
|
2022-12-08 16:24:52 +03:00
|
|
|
run: go test -tags=testutils ./...
|
2020-11-26 13:28:34 +03:00
|
|
|
- name: Tests with coverage
|
|
|
|
env:
|
|
|
|
COVERAGE: ${{ matrix.coverage }}
|
|
|
|
if: env.COVERAGE == 1
|
|
|
|
run: |
|
2022-12-08 16:24:52 +03:00
|
|
|
go test -tags=testutils ./... -race -coverprofile=coverage.txt -covermode=atomic "$d"
|
2020-11-26 13:28:34 +03:00
|
|
|
- name: Coverage
|
|
|
|
env:
|
|
|
|
COVERAGE: ${{ matrix.coverage }}
|
|
|
|
if: env.COVERAGE == 1
|
|
|
|
run: |
|
|
|
|
bash <(curl -s https://codecov.io/bash)
|
|
|
|
rm coverage.txt
|