diff --git a/.env.test b/.env.test new file mode 100644 index 0000000..82b5df5 --- /dev/null +++ b/.env.test @@ -0,0 +1,6 @@ +DATABASE_URL="postgresql://postgres:postgres@localhost:5432/aurora_test" +DISCORD_BOT_TOKEN="test_token" +DISCORD_CLIENT_ID="123456789" +DISCORD_GUILD_ID="123456789" +ADMIN_TOKEN="admin_token_123" +LOG_LEVEL="error" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3c01788..e7db852 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -18,6 +18,21 @@ jobs: # ========================================================================== test: runs-on: ubuntu-latest + services: + postgres: + image: postgres:17-alpine + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: aurora_test + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: - name: Checkout uses: actions/checkout@v4 @@ -30,8 +45,27 @@ jobs: - name: Install Dependencies run: bun install --frozen-lockfile + - name: Setup Test Database + run: bun run db:push:local + env: + DATABASE_URL: postgresql://postgres:postgres@localhost:5432/aurora_test + # Create .env.test for implicit usage by bun + DISCORD_BOT_TOKEN: test_token + DISCORD_CLIENT_ID: 123 + DISCORD_GUILD_ID: 123 + - name: Run Tests - run: bash shared/scripts/test-sequential.sh + run: | + # Create .env.test for test-sequential.sh / bun test + cat < .env.test + DATABASE_URL="postgresql://postgres:postgres@localhost:5432/aurora_test" + DISCORD_BOT_TOKEN="test_token" + DISCORD_CLIENT_ID="123456789" + DISCORD_GUILD_ID="123456789" + ADMIN_TOKEN="admin_token_123" + LOG_LEVEL="error" + EOF + bash shared/scripts/test-sequential.sh # ========================================================================== # Build Job