feat(docker): integration tests in github pipeline #1
This file contains 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: Integration Test | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
branches: ['main'] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
main: | |
timeout-minutes: 20 | |
name: Integration Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install | |
- name: Copy .env file | |
run: cp .env.testing.docker .env | |
- name: Build infra | |
run: docker compose -f compose-before.yml build | |
- name: Build Observe API | |
run: docker compose build | |
- name: Run infra | |
run: docker compose -f compose-before.yml up -d | |
- name: Run Observe API | |
run: docker compose up -d | |
- name: Run Vitest | |
run: yarn run vitest --run | |
- name: Collect Logs on Failure (infra) | |
if: failure() | |
run: docker compose -f compose-before.yml logs | |
- name: Collect Logs on Failure (Observe) | |
if: failure() | |
run: docker compose logs | |
- name: Cleanup (infra) | |
if: always() | |
run: docker compose -f compose-before.yml down | |
- name: Cleanup (Observe) | |
if: always() | |
run: docker compose down |