Skip to content

Commit fd91b26

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 8115db5 + 3f2c67e commit fd91b26

31 files changed

Lines changed: 17685 additions & 8888 deletions

.github/workflows/build.yml

Lines changed: 16 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ jobs:
1212
- uses: actions/setup-node@v6
1313
with:
1414
node-version-file: .nvmrc
15-
cache: 'yarn'
15+
cache: 'npm'
1616
- name: restore_cache
1717
uses: actions/cache@v5
1818
with:
19-
key: yarn-packages-${{ github.ref_name }}-${{ hashFiles('yarn.lock') }}
19+
key: npm-packages-${{ github.ref_name }}-${{ hashFiles('package-lock.json') }}
2020
path: node_modules/
21-
restore-keys: yarn-packages-${{ github.ref_name }}-
21+
restore-keys: npm-packages-${{ github.ref_name }}-
2222
- name: Install Dependencies
23-
run: yarn --frozen-lockfile
23+
run: npm ci
2424
- name: Lint the codebase
25-
run: yarn lint
25+
run: npm run lint
2626
- name: Run tests
27-
run: yarn test --colors --maxWorkers=2
27+
run: npm test -- --colors --maxWorkers=2
2828
- name: Run build
29-
run: yarn build
29+
run: npm run build
3030
harness-macos:
3131
runs-on: macos-latest
3232
env:
@@ -40,8 +40,8 @@ jobs:
4040
- uses: actions/setup-node@v6
4141
with:
4242
node-version-file: .nvmrc
43-
cache: 'yarn'
44-
- uses: actions/setup-python@v5
43+
cache: 'npm'
44+
- uses: actions/setup-python@v6
4545
with:
4646
python-version: '3.12'
4747
- name: Set up Python virtual environment
@@ -72,11 +72,11 @@ jobs:
7272
curl -I http://0.0.0.0:80
7373
if: env.install_manually
7474
- name: Install Dependencies
75-
run: yarn --frozen-lockfile
75+
run: npm ci
7676
- name: Create CLI binary
77-
run: yarn build.binary
77+
run: npm run build.binary
7878
- name: Run Harness
79-
run: yarn test.harness
79+
run: npm run test.harness
8080
harness-docker:
8181
runs-on: ubuntu-latest
8282
env:
@@ -87,7 +87,7 @@ jobs:
8787
- uses: actions/setup-node@v6
8888
with:
8989
node-version-file: .nvmrc
90-
cache: 'yarn'
90+
cache: 'npm'
9191
- name: Install Python and required packages
9292
run: |
9393
sudo apt-get update
@@ -120,51 +120,8 @@ jobs:
120120
curl -I http://0.0.0.0:80
121121
if: env.install_manually
122122
- name: Install Dependencies
123-
run: yarn --frozen-lockfile
123+
run: npm ci
124124
- name: Create CLI binary
125-
run: yarn build.binary
125+
run: npm run build.binary
126126
- name: Run Harness
127-
run: yarn test.harness
128-
publish:
129-
if: "github.event_name == 'push' && startsWith(github.event.head_commit.message, 'chore: release master')"
130-
runs-on: ubuntu-latest
131-
needs:
132-
- build
133-
- harness-macos
134-
- harness-docker
135-
steps:
136-
- uses: actions/checkout@v6
137-
- uses: actions/setup-node@v6
138-
with:
139-
node-version-file: .nvmrc
140-
cache: 'yarn'
141-
- name: Set git identity
142-
run: git config user.email "circle@circleci.com" && git config user.name "circleci"
143-
- name: Install Dependencies
144-
run: yarn --frozen-lockfile
145-
- name: Build all code to JavaScript
146-
run: yarn build
147-
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
148-
- name: Publish
149-
run: yarn lerna publish from-git --create-release=github --yes
150-
- name: Create CLI binaries
151-
run: npx @yao-pkg/pkg --out-path ./cli-binaries --options max_old_space_size=4096 ./packages/cli/
152-
- uses: actions/upload-artifact@v7
153-
with:
154-
name: cli-binaries
155-
path: "./cli-binaries"
156-
upload_artifacts:
157-
if: "github.event_name == 'push' && startsWith(github.event.head_commit.message, 'chore: release master')"
158-
runs-on: ubuntu-latest
159-
container:
160-
image: golang:1.25
161-
needs:
162-
- publish
163-
steps:
164-
- uses: actions/download-artifact@v8
165-
with:
166-
path: "/tmp/"
167-
- name: Download GitHub Release Utility
168-
run: go install github.com/tcnksm/ghr@latest
169-
- name: Publish Release artifacts on GitHub
170-
run: ghr -t ${{github.token}} -u ${{ github.actor }} -r ${{ github.repository }} -c ${{ github.sha }} ${{ github.ref }} /tmp/cli-binaries
127+
run: npm run test.harness

