Skip to content

Commit 19093b9

Browse files
adding github actions workflows
1 parent 913d493 commit 19093b9

File tree

3 files changed

+361
-0
lines changed

3 files changed

+361
-0
lines changed

.github/workflows/api.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: API CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
paths:
7+
- 'apps/api/**'
8+
- 'package.json'
9+
- 'pnpm-lock.yaml'
10+
- '.github/workflows/api.yml'
11+
pull_request:
12+
branches: [ main, master, develop ]
13+
paths:
14+
- 'apps/api/**'
15+
- 'package.json'
16+
- 'pnpm-lock.yaml'
17+
18+
jobs:
19+
api-lint-test:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '20'
29+
30+
- name: Setup pnpm
31+
uses: pnpm/action-setup@v2
32+
with:
33+
version: '8.6.12'
34+
run_install: false
35+
36+
- name: Get pnpm store directory
37+
id: pnpm-cache
38+
shell: bash
39+
run: |
40+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
41+
42+
- name: Cache pnpm dependencies
43+
uses: actions/cache@v4
44+
with:
45+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
46+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
47+
restore-keys: |
48+
${{ runner.os }}-pnpm-store-
49+
50+
- name: Install dependencies
51+
run: pnpm install --frozen-lockfile
52+
53+
- name: Lint API
54+
run: pnpm --filter api lint
55+
56+
- name: Test API
57+
run: pnpm --filter api test
58+
env:
59+
NODE_ENV: test
60+
61+
api-build:
62+
needs: api-lint-test
63+
runs-on: ubuntu-latest
64+
steps:
65+
- name: Checkout code
66+
uses: actions/checkout@v4
67+
68+
- name: Setup Node.js
69+
uses: actions/setup-node@v4
70+
with:
71+
node-version: '20'
72+
73+
- name: Setup pnpm
74+
uses: pnpm/action-setup@v2
75+
with:
76+
version: '8.6.12'
77+
run_install: false
78+
79+
- name: Restore pnpm dependencies
80+
uses: actions/cache@v4
81+
with:
82+
path: |
83+
**/node_modules
84+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
85+
restore-keys: |
86+
${{ runner.os }}-pnpm-
87+
88+
- name: Install dependencies
89+
run: pnpm install --frozen-lockfile
90+
91+
- name: Build API
92+
run: pnpm --filter api build
93+
94+
- name: Upload API build artifacts
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: api-build
98+
path: apps/api/dist/
99+
retention-days: 7
100+
101+
# Uncomment and configure for deployment when ready
102+
# api-deploy:
103+
# needs: api-build
104+
# runs-on: ubuntu-latest
105+
# if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
106+
# steps:
107+
# - name: Checkout code
108+
# uses: actions/checkout@v4
109+
#
110+
# - name: Download build artifacts
111+
# uses: actions/download-artifact@v4
112+
# with:
113+
# name: api-build
114+
# path: apps/api/dist/
115+
#
116+
# # Add your deployment steps here
117+
# # For example, deployment to a cloud provider like AWS, Azure, or GCP
118+
# # - name: Deploy to production
119+
# # uses: some-deployment-action@v1
120+
# # with:
121+
# # api_token: ${{ secrets.DEPLOYMENT_TOKEN }}

