1
0
Fork 0
golang-forgejo-go-chi-session/.forgejo/workflows/test.yml

46 lines
1.7 KiB
YAML
Raw Permalink Normal View History

name: test
on:
- push
- pull_request
jobs:
test:
runs-on: docker-global-bookworm
container:
image: 'code.forgejo.org/oci/node:20-bookworm'
services:
redis:
image: registry.redict.io/redict:7
pgsql:
image: 'code.forgejo.org/oci/postgres:16'
env:
POSTGRES_DB: testsession
POSTGRES_PASSWORD: postgres
mysql:
image: mariadb:11
env:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: yes
MARIADB_DATABASE: testsession
#
# See also https://codeberg.org/forgejo/forgejo/issues/976
#
MARIADB_EXTRA_FLAGS: --innodb-adaptive-flushing=OFF --innodb-buffer-pool-size=4G --innodb-log-buffer-size=128M --innodb-flush-log-at-trx-commit=0 --innodb-flush-log-at-timeout=30 --innodb-flush-method=nosync --innodb-fsync-threshold=1000000000
memcached:
image: memcached:1.6-alpine
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
- uses: https://code.forgejo.org/actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: lint
run: go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.3 run
- name: create database tables
run: |
apt-get update -qq
apt-get install -y -qq postgresql-client mariadb-client
PGPASSWORD=postgres psql -h pgsql -U postgres -c 'CREATE TABLE IF NOT EXISTS session (key TEXT PRIMARY KEY, data BYTEA, expiry BIGINT)' testsession
mariadb -h mysql -u root -D testsession -e 'CREATE TABLE IF NOT EXISTS session (`key` varchar(255) PRIMARY KEY, data BLOB, expiry BIGINT)'
- name: test
run: go test -v ./...