1
Fork 0
photoview/.github/workflows/tests.yml

132 lines
3.0 KiB
YAML
Raw Normal View History

name: Tests
2020-08-09 20:32:02 +02:00
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test-api:
name: Test API
runs-on: ubuntu-20.04
2020-08-09 20:32:02 +02:00
strategy:
matrix:
database: ['mysql', 'postgres', 'sqlite']
services:
mariadb:
image: mariadb:10.5
env:
MYSQL_DATABASE: photoview_test
MYSQL_USER: photoview
MYSQL_PASSWORD: photosecret
2021-04-23 21:00:11 +02:00
MYSQL_RANDOM_ROOT_PASSWORD: yes
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
2021-04-23 21:14:11 +02:00
ports:
- 3306:3306
postgres:
2021-04-23 20:54:01 +02:00
image: postgres:13.2
env:
POSTGRES_USER: photoview
POSTGRES_PASSWORD: photosecret
POSTGRES_DB: photoview_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
2021-04-23 21:14:11 +02:00
ports:
- 5432:5432
2020-08-09 20:32:02 +02:00
defaults:
run:
working-directory: api
steps:
- name: Set up Go
2020-08-09 20:32:02 +02:00
uses: actions/setup-go@v2
with:
go-version: ^1.16
2020-08-09 20:32:02 +02:00
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
2021-04-23 21:07:32 +02:00
- name: Cache Go dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Get C dependencies
2021-02-15 23:40:02 +01:00
run: |
2021-03-27 23:15:14 +01:00
sudo add-apt-repository ppa:strukturag/libheif
sudo add-apt-repository ppa:strukturag/libde265
2021-02-15 23:40:02 +01:00
sudo apt-get update
sudo apt-get install -y libdlib-dev libblas-dev liblapack-dev libjpeg-turbo8-dev libheif-dev
- name: Get GO dependencies
2020-08-09 20:32:02 +02:00
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build
run: go build -v .
- name: Configure MySQL
if: ${{ matrix.database == 'mysql' }}
run: |
cp ../.github/mysql.testing.env testing.env
- name: Configure Postgres
if: ${{ matrix.database == 'postgres' }}
run: |
cp ../.github/postgres.testing.env testing.env
- name: Configure Sqlite
if: ${{ matrix.database == 'sqlite' }}
run: |
touch photoview_test.db
cp ../.github/sqlite.testing.env testing.env
2020-08-09 20:32:02 +02:00
- name: Test
run: go test ./... -v -database -filesystem -p 1
2020-09-27 23:04:05 +02:00
test-ui:
name: Test UI
runs-on: ubuntu-latest
2020-09-27 23:04:05 +02:00
defaults:
run:
working-directory: ui
2020-09-27 23:04:05 +02:00
strategy:
matrix:
2021-04-05 23:18:38 +02:00
node-version: [15.x]
2020-09-27 23:04:05 +02:00
steps:
- uses: actions/checkout@v2
2020-09-27 23:04:05 +02:00
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
2020-09-27 23:04:05 +02:00
- name: Install dependencies
2021-04-15 16:37:36 +02:00
run: npm clean-install
2020-09-27 23:04:05 +02:00
- name: Test
run: npm test