[Snyk] Fix for 8 vulnerabilities #427
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
# Trigger analysis when pushing in develop/master or pull requests, and when creating | |
# a pull request. | |
push: | |
branches: | |
- master | |
- develop | |
pull_request: | |
types: [opened, synchronize, reopened] | |
name: CI Workflow | |
jobs: | |
test: | |
name: Tests | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:13.4 | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
POSTGRES_USER: tunnistamo | |
POSTGRES_PASSWORD: tunnistamo | |
POSTGRES_DB: tunnistamo | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
# Required by Sonar | |
fetch-depth: 0 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
cache: 'pip' | |
cache-dependency-path: 'requirements*.txt' | |
- name: Install system packages | |
run: sudo apt update && sudo apt-get install -y libxmlsec1-dev xmlsec1 gettext | |
- name: Install Python dependencies | |
run: pip install -r requirements.txt -r requirements-dev.txt | |
- name: Compile translations | |
run: python manage.py compilemessages | |
- name: Run tests | |
run: pytest -ra -vvv --cov=. | |
env: | |
DATABASE_URL: postgres://tunnistamo:tunnistamo@localhost:5432/tunnistamo | |
- name: Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
# Without this workaround Sonar reports a warning about an incorrect source path | |
- name: Override coverage report source path for Sonar | |
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
coding-style: | |
name: Coding style | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
cache: 'pip' | |
cache-dependency-path: 'requirements*.txt' | |
- name: Install system packages | |
run: sudo apt update && sudo apt-get install -y libxmlsec1-dev xmlsec1 | |
- name: Install Python dependencies | |
run: pip install -r requirements.txt -r requirements-dev.txt | |
- name: Linting | |
run: flake8 | |
- name: Import sorting | |
run: isort -c . |