.github/workflows/client.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Client CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
paths:
7+
- 'apps/client/**'
8+
- 'package.json'
9+
- 'pnpm-lock.yaml'
10+
- '.github/workflows/client.yml'
11+
pull_request:
12+
branches: [ main, master, develop ]
13+
paths:
14+
- 'apps/client/**'
15+
- 'package.json'
16+
- 'pnpm-lock.yaml'
17+
18+
jobs:
19+
client-lint-test:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '20'
29+
30+
- name: Setup pnpm
31+
uses: pnpm/action-setup@v2
32+
with:
33+
version: '8.6.12'
34+
run_install: false
35+
36+
- name: Get pnpm store directory
37+
id: pnpm-cache
38+
shell: bash
39+
run: |
40+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
41+
42+
- name: Cache pnpm dependencies
43+
uses: actions/cache@v4
44+
with:
45+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
46+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
47+
restore-keys: |
48+
${{ runner.os }}-pnpm-store-
49+
50+
- name: Install dependencies
51+
run: pnpm install --frozen-lockfile
52+
53+
- name: Lint Client
54+
run: pnpm --filter client lint
55+
56+
- name: Test Client
57+
run: pnpm --filter client test
58+
env:
59+
NODE_ENV: test
60+
61+
client-build:
62+
needs: client-lint-test
63+
runs-on: ubuntu-latest
64+
steps:
65+
- name: Checkout code
66+
uses: actions/checkout@v4
67+
68+
- name: Setup Node.js
69+
uses: actions/setup-node@v4
70+
with:
71+
node-version: '20'
72+
73+
- name: Setup pnpm
74+
uses: pnpm/action-setup@v2
75+
with:
76+
version: '8.6.12'
77+
run_install: false
78+
79+
- name: Restore pnpm dependencies
80+
uses: actions/cache@v4
81+
with:
82+
path: |
83+
**/node_modules
84+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
85+
restore-keys: |
86+
${{ runner.os }}-pnpm-
87+
88+
- name: Install dependencies
89+
run: pnpm install --frozen-lockfile
90+
91+
- name: Build Client
92+
run: pnpm --filter client build
93+
94+
- name: Upload Client build artifacts
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: client-build
98+
path: apps/client/dist/
99+
retention-days: 7
100+
101+
# Uncomment and configure for deployment when ready
102+
# client-deploy:
103+
# needs: client-build
104+
# runs-on: ubuntu-latest
105+
# if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
106+
# steps:
107+
# - name: Checkout code
108+
# uses: actions/checkout@v4
109+
#
110+
# - name: Download build artifacts
111+
# uses: actions/download-artifact@v4
112+
# with:
113+
# name: client-build
114+
# path: apps/client/dist/
115+
#
116+
# # Add your deployment steps here
117+
# # For example, deployment to a cloud provider like AWS, Azure, or GCP
118+
# # - name: Deploy to production
119+
# # uses: some-deployment-action@v1
120+
# # with:
121+
# # api_token: ${{ secrets.DEPLOYMENT_TOKEN }}

.github/workflows/main.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Main CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
pull_request:
7+
branches: [ main, master, develop ]
8+
9+
jobs:
10+
setup:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
21+
- name: Setup pnpm
22+
uses: pnpm/action-setup@v2
23+
with:
24+
version: '8.6.12'
25+
run_install: false
26+
27+
- name: Get pnpm store directory
28+
id: pnpm-cache
29+
shell: bash
30+
run: |
31+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
32+
33+
- name: Cache pnpm dependencies
34+
uses: actions/cache@v4
35+
with:
36+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
37+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
38+
restore-keys: |
39+
${{ runner.os }}-pnpm-store-
40+
41+
- name: Install dependencies
42+
run: pnpm install --frozen-lockfile
43+
44+
lint-and-test:
45+
needs: setup
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Checkout code
49+
uses: actions/checkout@v4
50+
51+
- name: Setup Node.js
52+
uses: actions/setup-node@v4
53+
with:
54+
node-version: '20'
55+
56+
- name: Setup pnpm
57+
uses: pnpm/action-setup@v2
58+
with:
59+
version: '8.6.12'
60+
run_install: false
61+
62+
- name: Restore pnpm dependencies
63+
uses: actions/cache@v4
64+
with:
65+
path: |
66+
**/node_modules
67+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
68+
restore-keys: |
69+
${{ runner.os }}-pnpm-
70+
71+
- name: Install dependencies
72+
run: pnpm install --frozen-lockfile
73+
74+
- name: Lint
75+
run: pnpm turbo run lint
76+
77+
- name: Test
78+
run: pnpm turbo run test
79+
80+
build:
81+
needs: lint-and-test
82+
runs-on: ubuntu-latest
83+
steps:
84+
- name: Checkout code
85+
uses: actions/checkout@v4
86+
87+
- name: Setup Node.js
88+
uses: actions/setup-node@v4
89+
with:
90+
node-version: '20'
91+
92+
- name: Setup pnpm
93+
uses: pnpm/action-setup@v2
94+
with:
95+
version: '8.6.12'
96+
run_install: false
97+
98+
- name: Restore pnpm dependencies
99+
uses: actions/cache@v4
100+
with:
101+
path: |
102+
**/node_modules
103+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
104+
restore-keys: |
105+
${{ runner.os }}-pnpm-
106+
107+
- name: Install dependencies
108+
run: pnpm install --frozen-lockfile
109+
110+
- name: Build
111+
run: pnpm turbo run build
112+
113+
- name: Cache build output
114+
uses: actions/cache@v4
115+
with:
116+
path: |
117+
apps/api/dist
118+
apps/client/dist
119+
key: ${{ runner.os }}-build-${{ github.sha }}

0 commit comments

Comments
 (0)