test: align oneshot upload unit test with token validation flow #42
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: CI | |
| on: | |
| push: | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| api-tests: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: oneshot | |
| POSTGRES_PASSWORD: oneshot | |
| POSTGRES_DB: oneshot_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd="pg_isready -U oneshot" | |
| --health-interval=5s | |
| --health-timeout=5s | |
| --health-retries=10 | |
| env: | |
| H4CKATH0N_DATABASE_URL: postgresql+asyncpg://oneshot:oneshot@localhost:5432/oneshot_test | |
| defaults: | |
| run: | |
| working-directory: api | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v4 | |
| - run: uv sync | |
| - run: uv run pytest | |
| web-tests: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: oneshot | |
| POSTGRES_PASSWORD: oneshot | |
| POSTGRES_DB: oneshot_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd="pg_isready -U oneshot" | |
| --health-interval=5s | |
| --health-timeout=5s | |
| --health-retries=10 | |
| env: | |
| H4CKATH0N_DATABASE_URL: postgresql+asyncpg://oneshot:oneshot@localhost:5432/oneshot_test | |
| defaults: | |
| run: | |
| working-directory: web | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: web/package-lock.json | |
| - run: uv sync | |
| working-directory: api | |
| - run: npm ci | |
| - run: npm run test | |
| - run: npx playwright install --with-deps chromium | |
| - run: npx playwright test | |
| container-packaging: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - name: api | |
| context: ./api | |
| dockerfile: ./api/Dockerfile | |
| - name: web | |
| context: ./web | |
| dockerfile: ./web/Dockerfile | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| if: matrix.name == 'web' | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: web/package-lock.json | |
| - name: Package frontend artifact | |
| if: matrix.name == 'web' | |
| run: bash scripts/ci/package_frontend.sh | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/build-push-action@v6 | |
| with: | |
| context: ${{ matrix.context }} | |
| file: ${{ matrix.dockerfile }} | |
| push: false | |
| tags: oneshot/${{ matrix.name }}:ci-${{ github.sha }} |