feat: added ci/cd with self hosted cd pipeline #1
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: | |
| pull_request: | |
| push: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| frontend-quality: | |
| name: Frontend Quality | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 | |
| with: | |
| version: 9 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| cache-dependency-path: frontend/pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Lint | |
| run: pnpm lint | |
| - name: Type check | |
| run: pnpm check | |
| - name: Unit tests | |
| run: pnpm test -- --passWithNoTests | |
| - name: Build | |
| run: pnpm build | |
| backend-quality: | |
| name: Backend Quality | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: backend | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | |
| - name: Setup Go | |
| uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff | |
| with: | |
| go-version-file: backend/go.mod | |
| - name: Download modules | |
| run: go mod download | |
| - name: Build | |
| run: go build ./cmd/server/main.go | |
| - name: Vet | |
| run: go vet ./... | |
| docker-build-smoke: | |
| name: Docker Build Smoke | |
| runs-on: ubuntu-latest | |
| needs: | |
| - frontend-quality | |
| - backend-quality | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f | |
| - name: Build frontend image | |
| run: docker build -f frontend/Dockerfile -t bookapp-frontend:ci ./frontend | |
| - name: Build backend image | |
| run: docker build -f backend/Dockerfile -t bookapp-backend:ci ./backend |