LCFS - Implement Email Notification Triggers in Backend for Subscribed Users #1226 #1187
Workflow file for this run
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: Testing pipeline | |
on: | |
pull_request: | |
branches: | |
- "*" | |
jobs: | |
backend-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10.13" | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Install Docker Compose | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y docker-compose | |
- name: Cache Poetry dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pypoetry | |
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry- | |
- name: Cache Docker images | |
uses: actions/cache@v3 | |
with: | |
path: /var/lib/docker | |
key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }} | |
restore-keys: | | |
${{ runner.os }}-docker- | |
- name: Install Poetry | |
run: pip install poetry==1.6.1 | |
- name: Install backend dependencies | |
run: | | |
pip install --upgrade pip setuptools wheel | |
cd backend | |
poetry config virtualenvs.create false | |
poetry install | |
pip install pytest-github-actions-annotate-failures typing_extensions | |
- name: Fix docker-compose.yml | |
run: | | |
sed -i 's/: true/: "true"/g; s/: false/: "false"/g' docker-compose.yml | |
- name: Build and start services | |
run: | | |
docker-compose build | |
docker-compose up -d | |
- name: Run backend tests | |
id: backend_tests | |
continue-on-error: true | |
run: | | |
cd backend | |
poetry run pytest --junitxml=pytest-results.xml | |
env: | |
LCFS_DB_HOST: localhost | |
LCFS_DB_PORT: 5432 | |
LCFS_DB_USER: lcfs | |
LCFS_DB_PASS: development_only | |
LCFS_DB_BASE: lcfs | |
LCFS_REDIS_HOST: localhost | |
LCFS_REDIS_PORT: 6379 | |
LCFS_REDIS_PASSWORD: development_only | |
APP_ENVIRONMENT: dev | |
LCFS_CHES_CLIENT_ID: mock_client_id | |
LCFS_CHES_CLIENT_SECRET: mock_client_secret | |
LCFS_CHES_AUTH_URL: http://mock_auth_url | |
LCFS_CHES_SENDER_EMAIL: [email protected] | |
LCFS_CHES_SENDER_NAME: Mock Notification System | |
LCFS_CHES_EMAIL_URL: http://mock_email_url | |
- name: Upload pytest results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-results | |
path: backend/pytest-results.xml | |
- name: Stop services | |
if: always() | |
run: docker-compose down | |
- name: Publish Backend Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
files: backend/pytest-results.xml | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
comment_title: "Backend Test Results" | |
check_name: "Backend Test Results" | |
fail_on: "errors" | |
report_individual_runs: "true" | |
deduplicate_classes_by_file_name: "true" | |
frontend-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Cache npm dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install frontend dependencies | |
run: | | |
cd frontend | |
npm ci | |
- name: Run frontend tests | |
id: frontend_tests | |
continue-on-error: true | |
run: | | |
cd frontend | |
npm run test:run -- --reporter=junit --outputFile=vitest-results.xml | |
env: | |
CI: true | |
- name: Upload Vitest results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: vitest-results | |
path: frontend/vitest-results.xml | |
- name: Publish Frontend Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
files: frontend/vitest-results.xml | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
comment_title: "Frontend Test Results" | |
check_name: "Frontend Test Results" | |
fail_on: "errors" | |
report_individual_runs: "true" | |
deduplicate_classes_by_file_name: "true" |