Skip to content

Commit 7799483

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

File tree

2 files changed

+41
-81
lines changed

2 files changed

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

.github/workflows/test.yml

Lines changed: 6 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,8 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- name: Checkout code
19-
uses: actions/checkout@v4
20-
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
18+
- name: Setup and Build
19+
uses: ./.github/actions/setup-and-build
4520

4621
- name: TypeScript typecheck
4722
run: yarn typecheck
@@ -55,33 +30,8 @@ jobs:
5530
needs: lint
5631

5732
steps:
58-
- name: Checkout code
59-
uses: actions/checkout@v4
60-
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
33+
- name: Setup and Build
34+
uses: ./.github/actions/setup-and-build
8535

8636
- name: Start Cloudserver with MongoDB backend
8737
run: docker compose -f .github/docker-compose.cloudserver-mongo.yml up -d
@@ -104,33 +54,8 @@ jobs:
10454
needs: lint
10555

10656
steps:
107-
- name: Checkout code
108-
uses: actions/checkout@v4
109-
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
57+
- name: Setup and Build
58+
uses: ./.github/actions/setup-and-build
13459

13560
- name: Login to GitHub Container Registry
13661
uses: docker/login-action@v3

0 commit comments

Comments
 (0)