-
Notifications
You must be signed in to change notification settings - Fork 48
77 lines (61 loc) · 3.01 KB
/
copilot-setup-steps.yml
File metadata and controls
77 lines (61 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# GitHub Copilot Agent Environment Setup
# This file defines the standardized environment setup for GitHub Copilot agents
# working on the FlexMeasures repository.
#
# Reference: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment
name: FlexMeasures Development Environment Setup
on:
workflow_dispatch:
jobs:
copilot-setup-steps:
runs-on: ubuntu-latest
steps:
- name: Install system dependencies
run: |
# Install PostgreSQL client libraries (required for psycopg2) and Redis (used for job queuing)
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
libpq-dev redis-server && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Start Redis service
sudo service redis-server start
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
uv-version: 0.10
python-version-file: ".python-version"
- name: Install Python dependencies for testing
run: uv sync --locked --group test --group dev
- name: Install pre-commit hooks
run: |
# Install pre-commit for code quality checks
uv tool install pre-commit
# Install the pre-commit hooks
pre-commit install
- name: Setup PostgreSQL for testing
run: |
# Install PostgreSQL if not already available
sudo apt-get install -y --no-install-recommends \
postgresql postgresql-contrib && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Start PostgreSQL service
sudo service postgresql start
# Drop existing database and user if they exist (for clean setup)
sudo -u postgres psql -c "DROP DATABASE IF EXISTS flexmeasures_test;"
sudo -u postgres psql -c "DROP USER IF EXISTS flexmeasures_test;"
# Create test database and user with correct permissions
sudo -u postgres psql -c "CREATE USER flexmeasures_test WITH PASSWORD 'flexmeasures_test';"
sudo -u postgres psql -c "CREATE DATABASE flexmeasures_test OWNER flexmeasures_test;"
sudo -u postgres psql -c "ALTER USER flexmeasures_test CREATEDB;"
# Load PostgreSQL extensions (timescaledb, etc.)
sudo -u postgres psql -U flexmeasures_test -d flexmeasures_test -f ci/load-psql-extensions.sql || echo "Extensions loaded or not available"
- name: Set environment variables
run: |
# Set FlexMeasures environment to testing
echo "FLEXMEASURES_ENV=testing" >> $GITHUB_ENV
# Set database URL for tests (using PostgreSQL)
echo "SQLALCHEMY_DATABASE_URI=postgresql://flexmeasures_test:flexmeasures_test@localhost/flexmeasures_test" >> $GITHUB_ENV
# Set Redis URL for job queuing
echo "FLEXMEASURES_REDIS_URL=redis://localhost:6379/0" >> $GITHUB_ENV