Skip to content

Commit d152f8f

Browse files
authored
Merge pull request #1128 from duffelhq/igorp1/tsp-1261-move-duffel-api-javascript-to-github-actions
Add GitHub actions CI workflow
2 parents ed700cd + 9e0953b commit d152f8f

File tree

6 files changed

+11163
-9349
lines changed

6 files changed

+11163
-9349
lines changed

.circleci/config.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version: 2.1
66

77
aliases:
88
- &working_directory ~/duffel_app
9-
- &cache_directory ~/.cache/yarn
9+
- &cache_directory ~/.yarn/berry/cache
1010

1111
executors:
1212
node-executor:
@@ -29,36 +29,35 @@ commands:
2929
steps:
3030
- restore_cache:
3131
key: v${CACHE_VERSION}-yarn-packages-{{ checksum "yarn.lock" }}
32-
paths:
33-
- *cache_directory
3432

3533
setup:
3634
description: Set up common system expectations
3735
steps:
3836
- checkout
3937
- restore_deps_cache
40-
- run: yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
38+
- run: corepack yarn install --immutable
4139
- save_deps_cache
4240

4341
jobs:
4442
lint:
4543
executor: node-executor
4644
steps:
4745
- setup
48-
- run: yarn lint
49-
- run: yarn prettier-check
46+
- run: corepack yarn lint
47+
- run: corepack yarn prettier-check
5048
test:
5149
executor: node-executor
5250
# We decided to go with `large` because smaller resource classes were running out of memory.
5351
resource_class: large
5452
steps:
5553
- setup
56-
- run: yarn test
54+
- run: corepack yarn test
5755
commitlint:
5856
executor: node-executor
5957
steps:
6058
- setup
61-
- run: yarn commitlint --from main
59+
- run: git fetch origin main --depth=1
60+
- run: corepack yarn commitlint --from origin/main
6261

6362
workflows:
6463
build_test_and_deploy:

.github/workflows/ci.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
lint:
16+
name: Lint
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check out repository
20+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
21+
22+
- name: Set up Node.js
23+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
24+
with:
25+
node-version-file: .tool-versions
26+
27+
- name: Enable Corepack
28+
run: corepack enable
29+
30+
- name: Get yarn cache directory path
31+
id: yarn-cache-dir-path
32+
run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
33+
34+
- name: Cache Yarn packages
35+
uses: actions/cache@v4
36+
with:
37+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
38+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
39+
restore-keys: |
40+
${{ runner.os }}-yarn-
41+
42+
- name: Install dependencies
43+
run: yarn install --immutable
44+
45+
- name: Lint
46+
run: yarn lint
47+
48+
- name: Check formatting
49+
run: yarn prettier-check
50+
51+
test:
52+
name: Test
53+
runs-on: ubuntu-latest
54+
steps:
55+
- name: Check out repository
56+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
57+
58+
- name: Set up Node.js
59+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
60+
with:
61+
node-version-file: .tool-versions
62+
63+
- name: Enable Corepack
64+
run: corepack enable
65+
66+
- name: Get yarn cache directory path
67+
id: yarn-cache-dir-path
68+
run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
69+
70+
- name: Cache Yarn packages
71+
uses: actions/cache@v4
72+
with:
73+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
74+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
75+
restore-keys: |
76+
${{ runner.os }}-yarn-
77+
78+
- name: Install dependencies
79+
run: yarn install --immutable
80+
81+
- name: Run tests
82+
run: yarn test
83+
84+
commitlint:
85+
name: Commitlint
86+
runs-on: ubuntu-latest
87+
steps:
88+
- name: Check out repository
89+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
90+
with:
91+
fetch-depth: 0
92+
93+
- name: Set up Node.js
94+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
95+
with:
96+
node-version-file: .tool-versions
97+
98+
- name: Enable Corepack
99+
run: corepack enable
100+
101+
- name: Get yarn cache directory path
102+
id: yarn-cache-dir-path
103+
run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
104+
105+
- name: Cache Yarn packages
106+
uses: actions/cache@v4
107+
with:
108+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
109+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
110+
restore-keys: |
111+
${{ runner.os }}-yarn-
112+
113+
- name: Install dependencies
114+
run: yarn install --immutable
115+
116+
- name: Fetch main for commitlint
117+
run: git fetch origin main --depth=1
118+
119+
- name: Run commitlint
120+
run: yarn commitlint --from origin/main

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,13 @@ dist
3636

3737
# mock.json helper
3838
mock.json
39-
index.d.ts
39+
index.d.ts
40+
41+
# yarn v4
42+
.pnp.*
43+
.yarn/*
44+
!.yarn/patches
45+
!.yarn/plugins
46+
!.yarn/releases
47+
!.yarn/sdks
48+
!.yarn/versions

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"@commitlint/cz-commitlint": "17.8.1",
7373
"@rollup/plugin-commonjs": "25.0.8",
7474
"@rollup/plugin-node-resolve": "15.3.1",
75+
"@rollup/plugin-terser": "0.4.4",
7576
"@types/jest": "29.5.14",
7677
"@typescript-eslint/eslint-plugin": "6.7.5",
7778
"@typescript-eslint/parser": "6.7.5",
@@ -90,7 +91,6 @@
9091
"rollup-plugin-dts-bundle": "^1.0.0",
9192
"rollup-plugin-inject-process-env": "1.3.1",
9293
"rollup-plugin-peer-deps-external": "2.2.4",
93-
"@rollup/plugin-terser": "0.4.4",
9494
"rollup-plugin-typescript2": "0.36.0",
9595
"semantic-release": "22.0.12",
9696
"ts-jest": "29.4.6",
@@ -120,5 +120,6 @@
120120
"branches": [
121121
"main"
122122
]
123-
}
123+
},
124+
"packageManager": "yarn@4.12.0+sha512.f45ab632439a67f8bc759bf32ead036a1f413287b9042726b7cc4818b7b49e14e9423ba49b18f9e06ea4941c1ad062385b1d8760a8d5091a1a31e5f6219afca8"
124125
}

0 commit comments

Comments
 (0)