DBC22-3081: fixed timezone conversion offset #603
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
name: Unit tests & Sonar Scan | |
on: | |
push: | |
branches: [ "main" ] | |
# pull_request: | |
# types: [opened, synchronize, reopened] | |
workflow_dispatch: | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
name: Run Tests | |
timeout-minutes: 10 | |
services: | |
redis: | |
image: redis:7 | |
ports: | |
- 6379:6379 | |
postgres: | |
image: postgis/postgis:15-3.4 | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_PASSWORD: testpw | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting for SonarCloud | |
fetch-depth: 0 | |
- name: Install GDAL | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gdal-bin | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ./src/backend/requirements/development.txt | |
- name: Run Tests | |
env: | |
DB_NAME: postgres | |
DB_USER: postgres | |
DB_PASSWORD: testpw | |
DB_HOST: localhost | |
DB_PORT: 5432 | |
REDIS_HOST: localhost | |
REDIS_PORT: 6379 | |
DEBUG: false | |
DJANGO_URL: http://localhost:8000 | |
DJANGO_ALLOWED_HOSTS: localhost | |
DJANGO_CORS_ORIGIN_WHITELIST: http://localhost:8000,http://localhost:3000 | |
DJANGO_SUPERUSER_USERNAME: testvar | |
DJANGO_SUPERUSER_EMAIL: [email protected] | |
DJANGO_SUPERUSER_PASSWORD: testvar | |
DJANGO_CSRF_COOKIE_SECURE: false | |
DJANGO_SECURE_SSL_REDIRECT: false | |
DJANGO_SESSION_COOKIE_SECURE: false | |
DJANGO_EMAIL_BACKEND: django.core.mail.backends.console.EmailBackend | |
DJANGO_EMAIL_HOST: testvar | |
DJANGO_EMAIL_PORT: 1 | |
DJANGO_RECAPTCHA_SECRET_KEY: testvar | |
DJANGO_FEEDBACK_EMAIL_DEFAULT: [email protected] | |
DRIVEBC_INLAND_FERRY_API_BASE_URL: testvar | |
DRIVEBC_IMAGE_API_BASE_URL: testvar | |
DRIVEBC_IMAGE_PROXY_URL: testvar | |
DRIVEBC_OPEN_511_API_BASE_URL: testvar | |
DRIVEBC_WEBCAM_API_BASE_URL: https://images.drivebc.ca/webcam/api/v1/ | |
DRIVEBC_ROUTE_PLANNER_API_BASE_URL: testvar | |
DRIVEBC_ROUTE_PLANNER_API_AUTH_KEY: testvar | |
DRIVEBC_DIT_API_BASE_URL: testvar | |
DRIVEBC_WEATHER_API_BASE_URL: testvar | |
DRIVEBC_WEATHER_API_TOKEN_URL: testvar | |
WEATHER_CLIENT_ID: testvar | |
WEATHER_CLIENT_SECRET: testvar | |
DRIVEBC_WEATHER_AREAS_API_BASE_URL: testvar | |
DRIVEBC_SAWSX_API_BASE_URL: testvar | |
DRIVEBC_IMAGE_BASE_URL: http://localhost:8000 | |
DRIVEBC_WEATHER_CURRENT_API_BASE_URL: testvar | |
DRIVEBC_WEATHER_CURRENT_STATIONS_API_BASE_URL: testvar | |
DRIVEBC_WEATHER_FORECAST_API_BASE_URL: testvar | |
DRIVEBC_REST_STOP_API_BASE_URL: testvar | |
SECRET_KEY: testvar | |
BCEID_URL: testvar | |
BCEID_SECRET: testvar | |
BCEID_CLIENT_ID: testvar | |
run: | | |
coverage run ./src/backend/manage.py test --noinput && coverage report && coverage xml | |
- name: Override Coverage Source Path for Sonar | |
run: | | |
sed -i "s/<source>\/home\/runner\/work\/DriveBC.ca\/DriveBC.ca<\/source>/<source>\/github\/workspace<\/source>/g" /home/runner/work/DriveBC.ca/DriveBC.ca/coverage.xml | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |