Skip to content

Bump gopkg.in/vansante/go-ffprobe.v2 from 2.2.0 to 2.2.1 in /api (#236) #885

Bump gopkg.in/vansante/go-ffprobe.v2 from 2.2.0 to 2.2.1 in /api (#236)

Bump gopkg.in/vansante/go-ffprobe.v2 from 2.2.0 to 2.2.1 in /api (#236) #885

Workflow file for this run

name: Tests
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test-api:
name: Test API
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
database: ['mysql', 'postgres', 'sqlite']
services:
mariadb:
image: mariadb:lts
env:
MYSQL_DATABASE: photoview_test
MYSQL_USER: photoview
MYSQL_PASSWORD: photosecret
MYSQL_RANDOM_ROOT_PASSWORD: yes
# https://github.com/MariaDB/mariadb-docker/issues/497
options: >-
--health-cmd="mariadb-admin ping"
--health-interval=20s
--health-timeout=5s
--health-retries=10
ports:
- 3306:3306
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: photoview
POSTGRES_PASSWORD: photosecret
POSTGRES_DB: photoview_test
options: >-
--health-cmd pg_isready
--health-interval 20s
--health-timeout 5s
--health-retries 10
ports:
- 5432:5432
defaults:
run:
working-directory: api
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Fetch branches
run: git fetch --all
- name: Set up Go
uses: actions/setup-go@v5
id: go
with:
go-version-file: ${{ github.workspace }}/api/go.mod
cache: false
- name: Cache Go dependencies
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Get C dependencies and 3rd-party tools
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 libatlas-base-dev liblapack-dev libjpeg-turbo8-dev libheif-dev ffmpeg exiftool gnupg2 gpg curl
echo 'deb [trusted=yes] http://download.opensuse.org/repositories/graphics:/darktable/xUbuntu_22.04/ /' | sudo tee /etc/apt/sources.list.d/graphics:darktable.list
sudo apt-get update
sudo apt-get install -y darktable
- 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
id: test
run: |
go install github.com/jstemmer/go-junit-report@latest
go test ./... -v -database -filesystem -p 1 -coverprofile=coverage.txt -covermode=atomic 2>&1 | tee >(go-junit-report > test-report.xml)
- name: Upload coverage
uses: codecov/codecov-action@v5
if: ${{ steps.test.conclusion == 'success' || steps.test.conclusion == 'failure' }}
with:
flags: api-${{ matrix.database }}
token: ${{ secrets.CODECOV_TKN }}
- name: Upload test execution results
uses: codecov/test-results-action@v1
if: ${{ steps.test.conclusion == 'success' || steps.test.conclusion == 'failure' }}
with:
flags: api-${{ matrix.database }}
token: ${{ secrets.CODECOV_TKN }}
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
if: ${{ steps.test.conclusion == 'success' || steps.test.conclusion == 'failure' }} && github.repository == 'kkovaletp/photoview'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_API }}
with:
projectBaseDir: api/
test-ui:
name: Test UI
runs-on: ubuntu-latest
defaults:
run:
working-directory: ui
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Fetch branches
run: git fetch --all
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: ui/package-lock.json
- name: Install dependencies
run: npm clean-install
- name: Test
id: test
run: npm run test:ci
- name: Upload coverage
uses: codecov/codecov-action@v5
if: ${{ steps.test.conclusion == 'success' || steps.test.conclusion == 'failure' }}
with:
flags: ui
token: ${{ secrets.CODECOV_TKN }}
- name: Upload test execution results
uses: codecov/test-results-action@v1
if: ${{ steps.test.conclusion == 'success' || steps.test.conclusion == 'failure' }}
with:
flags: ui
token: ${{ secrets.CODECOV_TKN }}
- name: Run ESLint
run: |
echo "--------------------------"
echo "ESLint execution results :"
echo "--------------------------"
npm run lint:ci || true
- name: ESLint artifact
id: eslint-artifact
uses: actions/upload-artifact@v4
with:
name: ESLint-report
path: ./ui/eslint-report.txt
if-no-files-found: warn
compression-level: 9
overwrite: true
- name: Publish ESlint report in PR comment
uses: actions/github-script@v7
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.COMMENT_TOKEN }}
script: |
let ESLintResults = "${{ steps.eslint-artifact.outputs.artifact-url }}";
let output = '';
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
const botComment = comments.data.find(
comment => comment.user.login === 'github-actions[bot]'
&& comment.body.includes('ESLint')
);
if (ESLintResults) {
output += '#### UI: ESLint issues:\n';
output += 'ESLint detected issues in the UI code.\n';
output += '\n[ESLint execution report](' + ESLintResults + ')\n';
output += '\nMake sure that you are logged in to be able to access the report.';
output += '\nThe report is accessible by this link within 90 days after the last ';
output += 'UI testing workflow execution time.';
output += '\nAfter that time you need to go to the ESLint execution step in the ';
output += 'Actions tab to see the same results.';
if (botComment) {
await github.rest.issues.updateComment({
comment_id: botComment.id,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
});
} else {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
});
}
} else {
if (botComment) {
await github.rest.issues.deleteComment({
comment_id: botComment.id,
owner: context.repo.owner,
repo: context.repo.repo
});
}
}
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
if: ${{ steps.test.conclusion == 'success' || steps.test.conclusion == 'failure' }} && github.repository == 'kkovaletp/photoview'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_UI }}
with:
projectBaseDir: ui/