Add golangci-lint #835
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
env: | |
GO111MODULE: "on" | |
TEST_ARGS: -coverprofile coverage.out -covermode atomic | |
PKG_CONFIG_PATH: /usr/local/lib/pkgconfig/ | |
LD_LIBRARY_PATH: /opt/oracle/instantclient | |
jobs: | |
mysql: | |
name: MySQL | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
mysql_version: | |
- 5.6 | |
- 5.7 | |
- 8 | |
services: | |
mysql: | |
image: mysql:${{ matrix.mysql_version }} | |
ports: | |
- 3306 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: plant_erd_test | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
id: go | |
- name: Setup | |
run: | | |
set -xe | |
.github/workflows/setup.sh | |
env: | |
RUNNER_OS: ${{ runner.os }} | |
- name: Run test | |
run: | | |
set -xe | |
make test | |
make testrace | |
env: | |
MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }} | |
MYSQL_HOST: localhost | |
MYSQL_USER: root | |
MYSQL_PASSWORD: root | |
MYSQL_DATABASE: plant_erd_test | |
- name: Slack Notification (not success) | |
uses: act10ns/slack@v2 | |
if: "! success()" | |
continue-on-error: true | |
with: | |
status: ${{ job.status }} | |
webhook-url: ${{ secrets.SLACK_WEBHOOK }} | |
postgresql: | |
name: PostgreSQL | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
postgresql_version: | |
- 9-alpine | |
- 10-alpine | |
- 11-alpine | |
- 12-alpine | |
- 13-alpine | |
- 14-alpine | |
- 15-alpine | |
- 16-alpine | |
services: | |
postgresql: | |
image: postgres:${{ matrix.postgresql_version }} | |
ports: | |
- 5432 | |
env: | |
POSTGRES_DB: plant_erd_test | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
id: go | |
- name: Setup | |
run: | | |
set -xe | |
.github/workflows/setup.sh | |
env: | |
RUNNER_OS: ${{ runner.os }} | |
- name: Run test | |
run: | | |
set -xe | |
make test | |
make testrace | |
env: | |
POSTGRES_PORT: ${{ job.services.postgresql.ports['5432'] }} | |
POSTGRES_HOST: localhost | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DATABASE: plant_erd_test | |
- name: Slack Notification (not success) | |
uses: act10ns/slack@v2 | |
if: "! success()" | |
continue-on-error: true | |
with: | |
status: ${{ job.status }} | |
webhook-url: ${{ secrets.SLACK_WEBHOOK }} | |
oracle: | |
name: Oracle | |
runs-on: ubuntu-latest | |
services: | |
oracle: | |
image: deepdiver/docker-oracle-xe-11g:2.0 | |
ports: | |
- 1521 | |
env: | |
ORACLE_SYSTEM_PASSWORD: oracle | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
id: go | |
- name: Setup | |
run: | | |
set -xe | |
.github/workflows/setup.sh | |
env: | |
RUNNER_OS: ${{ runner.os }} | |
- name: Run test | |
run: | | |
set -xe | |
make test | |
make testrace | |
env: | |
ORACLE_SYSTEM_PASSWORD: oracle | |
ORACLE_HOST: localhost | |
ORACLE_USER: system | |
ORACLE_PASSWORD: oracle | |
ORACLE_PORT: ${{ job.services.oracle.ports['1521'] }} | |
ORACLE_SERVICE: xe | |
NLS_LANG: AMERICAN_AMERICA.UTF8 | |
- name: Slack Notification (not success) | |
uses: act10ns/slack@v2 | |
if: "! success()" | |
continue-on-error: true | |
with: | |
status: ${{ job.status }} | |
webhook-url: ${{ secrets.SLACK_WEBHOOK }} | |
coverage: | |
name: Coverage | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql | |
ports: | |
- 3306 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: plant_erd_test | |
postgresql: | |
image: postgres | |
ports: | |
- 5432 | |
env: | |
POSTGRES_DB: plant_erd_test | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
oracle: | |
image: deepdiver/docker-oracle-xe-11g:2.0 | |
ports: | |
- 1521 | |
env: | |
ORACLE_SYSTEM_PASSWORD: oracle | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
id: go | |
- name: Setup | |
run: | | |
set -xe | |
.github/workflows/setup.sh | |
env: | |
RUNNER_OS: ${{ runner.os }} | |
- name: Run test | |
run: | | |
set -xe | |
make test | |
make testrace | |
env: | |
MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }} | |
MYSQL_HOST: localhost | |
MYSQL_USER: root | |
MYSQL_PASSWORD: root | |
MYSQL_DATABASE: plant_erd_test | |
POSTGRES_PORT: ${{ job.services.postgresql.ports['5432'] }} | |
POSTGRES_HOST: localhost | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DATABASE: plant_erd_test | |
ORACLE_SYSTEM_PASSWORD: oracle | |
ORACLE_HOST: localhost | |
ORACLE_USER: system | |
ORACLE_PASSWORD: oracle | |
ORACLE_PORT: ${{ job.services.oracle.ports['1521'] }} | |
ORACLE_SERVICE: xe | |
NLS_LANG: AMERICAN_AMERICA.UTF8 | |
- name: Convert coverage to lcov | |
uses: jandelgado/gcov2lcov-action@v1 | |
with: | |
infile: coverage.out | |
outfile: coverage.lcov | |
- name: Coveralls | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: coverage.lcov | |
- name: Slack Notification (not success) | |
uses: act10ns/slack@v2 | |
if: "! success()" | |
continue-on-error: true | |
with: | |
status: ${{ job.status }} | |
webhook-url: ${{ secrets.SLACK_WEBHOOK }} | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
id: go | |
- name: Setup | |
run: | | |
set -xe | |
.github/workflows/setup.sh | |
env: | |
RUNNER_OS: ${{ runner.os }} | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.58 | |
- name: Slack Notification (not success) | |
uses: act10ns/slack@v2 | |
if: "! success()" | |
continue-on-error: true | |
with: | |
status: ${{ job.status }} | |
webhook-url: ${{ secrets.SLACK_WEBHOOK }} | |
integration_test: | |
name: integration_test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
id: go | |
- name: Setup | |
run: | | |
set -xe | |
.github/workflows/setup.sh | |
env: | |
RUNNER_OS: ${{ runner.os }} | |
- name: make integration_test | |
run: | | |
set -xe | |
make integration_test | |
- name: Slack Notification (not success) | |
uses: act10ns/slack@v2 | |
if: "! success()" | |
continue-on-error: true | |
with: | |
status: ${{ job.status }} | |
webhook-url: ${{ secrets.SLACK_WEBHOOK }} | |
notify: | |
needs: | |
- mysql | |
- postgresql | |
- oracle | |
- coverage | |
- lint | |
- integration_test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Slack Notification (success) | |
uses: act10ns/slack@v2 | |
if: always() | |
continue-on-error: true | |
with: | |
status: ${{ job.status }} | |
webhook-url: ${{ secrets.SLACK_WEBHOOK }} |