Skip to content

Commit

Permalink
update workflows and config
Browse files Browse the repository at this point in the history
  • Loading branch information
bilalesi committed Jan 21, 2025
1 parent 6b6b627 commit 9184fee
Show file tree
Hide file tree
Showing 7 changed files with 340 additions and 40 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/pull-request-workflow.yml

This file was deleted.

118 changes: 118 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Pre-merge Review

on: [pull_request]

jobs:
setup:
runs-on: ubuntu-latest
outputs:
python-cache-key: ${{ steps.cache-deps.outputs.cache-hit }}
steps:
# Step 1: Checkout code
- name: Checkout code
uses: actions/checkout@v4

# Step 2: Set up Python with caching
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Cache Python dependencies
id: cache-deps
uses: actions/cache@v3
with:
path: |
~/.cache/pypoetry/virtualenvs
.venv
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-pip-
# Step 3: Install dependencies
- name: Install dependencies
run: |
pip install poetry
poetry sync
lint:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Python cache
uses: actions/cache@v3
with:
path: |
~/.cache/pypoetry/virtualenvs
.venv
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }}

- name: Install Poetry
run: |
pip install poetry
- name: Run styling checks
run: make style-check

type-check:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Python cache
uses: actions/cache@v3
with:
path: |
~/.cache/pypoetry/virtualenvs
.venv
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }}

- name: Install Poetry
run: |
pip install poetry
- name: Run type checks
run: make type-check

test:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Python cache
uses: actions/cache@v3
with:
path: |
~/.cache/pypoetry/virtualenvs
.venv
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }}

- name: Install Poetry
run: |
pip install poetry
- name: Start services
run: |
IS_CI="True" make init
- name: Check database schema migrations
run: make check-db-schema

- name: Run tests
env:
TEST_STRIPE_SECRET_KEY: ${{ secrets.TEST_STRIPE_SECRET_KEY }}
run: |
echo STRIPE_SECRET_KEY=${{ secrets.TEST_STRIPE_SECRET_KEY }} >> .env.local
echo STRIPE_DEVICE_NAME=CI >> .env.local
DEPLOYMENT_ENV=testing poetry run pytest
- name: Cleanup resources
run: |
make kill
docker system prune --force --volumes
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dev-p:
poetry run uvicorn virtual_labs.api:app --reload

init:
./dev-init.sh
./dev-init.sh $(filter-out $@,$(MAKECMDGOALS))

kill:
cd env-prep && docker compose -f docker-compose-dev.yml -p vlm-project down --remove-orphans --volumes
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ CLI_JAVA_OPTS: "-XX:UseSVE=0"
```bash
make init
```
If you are using an AMD environment (as Apple ships), use this command instead:
```
make init amd
```
3. Run db migrations (this also initializes the database)

```
Expand Down
8 changes: 7 additions & 1 deletion dev-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ KC_REALM_NAME="obp-realm"
CLIENT_ID="obpapp"
CLIENT_SECRET="obp-secret"

if [ "$1" == "amd" ]; then
COMPOSE_FILE="env-prep/docker-compose-dev-amd.yml"
else
COMPOSE_FILE="env-prep/docker-compose-dev.yml"
fi

# Start containers
chmod +x ./env-prep/init/init-aws.sh
ls -l ./env-prep/init/init-aws.sh
docker compose -f env-prep/docker-compose-dev.yml -p vlm-project up --wait
docker compose -f "$COMPOSE_FILE" -p vlm-project up --wait

# Check that delta ready to accept connections
echo "Checking that delta is ready to accept connections..."
Expand All @@ -35,6 +40,7 @@ curl -XPUT \
}'

echo "Initialize nexus"

python3 env-prep/init/init.py

echo "📦 Initialize Vl database"
Expand Down
Loading

0 comments on commit 9184fee

Please sign in to comment.