feat: comprehensive refactoring and test improvements #19
Workflow file for this run
This file contains hidden or 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: Build and Test | |
| # CI/CD workflow for building and testing | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build with Gradle | |
| run: ./gradlew build | |
| - name: Test with Gradle | |
| run: ./gradlew test | |
| optimize-test: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Create SQLite test database | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y sqlite3 | |
| sqlite3 test.db "CREATE TABLE item (id INTEGER PRIMARY KEY, barcode TEXT, name TEXT, price INTEGER); | |
| CREATE TABLE sale (id INTEGER PRIMARY KEY, storeId INTEGER, staffId INTEGER, quantity INTEGER, amount INTEGER, deposit INTEGER, createdAt TEXT); | |
| CREATE TABLE sale_detail (id INTEGER PRIMARY KEY, saleId INTEGER, itemId INTEGER, price INTEGER, quantity INTEGER); | |
| INSERT INTO item VALUES (1, 'test-barcode', 'Test Item', 100); | |
| INSERT INTO item VALUES (2, 'test-barcode-2', 'Test Item 2', 200);" | |
| - name: Test database optimization | |
| run: | | |
| echo "Running SQLite optimization test..." | |
| sqlite3 test.db "CREATE INDEX idx_item_barcode ON item(barcode); | |
| CREATE INDEX idx_sale_storeId ON sale(storeId); | |
| CREATE INDEX idx_sale_detail_saleId ON sale_detail(saleId); | |
| ANALYZE;" | |
| echo "Database indexes created successfully" | |
| # Verify indexes exist | |
| sqlite3 test.db ".indexes" > indexes.txt | |
| cat indexes.txt | |
| # Check that indexes were created | |
| if grep -q "idx_item_barcode" indexes.txt; then | |
| echo "✓ Index idx_item_barcode created successfully" | |
| else | |
| echo "✗ Failed to create idx_item_barcode" | |
| exit 1 | |
| fi |