| @@ -24,7 +24,7 @@ jobs: |
| 24 | 24 | uses: oven-sh/setup-bun@v2 |
| 25 | 25 | |
| 26 | 26 | - name: Use cached node_modules |
| 27 | | - uses: actions/cache@v4 |
| 27 | + uses: actions/cache@v4.2.4 |
| 28 | 28 | with: |
| 29 | 29 | path: node_modules |
| 30 | 30 | key: node-modules-${{ hashFiles('**/bun.lock') }} |
| @@ -47,7 +47,7 @@ jobs: |
| 47 | 47 | uses: oven-sh/setup-bun@v2 |
| 48 | 48 | |
| 49 | 49 | - name: Use cached node_modules |
| 50 | | - uses: actions/cache@v4 |
| 50 | + uses: actions/cache@v4.2.4 |
| 51 | 51 | with: |
| 52 | 52 | path: node_modules |
| 53 | 53 | key: node-modules-${{ hashFiles('**/bun.lock') }} |
| @@ -63,6 +63,29 @@ jobs: |
| 63 | 63 | test: |
| 64 | 64 | runs-on: ubuntu-latest |
| 65 | 65 | |
| 66 | + services: |
| 67 | + postgres: |
| 68 | + image: postgres:15 |
| 69 | + env: |
| 70 | + POSTGRES_PASSWORD: postgres |
| 71 | + POSTGRES_USER: postgres |
| 72 | + POSTGRES_DB: test_db |
| 73 | + options: >- |
| 74 | + --health-cmd pg_isready |
| 75 | + --health-interval 10s |
| 76 | + --health-timeout 5s |
| 77 | + --health-retries 5 |
| 78 | + ports: |
| 79 | + - 5432:5432 |
| 80 | + |
| 81 | + env: |
| 82 | + DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test_db |
| 83 | + POSTGRES_HOST: localhost |
| 84 | + POSTGRES_PORT: 5432 |
| 85 | + POSTGRES_USER: postgres |
| 86 | + POSTGRES_PASSWORD: postgres |
| 87 | + POSTGRES_DB: test_db |
| 88 | + |
| 66 | 89 | steps: |
| 67 | 90 | - uses: actions/checkout@v4 |
| 68 | 91 | |
| @@ -70,7 +93,7 @@ jobs: |
| 70 | 93 | uses: oven-sh/setup-bun@v2 |
| 71 | 94 | |
| 72 | 95 | - name: Use cached node_modules |
| 73 | | - uses: actions/cache@v4 |
| 96 | + uses: actions/cache@v4.2.4 |
| 74 | 97 | with: |
| 75 | 98 | path: node_modules |
| 76 | 99 | key: node-modules-${{ hashFiles('**/bun.lock') }} |
| @@ -80,6 +103,12 @@ jobs: |
| 80 | 103 | - name: Install Dependencies |
| 81 | 104 | run: bun install |
| 82 | 105 | |
| 106 | + - name: Wait for PostgreSQL |
| 107 | + run: | |
| 108 | + echo "Waiting for PostgreSQL to be ready..." |
| 109 | + timeout 60 bash -c 'until pg_isready -h localhost -p 5432 -U postgres; do sleep 1; done' |
| 110 | + echo "PostgreSQL is ready!" |
| 111 | + |
| 83 | 112 | - name: Unit Test |
| 84 | 113 | run: bun test |
| 85 | 114 | |
| @@ -93,7 +122,7 @@ jobs: |
| 93 | 122 | uses: oven-sh/setup-bun@v2 |
| 94 | 123 | |
| 95 | 124 | - name: Use cached node_modules |
| 96 | | - uses: actions/cache@v4 |
| 125 | + uses: actions/cache@v4.2.4 |
| 97 | 126 | with: |
| 98 | 127 | path: node_modules |
| 99 | 128 | key: node-modules-${{ hashFiles('**/bun.lock') }} |
| @@ -105,6 +134,3 @@ jobs: |
| 105 | 134 | |
| 106 | 135 | - name: Build |
| 107 | 136 | run: bun run build |
| 108 | | - |
| 109 | | - - name: Publish Commit |
| 110 | | - run: bunx pkg-pr-new publish |