shiori/.github/workflows/_test.yml
Felipe Martin 6f19c12c95
Start working on new REST API. Refactor logic in domains. (#497)
* added 404 template

* added auth domain

* added embed file for frontend

* added base config and dependencies

* added basic new http server

* added separated server command

* updated go modules

* removed modd file

* Added shortcut to send internal server error response

* Added JWT support to Auth Domain

* Added JWT support to API

* docs: added comments to response struct

* naming

* inline returns

* updated dependencies

* production logger

* bookmarks endpoint

* reverted old views api path

* frontend for api v1

* proper 404 error (not working atm)

* use response

* removed 404 html

* server error handler

* login and basic auth

* adjusted session duration

* properly retrieve tags

* properly delete bookmark

* cleanup

* archiver domain

* debug routes

* bookmark routes

* expiration by parameter

* move to logrus

* logout

* frontend cache

* updated dependencies

* http: migrated to gin

* linted

* Added version command

* unit tests, docs

* response test utils and tests

* remove logout handler

* auth

* createtag

* improved http test utilities

* assert message equals

* Remove 1.19 from test matrix

* moved api to v1 folder

* docs: contribute docs

* updated makefile

* updated usage docs

* warn in server command

* updaed docs with shiori version command

* Updated documentation

* deps: update
2023-07-17 14:30:18 +01:00

61 lines
1.8 KiB
YAML

name: "Unit Tests"
on: workflow_call
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.20"]
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: shiori
POSTGRES_USER: shiori
options: >-
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- 5432:5432
mariadb:
image: mariadb:11
env:
MYSQL_USER: shiori
MYSQL_PASSWORD: shiori
MYSQL_DATABASE: shiori
MYSQL_ROOT_PASSWORD: shiori
options: >-
--health-cmd="/usr/local/bin/healthcheck.sh --connect" --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- 3306:3306
name: Go ${{ matrix.go }} unit tests
steps:
- uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0
- name: Setup go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version: ${{ matrix.go }}
- name: Set up gotestfmt
uses: gotesttools/gotestfmt-action@65f1d2228f06cc5e828b84597440fbd063d12ea2 # v2.1.0
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # 3.3.1
with:
path: |
~/.cache/go-build
~/go/pkg
key: golangci-lint.cache-{platform-arch}-{interval_number}-{go.mod_hash}
restore-keys: |
golangci-lint.cache-{interval_number}-
golangci-lint.cache-
- run: make unittest
env:
SHIORI_TEST_PG_URL: "postgres://shiori:shiori@localhost:5432/shiori?sslmode=disable"
SHIORI_TEST_MYSQL_URL: "shiori:shiori@(localhost:3306)/shiori"
- run: CGO_ENABLED=0 go build -tags osusergo,netgo -ldflags="-s -w -X main.version=$(git describe --tags) -X main.date=$(date --iso-8601=seconds)"