Skip to content

Commit ec44478

Browse files
hkfbw1nklr
andauthored
ci: dry-run semantic release in PR validation (#2493)
Co-authored-by: t0oF <93762994+w1nklr@users.noreply.github.com>
1 parent 34f7141 commit ec44478

File tree

6 files changed

+86
-23
lines changed

6 files changed

+86
-23
lines changed

.github/workflows/typescript.yml

Lines changed: 76 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
grep -q '"lockfileVersion": 3,' ./package-lock.json
4949
5050
npm ci CYPRESS_INSTALL_BINARY=0 --ignore-scripts
51+
5152
- name: ⏭️ Modifications when prerelease
5253
if: github.event.release.prerelease
5354
run: echo "NPM_PUBLISH_TAG=next" >> $GITHUB_ENV
@@ -81,10 +82,68 @@ jobs:
8182
# Use 'latest' tag if $NPM_PUBLISH_TAG is not set:
8283
npm publish --access public --tag ${NPM_PUBLISH_TAG:-latest}
8384
85+
smoke_tests:
86+
# Run on all events defined above, except pushes which are not to master
87+
if: github.event_name != 'push' || github.ref == 'refs/heads/master'
88+
runs-on: ubuntu-latest
89+
name: "Storybook Smoke Tests"
90+
91+
container:
92+
image: mcr.microsoft.com/playwright:v1.39.0-jammy
93+
options: --user 1001
94+
95+
steps:
96+
- name: 📖 Checkout commit locally
97+
uses: actions/checkout@v3
98+
99+
- name: 📦 Install build dependencies
100+
run: |
101+
npm ci CYPRESS_INSTALL_BINARY=0 --ignore-scripts
102+
103+
- name: 🏗️ Build packages
104+
run: |
105+
npx nx run-many -t build
106+
107+
- name: 📚 Build Storybook
108+
run: npm run build-storybook
109+
110+
- name: Run smoke tests
111+
112+
env:
113+
PORT: 8080
114+
HOST: 127.0.0.1
115+
116+
run: |
117+
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
118+
"npx http-server storybook-static --port $PORT -a $HOST" \
119+
"npx wait-on http://$HOST:$PORT/ && npm run storybook:test -- --ci --url http://$HOST:$PORT/"
120+
121+
storybook:
122+
# Always validate Storybook build. Deploy it only on pushes to master.
123+
if: github.event_name != 'push' || github.ref == 'refs/heads/master'
124+
runs-on: ubuntu-latest
125+
name: "📚 Build and conditionally deploy Storybook"
126+
steps:
127+
- name: 📖 Checkout commit locally
128+
uses: actions/checkout@v3
129+
130+
- name: Setup Node.js
131+
uses: actions/setup-node@v3
132+
with:
133+
node-version: 18
134+
135+
- name: 📦 Install build dependencies
136+
run: |
137+
npm ci CYPRESS_INSTALL_BINARY=0 --ignore-scripts
138+
139+
- name: 🏗️ Build packages
140+
run: |
141+
npx nx run-many -t build
142+
84143
- name: 📚 Build Storybook
85144
run: npm run build-storybook
86145

87-
- name: 📚 Update Storybook
146+
- name: 📚 Update deployed Storybook
88147
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
89148
run: |
90149
rm -rf ../../storybook-static
@@ -108,20 +167,21 @@ jobs:
108167
git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages
109168
fi
110169
111-
smoke_tests:
112-
# Run on all events defined above, except pushes which are not to master
170+
release_dry_run:
171+
# Dry-run semantic release on PR and pushes to master
113172
if: github.event_name != 'push' || github.ref == 'refs/heads/master'
114173
runs-on: ubuntu-latest
115-
name: "Storybook Smoke Tests"
116-
117-
container:
118-
image: mcr.microsoft.com/playwright:v1.39.0-jammy
119-
options: --user 1001
174+
name: "🔼 Dry-run semantic release"
120175

121176
steps:
122177
- name: 📖 Checkout commit locally
123178
uses: actions/checkout@v3
124179

180+
- name: Setup Node.js
181+
uses: actions/setup-node@v3
182+
with:
183+
node-version: 18
184+
125185
- name: 📦 Install build dependencies
126186
run: |
127187
npm ci CYPRESS_INSTALL_BINARY=0 --ignore-scripts
@@ -130,16 +190,14 @@ jobs:
130190
run: |
131191
npx nx run-many -t build
132192
133-
- name: 📚 Build Storybook
134-
run: npm run build-storybook
193+
- name: 🔼 Dry-run semantic release
194+
working-directory: ./typescript
195+
run: npx nx run-many --target="semantic-release:dry-run" --parallel=false
196+
env:
197+
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
198+
GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
199+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
200+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
135201

136-
- name: Run smoke tests
137202

138-
env:
139-
PORT: 8080
140-
HOST: 127.0.0.1
141203

142-
run: |
143-
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
144-
"npx http-server storybook-static --port $PORT -a $HOST" \
145-
"npx wait-on http://$HOST:$PORT/ && npm run storybook:test -- --ci --url http://$HOST:$PORT/"

typescript/packages/group-tree-plot/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"transpile": "tsc --project ./tsconfig.json",
1212
"copy-files": "copyfiles --up 1 \"src/**/*.css\" dist/",
1313
"build": "git clean -xdff dist && npm run transpile && npm run copy-files",
14-
"doc": "git clean -xdff docs && typedoc src"
14+
"doc": "git clean -xdff docs && typedoc src",
15+
"semantic-release:dry-run": "semantic-release --dry-run"
1516
},
1617
"author": "Equinor <opensource@equinor.com>",
1718
"license": "MPL-2.0",

typescript/packages/subsurface-viewer/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"test:update": "npm test -- --u",
2828
"test:watch": "npm test -- --watch",
2929
"test:debug": "node --inspect-brk ../../node_modules/jest/bin/jest.js --coverage=false --runInBand",
30-
"doc": "git clean -xdff docs && typedoc src"
30+
"doc": "git clean -xdff docs && typedoc src",
31+
"semantic-release:dry-run": "semantic-release --dry-run"
3132
},
3233
"author": "Equinor <opensource@equinor.com>",
3334
"license": "MPL-2.0",

typescript/packages/well-completions-plot/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"test": "jest --coverage",
1717
"test:update": "npm test -- --u",
1818
"test:watch": "npm test -- --watch",
19-
"doc": "git clean -xdff docs && typedoc src"
19+
"doc": "git clean -xdff docs && typedoc src",
20+
"semantic-release:dry-run": "semantic-release --dry-run"
2021
},
2122
"author": "Equinor <opensource@equinor.com>",
2223
"license": "MPL-2.0",

typescript/packages/well-log-viewer/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"test": "jest --coverage",
1717
"test:update": "npm test -- --u",
1818
"test:watch": "npm test -- --watch",
19-
"doc": "git clean -xdff docs && typedoc src"
19+
"doc": "git clean -xdff docs && typedoc src",
20+
"semantic-release:dry-run": "semantic-release --dry-run"
2021
},
2122
"author": "Equinor <opensource@equinor.com>",
2223
"license": "MPL-2.0",

typescript/packages/wsc-common/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"test": "jest --coverage",
1616
"test:update": "npm test -- --u",
1717
"test:watch": "npm test -- --watch",
18-
"doc": "git clean -xdff docs && typedoc src"
18+
"doc": "git clean -xdff docs && typedoc src",
19+
"semantic-release:dry-run": "semantic-release --dry-run"
1920
},
2021
"author": "Equinor <opensource@equinor.com>",
2122
"license": "MPL-2.0",

0 commit comments

Comments
 (0)