name: Tests on: push: branches: [master] pull_request: branches: [master] jobs: test-api: name: Test API runs-on: ubuntu-20.04 strategy: matrix: database: ['mysql', 'postgres', 'sqlite'] services: mariadb: image: mariadb:10.5 env: MYSQL_DATABASE: photoview_test MYSQL_USER: photoview MYSQL_PASSWORD: photosecret MYSQL_RANDOM_ROOT_PASSWORD: yes options: >- --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 postgres: 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 defaults: run: working-directory: api steps: - name: Set up Go uses: actions/setup-go@v2 with: go-version: ^1.16 id: go - name: Check out code into the Go module directory uses: actions/checkout@v2 - name: Get C dependencies run: | sudo add-apt-repository ppa:strukturag/libheif sudo add-apt-repository ppa:strukturag/libde265 sudo apt-get update sudo apt-get install -y libdlib-dev libblas-dev liblapack-dev libjpeg-turbo8-dev libheif-dev - name: Get GO dependencies 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 - name: Test run: go test ./... -v -database -filesystem -p 1 test-ui: name: Test UI runs-on: ubuntu-latest defaults: run: working-directory: ui strategy: matrix: node-version: [15.x] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - name: Install dependencies run: npm clean-install - name: Test run: npm test