name: CI on: push: branches: [main] pull_request: branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: lint: name: Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: node-version: '20' cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Lint and Type check run: pnpm turbo lint typecheck test: name: Unit Tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: node-version: '20' cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Run core tests run: pnpm --filter @skillhub/core test:run - name: Run db tests run: pnpm --filter @skillhub/db test:run - name: Run web API tests run: pnpm --filter @skillhub/web test:run - name: Run CLI tests run: pnpm --filter @skillhub/cli test:run e2e: name: E2E Tests runs-on: ubuntu-latest needs: [build] # TODO: Enable when CI has database/redis services if: false steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: node-version: '20' cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Install Playwright browsers run: pnpm --filter @skillhub/web exec playwright install --with-deps chromium - name: Build web app and dependencies run: pnpm turbo build --filter=@skillhub/web - name: Run E2E tests run: pnpm --filter @skillhub/web test:e2e --project=chromium env: PLAYWRIGHT_BASE_URL: http://localhost:3000 build: name: Build runs-on: ubuntu-latest needs: [lint, test] steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: node-version: '20' cache: 'pnpm' - name: Install dependencies run: pnpm install --frozen-lockfile - name: Build run: pnpm build docker: name: Build Docker Images runs-on: ubuntu-latest needs: [build] if: github.event_name == 'push' && github.ref == 'refs/heads/main' permissions: contents: read packages: write steps: - uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build Web image uses: docker/build-push-action@v5 with: context: . file: ./apps/web/Dockerfile push: false tags: ghcr.io/${{ github.repository_owner }}/skillhub-web:latest cache-from: type=gha cache-to: type=gha,mode=max - name: Build Indexer image uses: docker/build-push-action@v5 with: context: . file: ./services/indexer/Dockerfile push: false tags: ghcr.io/${{ github.repository_owner }}/skillhub-indexer:latest cache-from: type=gha cache-to: type=gha,mode=max