Skip to content

refactor: v3.0.0 candidate #219

refactor: v3.0.0 candidate

refactor: v3.0.0 candidate #219

Workflow file for this run

name: CI
"on":
push:
branches:
- main
paths-ignore:
- README.md
pull_request:
branches:
- '*'
paths-ignore:
- README.md
env:
GO_VERSION: "1.22"
TRIVY_VERSION: "v0.44.1"
COG_VERSION: "5.2.0"
LINTER_VERSION: "v1.59.1"
permissions:
contents: read
jobs:
build:
name: Build
timeout-minutes: 15
needs:
- lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Make build
run: go build -o jarvis-api cmd/api/main.go
lint:
name: Lint
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Cache golangci-lint
id: golangci-lint
uses: actions/cache@v3
with:
path: |
~/.cache/golangci-lint
key: ${{ runner.os }}-golangci-lint
- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $HOME/.local/bin ${{ env.LINTER_VERSION }}
- name: Lint all modules with golangci-lint
run: |
PATH=$PATH:$HOME/.local/bin make lint
test:
name: Test
needs:
- build
runs-on: ubuntu-latest
timeout-minutes: 30
services:
postgres:
image: public.ecr.aws/docker/library/postgres:14
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--name postgres
steps:
- name: Install psql
run: |
sudo apt-get update
sudo apt-get install --yes postgresql-client
- name: Alter max connections
run: |
docker exec -i postgres bash << EOF
sed -i -s 's/max_connections = 100/max_connections = 3000/' /var/lib/postgresql/data/postgresql.conf
EOF
docker restart --time 0 postgres
time sleep 5
- run: psql -c 'SHOW max_connections;'
env:
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres
- name: Check out code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Run tests and generate coverage report
run: make test