Skip to content

Commit b0cd583

Browse files
move common workflow steps into composite action
ISSUE: CLDSRVCLT-7
1 parent b08d42c commit b0cd583

File tree

2 files changed

+38
-72
lines changed

2 files changed

+38
-72
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 'Setup and Build'
2+
description: 'Common setup steps: install dependencies, setup Smithy, cache, and build'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: Setup Node.js
8+
uses: actions/setup-node@v4
9+
with:
10+
node-version: '20'
11+
cache: 'yarn'
12+
13+
- name: Install dependencies
14+
shell: bash
15+
run: yarn install --frozen-lockfile
16+
17+
- name: Setup Smithy CLI
18+
uses: ./.github/actions/setup-smithy
19+
20+
- name: Cache build output
21+
uses: actions/cache@v4
22+
with:
23+
path: |
24+
build/
25+
dist/
26+
key: build-${{ hashFiles('models/**', 'service/**', 'smithy-build.json') }}
27+
restore-keys: |
28+
build-
29+
30+
- name: Build
31+
shell: bash
32+
run: yarn build

.github/workflows/test.yml

Lines changed: 6 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,8 @@ jobs:
1818
- name: Checkout code
1919
uses: actions/checkout@v4
2020

21-
- name: Setup Node.js
22-
uses: actions/setup-node@v4
23-
with:
24-
node-version: '20'
25-
cache: 'yarn'
26-
27-
- name: Install dependencies
28-
run: yarn install --frozen-lockfile
29-
30-
- name: Setup Smithy CLI
31-
uses: ./.github/actions/setup-smithy
32-
33-
- name: Cache build output
34-
uses: actions/cache@v4
35-
with:
36-
path: |
37-
build/
38-
dist/
39-
key: build-${{ hashFiles('models/**', 'service/**', 'smithy-build.json') }}
40-
restore-keys: |
41-
build-
42-
43-
- name: Build
44-
run: yarn build
21+
- name: Setup and Build
22+
uses: ./.github/actions/setup-and-build
4523

4624
- name: TypeScript typecheck
4725
run: yarn typecheck
@@ -58,30 +36,8 @@ jobs:
5836
- name: Checkout code
5937
uses: actions/checkout@v4
6038

61-
- name: Setup Node.js
62-
uses: actions/setup-node@v4
63-
with:
64-
node-version: '20'
65-
cache: 'yarn'
66-
67-
- name: Install dependencies
68-
run: yarn install --frozen-lockfile
69-
70-
- name: Setup Smithy CLI
71-
uses: ./.github/actions/setup-smithy
72-
73-
- name: Cache build output
74-
uses: actions/cache@v4
75-
with:
76-
path: |
77-
build/
78-
dist/
79-
key: build-${{ hashFiles('models/**', 'service/**', 'smithy-build.json') }}
80-
restore-keys: |
81-
build-
82-
83-
- name: Build
84-
run: yarn build
39+
- name: Setup and Build
40+
uses: ./.github/actions/setup-and-build
8541

8642
- name: Start Cloudserver with MongoDB backend
8743
run: docker compose -f .github/docker-compose.cloudserver-mongo.yml up -d
@@ -107,30 +63,8 @@ jobs:
10763
- name: Checkout code
10864
uses: actions/checkout@v4
10965

110-
- name: Setup Node.js
111-
uses: actions/setup-node@v4
112-
with:
113-
node-version: '20'
114-
cache: 'yarn'
115-
116-
- name: Install dependencies
117-
run: yarn install --frozen-lockfile
118-
119-
- name: Setup Smithy CLI
120-
uses: ./.github/actions/setup-smithy
121-
122-
- name: Cache build output
123-
uses: actions/cache@v4
124-
with:
125-
path: |
126-
build/
127-
dist/
128-
key: build-${{ hashFiles('models/**', 'service/**', 'smithy-build.json') }}
129-
restore-keys: |
130-
build-
131-
132-
- name: Build
133-
run: yarn build
66+
- name: Setup and Build
67+
uses: ./.github/actions/setup-and-build
13468

13569
- name: Login to GitHub Container Registry
13670
uses: docker/login-action@v3

0 commit comments

Comments
 (0)