2023-09-17 00:55:17 +00:00
|
|
|
name: "Go CI"
|
2023-04-26 21:20:06 +00:00
|
|
|
on:
|
|
|
|
push:
|
2024-09-22 21:21:30 +00:00
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- 'dev-*'
|
2024-09-20 14:01:09 +00:00
|
|
|
workflow_dispatch:
|
|
|
|
|
2023-04-26 21:20:06 +00:00
|
|
|
pull_request:
|
2024-01-05 03:36:05 +00:00
|
|
|
paths-ignore:
|
|
|
|
- '**.yml'
|
2024-09-22 21:21:30 +00:00
|
|
|
- '**.md'
|
2023-04-26 21:20:06 +00:00
|
|
|
|
|
|
|
jobs:
|
2023-09-17 00:55:17 +00:00
|
|
|
lint:
|
2024-09-20 14:01:09 +00:00
|
|
|
name: Lint
|
2023-09-17 00:55:17 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
2024-05-04 22:38:06 +00:00
|
|
|
- name: Set up Go 1.22
|
2023-09-17 00:55:17 +00:00
|
|
|
uses: actions/setup-go@v4
|
|
|
|
with:
|
2024-05-04 22:38:06 +00:00
|
|
|
go-version: "1.22"
|
2023-09-17 00:55:17 +00:00
|
|
|
|
|
|
|
- name: Lint
|
|
|
|
uses: golangci/golangci-lint-action@v3
|
|
|
|
with:
|
2024-10-24 21:37:04 +00:00
|
|
|
version: v1.54
|
|
|
|
skip-pkg-cache: true
|
|
|
|
args: --out-format=colored-line-number --timeout=20m
|
2023-09-17 00:55:17 +00:00
|
|
|
|
|
|
|
- name: Format
|
|
|
|
run: make fmt check_changes
|
|
|
|
|
|
|
|
check:
|
2024-09-20 14:01:09 +00:00
|
|
|
name: Check
|
2023-09-17 00:55:17 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
2024-05-04 22:38:06 +00:00
|
|
|
- name: Set up Go 1.22
|
2023-09-17 00:55:17 +00:00
|
|
|
uses: actions/setup-go@v4
|
|
|
|
with:
|
2024-05-04 22:38:06 +00:00
|
|
|
go-version: "1.22"
|
2023-09-17 00:55:17 +00:00
|
|
|
|
2024-05-11 19:02:57 +00:00
|
|
|
- name: Check Go modules
|
2023-09-17 00:55:17 +00:00
|
|
|
run: make go_mod check_changes
|
|
|
|
|
2024-05-11 19:02:57 +00:00
|
|
|
- name: Check translations
|
|
|
|
run: make check-tr
|
|
|
|
|
2024-09-20 14:01:09 +00:00
|
|
|
test-db:
|
|
|
|
name: Test
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os: ["ubuntu-latest"]
|
|
|
|
go: ["1.22"]
|
|
|
|
database: [postgres, mysql]
|
|
|
|
include:
|
|
|
|
- database: postgres
|
|
|
|
image: postgres:16
|
|
|
|
port: 5432:5432
|
|
|
|
- database: mysql
|
|
|
|
image: mysql:8
|
|
|
|
port: 3306:3306
|
|
|
|
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
services:
|
|
|
|
database:
|
|
|
|
image: ${{ matrix.image }}
|
|
|
|
ports:
|
|
|
|
- ${{ matrix.port }}
|
|
|
|
env:
|
|
|
|
POSTGRES_PASSWORD: opengist
|
|
|
|
POSTGRES_DB: opengist_test
|
|
|
|
MYSQL_ROOT_PASSWORD: opengist
|
|
|
|
MYSQL_DATABASE: opengist_test
|
|
|
|
options: >-
|
|
|
|
--health-cmd ${{ matrix.database == 'postgres' && 'pg_isready' || '"mysqladmin ping"' }}
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Go ${{ matrix.go }}
|
|
|
|
uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
run: make test TEST_DB_TYPE=${{ matrix.database }}
|
|
|
|
|
2023-09-17 00:55:17 +00:00
|
|
|
test:
|
2024-09-20 14:01:09 +00:00
|
|
|
name: Test
|
2023-04-26 21:20:06 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-09-17 00:55:17 +00:00
|
|
|
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
|
2024-05-04 22:38:06 +00:00
|
|
|
go: ["1.22"]
|
2024-09-20 14:01:09 +00:00
|
|
|
database: ["sqlite"]
|
2023-04-26 21:20:06 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-04-26 21:55:37 +00:00
|
|
|
uses: actions/checkout@v3
|
2023-04-26 21:20:06 +00:00
|
|
|
|
|
|
|
- name: Set up Go ${{ matrix.go }}
|
2023-09-17 00:55:17 +00:00
|
|
|
uses: actions/setup-go@v4
|
2023-04-26 21:20:06 +00:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
2023-09-17 00:55:17 +00:00
|
|
|
- name: Run tests
|
2024-10-24 21:37:04 +00:00
|
|
|
run: make test TEST_DB_TYPE=${{ matrix.database }}
|
|
|
|
|
|
|
|
build:
|
|
|
|
name: Build
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
|
|
|
|
go: ["1.22"]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Go 1.22
|
|
|
|
uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
shell: bash
|
|
|
|
run: make
|