.github/workflows/release.yml

Lines changed: 217 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,231 @@
11
name: Release
22
on:
3-
push:
3+
workflow_dispatch:
44
branches:
55
- master
6-
7-
permissions:
8-
contents: write
9-
pull-requests: write
6+
inputs:
7+
dry_run:
8+
description: 'Dry run — lint, test, and build; version bump is local only, nothing is pushed or published'
9+
required: false
10+
type: boolean
11+
default: false
12+
13+
env:
14+
HUSKY: 0
1015

1116
jobs:
12-
# Create release PR
13-
release-please:
14-
name: Release Please
17+
validate:
18+
name: Lint, test & build
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v6
22+
- uses: actions/setup-node@v6
23+
with:
24+
node-version-file: .nvmrc
25+
cache: npm
26+
- name: Install dependencies
27+
run: npm ci
28+
- name: Lint
29+
run: npm run lint
30+
- name: Test
31+
run: npm test -- --colors --maxWorkers=2
32+
- name: Build
33+
run: npm run build
34+
35+
harness-macos:
36+
name: Harness tests (macOS)
37+
runs-on: macos-latest
38+
steps:
39+
- uses: maxim-lobanov/setup-xcode@v1.7.0
40+
with:
41+
xcode-version: latest-stable
42+
- uses: actions/checkout@v6
43+
- uses: actions/setup-node@v6
44+
with:
45+
node-version-file: .nvmrc
46+
cache: npm
47+
- uses: actions/setup-python@v6
48+
with:
49+
python-version: '3.12'
50+
- name: Set up Python virtual environment
51+
run: |
52+
python3 -m venv venv
53+
. venv/bin/activate
54+
pip install --upgrade pip
55+
pip install pipenv gunicorn
56+
pipenv --version
57+
gunicorn --version
58+
- run: sudo bash -c 'echo "0.0.0.0 httpbin.org" >> /etc/hosts'
59+
- run: git clone https://github.com/stoplightio/httpbin httpbin
60+
- run: |
61+
cd httpbin
62+
. ../venv/bin/activate
63+
pipenv requirements > requirements.txt
64+
pip install --no-cache-dir -r requirements.txt
65+
pip install --no-cache-dir ./
66+
- run: |
67+
cd httpbin
68+
. ../venv/bin/activate
69+
gunicorn -b 0.0.0.0:80 httpbin:app -k gevent &
70+
sleep 15
71+
curl -I http://0.0.0.0:80
72+
- name: Install dependencies
73+
run: npm ci
74+
- name: Create CLI binary
75+
run: npm run build.binary
76+
- name: Run Harness
77+
run: npm run test.harness
78+
79+
harness-docker:
80+
name: Harness tests (Docker)
81+
runs-on: ubuntu-latest
82+
steps:
83+
- uses: actions/checkout@v6
84+
- uses: actions/setup-node@v6
85+
with:
86+
node-version-file: .nvmrc
87+
cache: npm
88+
- name: Install Python and required packages
89+
run: |
90+
sudo apt-get update
91+
sudo apt-get install -y python3 python3-pip python3-venv
92+
- name: Set up Python virtual environment
93+
run: |
94+
python3 -m venv venv
95+
. venv/bin/activate
96+
pip install --upgrade pip
97+
pip install pipenv gunicorn
98+
pipenv --version
99+
gunicorn --version
100+
- run: sudo bash -c 'echo "0.0.0.0 httpbin.org" >> /etc/hosts'
101+
- run: git clone https://github.com/stoplightio/httpbin httpbin
102+
- run: |
103+
cd httpbin
104+
. ../venv/bin/activate
105+
pipenv requirements > requirements.txt
106+
pip3 install --no-cache-dir -r requirements.txt
107+
pip3 install --no-cache-dir ./
108+
- run: |
109+
cd httpbin
110+
. ../venv/bin/activate
111+
sudo $(which gunicorn) -b 0.0.0.0:80 httpbin:app -k gevent &
112+
sleep 15
113+
curl -I http://0.0.0.0:80
114+
- name: Install dependencies
115+
run: npm ci
116+
- name: Create CLI binary
117+
run: npm run build.binary
118+
- name: Run Harness
119+
run: npm run test.harness
120+
121+
release:
122+
name: Release
123+
runs-on: ubuntu-latest
124+
needs: [validate, harness-macos, harness-docker]
125+
steps:
126+
- name: Checkout
127+
uses: actions/checkout@v6
128+
with:
129+
fetch-depth: 0
130+
token: ${{ secrets.RELEASE_PLEASE_GITHUB_TOKEN }}
131+
132+
- name: Setup Node.js
133+
uses: actions/setup-node@v6
134+
with:
135+
node-version-file: .nvmrc
136+
registry-url: https://registry.npmjs.org
137+
cache: npm
138+
139+
- name: Install dependencies
140+
run: npm ci
141+
142+
- name: Build
143+
run: npm run build
144+
145+
- name: Version bump & GitHub release
146+
run: |
147+
git config user.email "swagger-bot@smartbear.com"
148+
git config user.name "swagger-bot"
149+
npx lerna version --no-private --yes --force-publish ${{ inputs.dry_run && '--no-push' || '' }}
150+
env:
151+
GH_TOKEN: ${{ secrets.RELEASE_PLEASE_GITHUB_TOKEN }}
152+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
153+
154+
- name: Publish npm packages
155+
if: ${{ !inputs.dry_run }}
156+
run: npx lerna publish from-package --no-private --yes
157+
env:
158+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
159+
160+
sync-lockfile:
161+
name: Sync lockfile
15162
runs-on: ubuntu-latest
16-
if: github.repository == 'stoplightio/prism'
17-
outputs:
18-
release_created: ${{ steps.release.outputs.release_created }}
19-
tag_name: ${{ steps.release.outputs.tag_name }}
163+
needs: release
164+
if: ${{ !inputs.dry_run }}
20165
steps:
21-
- name: Checkout Repository
166+
- name: Checkout
22167
uses: actions/checkout@v6
23168
with:
24169
fetch-depth: 0
170+
token: ${{ secrets.RELEASE_PLEASE_GITHUB_TOKEN }}
171+
172+
- name: Setup Node.js
173+
uses: actions/setup-node@v6
174+
with:
175+
node-version-file: .nvmrc
176+
cache: npm
177+
178+
- name: Sync lockfile
179+
run: |
180+
git config user.email "swagger-bot@smartbear.com"
181+
git config user.name "swagger-bot"
182+
git fetch origin
183+
git checkout -B master origin/master
184+
npm install
185+
git add package-lock.json
186+
git diff --cached --quiet || git commit -m "chore: sync lockfile [skip ci]"
187+
git push origin master
25188
26-
- uses: google-github-actions/release-please-action@v4
27-
id: release
189+
build-binaries:
190+
name: Build & publish CLI binaries
191+
runs-on: ubuntu-latest
192+
needs: release
193+
if: ${{ !inputs.dry_run }}
194+
steps:
195+
- name: Checkout
196+
uses: actions/checkout@v6
28197
with:
198+
fetch-depth: 0
29199
token: ${{ secrets.RELEASE_PLEASE_GITHUB_TOKEN }}
30-
target-branch: master
200+
201+
- name: Setup Node.js
202+
uses: actions/setup-node@v6
203+
with:
204+
node-version-file: .nvmrc
205+
cache: npm
206+
207+
- name: Install dependencies
208+
run: npm ci
209+
210+
- name: Build
211+
run: npm run build
212+
213+
- name: Create CLI binaries
214+
run: npx @yao-pkg/pkg --out-path ./cli-binaries --options max_old_space_size=4096 ./packages/cli/
215+
216+
- name: Upload CLI binaries artifact
217+
uses: actions/upload-artifact@v7
218+
with:
219+
name: cli-binaries
220+
path: ./cli-binaries
221+
222+
- name: Set up Go
223+
uses: actions/setup-go@v6
224+
with:
225+
go-version: '1.26'
226+
227+
- name: Download GitHub Release Utility
228+
run: go install github.com/tcnksm/ghr@latest
229+
230+
- name: Publish Release artifacts on GitHub
231+
run: ghr -t ${{ github.token }} -u ${{ github.actor }} -r ${{ github.repository }} -c ${{ github.sha }} ${{ github.ref }} ./cli-binaries

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.release-please-manifest.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)