-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (86 loc) · 2.36 KB
/
Copy pathci.yml
File metadata and controls
104 lines (86 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: BrainBytes CI
on:
push:
branches: [master, develop]
paths-ignore:
- "**.md"
- "docs/**"
pull_request:
branches: [master, develop]
paths-ignore:
- "**.md"
- "docs/**"
workflow_dispatch:
jobs:
lint:
name: Check Code Quality
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: "10.10.0"
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "24.1.0"
cache: "pnpm"
- name: Install dependencies
working-directory: ./src
run: pnpm install --no-frozen-lockfile
- name: Lint source code
working-directory: ./src
run: pnpm lint
test:
name: Run Tests
needs: lint
runs-on: ubuntu-latest
environment: GitHub actions
env:
JWT_SECRET: ${{secrets.JWT_SECRET}}
MONGO_URI_DOCKER: ${{secrets.MONGO_URI_DOCKER}}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: "10.10.0"
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "24.1.0"
cache: "pnpm"
- name: Install dependencies
working-directory: ./src
run: pnpm install --no-frozen-lockfile
- name: Run backend tests
working-directory: ./src
run: pnpm test
build:
name: Build Docker Image
needs: ["lint", "test"]
runs-on: ubuntu-latest
environment: GitHub actions
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- name: Build and push Image
uses: docker/build-push-action@v4
with:
file: ./Dockerfile.prod
push: true
tags: ghcr.io/${{ github.repository_owner }}/brainbytes-api:latest
cache-from: type=gha
cache-to: type=gha,mode=max