Update GitHub workflows with various improvements (#1028)

Updated DB images in tests to align with the PROD setup
Try to upload coverage only if tests were executed (passed or failed) - not skipped or canceled
Added ESLint execution after UI tests with results exported to artifact
Shifted scheduled run time from 00 minutes according to GitHub recommendations, as the 00 minutes of each hour is the busiest time
Dynamically extract a list of langs from the repo to use them for CodeQL analysis instead of hardcoded ones
Updated versions of several outdated actions
Added the Autobuild step before CodeQL analysis for GO
Added the Anchore dependency scan job, reporting to the Security tab. I can add steps to manage PR comments with the results, but I need a token to be provided by @viktorstrate
Added the Hadolint Dockerfile scan job, reporting to the Security tab. I can add steps to manage PR comments with the results, but I need a token to be provided by @viktorstrate
Implemented weekly rebuild of images for the latest commit in the master branch and the latest released tag. It will recreate images with the recent base image and 3rd-party dependencies even if there were no new pushes for a long time
Added the Dockle container analysis job to be run on master and tag and validate just pushed images, reporting to the Security tab
Added golangci-lint config to the /api folder, as a starting point and for local usage
Added 2 weekly jobs for Dependabot:
-- Maintain dependencies for GitHub Actions
-- Maintain dependencies for Dockerfile

---------

Co-authored-by: Konstantin Koval
This commit is contained in:
Kostiantyn
2024-10-01 15:50:44 +03:00
committed by GitHub
parent f861c97b49
commit dee3a151e9
8 changed files with 723 additions and 30 deletions

View File

@@ -17,14 +17,15 @@ jobs:
services:
mariadb:
image: mariadb:10.5
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="mysqladmin ping"
--health-cmd="mariadb-admin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
@@ -32,7 +33,7 @@ jobs:
- 3306:3306
postgres:
image: postgres:13.2
image: postgres:16-alpine
env:
POSTGRES_USER: photoview
POSTGRES_PASSWORD: photosecret
@@ -64,6 +65,8 @@ jobs:
cache-to: type=gha,mode=max
- name: Test
id: test
continue-on-error: true
run: |
docker run --name test --network host \
-e PHOTOVIEW_DATABASE_DRIVER=${{ matrix.database }} \
@@ -76,6 +79,7 @@ jobs:
- name: Upload coverage
uses: codecov/codecov-action@v4
if: ${{ steps.test.conclusion == 'success' }}
with:
flags: api-${{ matrix.database }}
@@ -102,11 +106,33 @@ jobs:
cache-to: type=gha,mode=max
- name: Test
id: test
continue-on-error: true
run: |
docker run --name test photoview/ui npm run test:ci
docker cp test:/app/ui/coverage ./ui/
- name: Upload coverage
uses: codecov/codecov-action@v4
if: ${{ steps.test.conclusion == 'success' }}
with:
flags: ui
- name: Run ESLint
working-directory: ui
run: |
npm run lint:ci || true
echo "--------------------------"
echo "ESLint execution results :"
echo "--------------------------"
cat ./eslint-report.txt || echo "ESLint report file not found."
- 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