Skip to content

Commit de3e182

Browse files
committed
Just run node18 tests temp
1 parent 4091fc0 commit de3e182

File tree

9 files changed

+31
-261
lines changed

9 files changed

+31
-261
lines changed

.github/workflows/push.yml

Lines changed: 3 additions & 254 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,10 @@ permissions:
1111
contents: read
1212

1313
jobs:
14-
check_commit_message:
15-
name: Check Commit Message
16-
runs-on: ubuntu-latest
17-
outputs:
18-
skip_jobs: ${{ steps.check_message.outputs.skip_jobs }}
19-
steps:
20-
- name: Checkout code
21-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
22-
with:
23-
fetch-depth: 1
24-
- name: Check commit message
25-
id: check_message
26-
env:
27-
COMMIT_MSG: ${{ github.event.head_commit.message }}
28-
run: |
29-
# Use env variable for safe expansion of special characters like quotes.
30-
if [[ "$COMMIT_MSG" == *"[update docs only]"* ]]; then
31-
echo "skip_jobs=true" >> $GITHUB_OUTPUT
32-
echo "Commit message contains [update docs only], skipping regular push jobs"
33-
else
34-
echo "skip_jobs=false" >> $GITHUB_OUTPUT
35-
echo "Running regular push jobs"
36-
fi
37-
3814
main:
39-
name: Build, deploy, lint, typecheck, and test
40-
needs: check_commit_message
41-
if: needs.check_commit_message.outputs.skip_jobs != 'true'
15+
name: Build and test CLI on Node 18
4216
runs-on: ubuntu-latest
4317
steps:
44-
- name: Install system dependencies
45-
run: |
46-
sudo apt-get update
47-
sudo apt-get -y install tabix libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev xvfb
4818
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
4919
with:
5020
persist-credentials: false
@@ -59,164 +29,8 @@ jobs:
5929
- name: Install deps
6030
run: pnpm install --frozen-lockfile
6131

62-
- name: Check @jbrowse/core exports are up-to-date
63-
run: |
64-
node packages/core/scripts/generateExports.mjs
65-
if ! git diff --quiet packages/core/package.json; then
66-
echo "Error: @jbrowse/core exports are out of date!"
67-
echo "Run 'node packages/core/scripts/generateExports.mjs' and commit the changes."
68-
git diff packages/core/package.json
69-
exit 1
70-
fi
71-
72-
# Deploy jbrowse-web first
73-
- name: Validate branch/tag name for S3 path safety
74-
env:
75-
REF_NAME: ${{ github.ref_name }}
76-
run: |
77-
if ! [[ "$REF_NAME" =~ ^[a-zA-Z0-9_.\-]+$ ]]; then
78-
echo "Error: Invalid ref name '$REF_NAME'"
79-
echo "Ref names must contain only alphanumeric characters, hyphens, underscores, and periods"
80-
echo "This prevents path traversal attacks on S3"
81-
exit 1
82-
fi
83-
echo "Ref name validated: $REF_NAME"
84-
- name: Configure AWS credentials
85-
uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v5.1.1
86-
with:
87-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
88-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
89-
aws-region: us-east-1
90-
- name: Build and deploy jbrowse-web
91-
run: |
92-
cd products/jbrowse-web/
93-
NODE_OPTIONS='--max-old-space-size=6500' pnpm build
94-
cd build && zip -r "jbrowse-web-${{ github.ref_name }}.zip" . && cd -
95-
cp build/test_data/config.json build/config.json
96-
aws s3 sync --delete --exclude="*.map" build s3://jbrowse.org/code/jb2/${{ github.ref_name }}
97-
aws cloudfront create-invalidation --distribution-id E13LGELJOT4GQO --paths "/code/jb2/${{ github.ref_name }}/*"
98-
99-
# Lint, typecheck, test
100-
- name: Check code formatting
101-
run: pnpm prettier --check .
102-
- name: Spellcheck
103-
uses: crate-ci/typos@5c19779cb52ea50e151f5a10333ccd269227b5ae # v1.41.0
104-
- name: Lint code
105-
run: pnpm lint
106-
- name: Typecheck code
107-
run: pnpm typecheck
108-
- name: Run tests
109-
id: tests
110-
run: pnpm test-ci
111-
continue-on-error: true
112-
- name: Upload jest image snapshot diffs to S3
113-
if: steps.tests.outcome == 'failure'
114-
run: |
115-
SNAPSHOTS_DIR="products/jbrowse-web/src/tests/__image_snapshots__/__diff_output__"
116-
S3_PATH="s3://jbrowse.org/demos/imagediff/${{ github.run_id }}"
117-
118-
if ls ${SNAPSHOTS_DIR}/*.png 1> /dev/null 2>&1; then
119-
echo "Uploading jest image snapshot diffs to S3..."
120-
aws s3 cp ${SNAPSHOTS_DIR}/ ${S3_PATH}/ --recursive --exclude "*" --include "*.png"
121-
122-
echo ""
123-
echo "============================================"
124-
echo "JEST SNAPSHOT DIFF IMAGES UPLOADED TO S3"
125-
echo "============================================"
126-
for file in ${SNAPSHOTS_DIR}/*.png; do
127-
filename=$(basename "$file")
128-
echo "https://jbrowse.org/demos/imagediff/${{ github.run_id }}/${filename}"
129-
done
130-
echo "============================================"
131-
else
132-
echo "No jest snapshot diff files found"
133-
fi
134-
- name: Fail if tests failed
135-
if: steps.tests.outcome == 'failure'
136-
run: exit 1
13732
- name: Pack artifacts for component tests
13833
run: node --experimental-strip-types scripts/pack.ts
139-
- name: Test build
140-
run: BUILT_TESTS=1 pnpm built-test-ci
141-
- name: Run browser tests with Puppeteer
142-
id: browser-tests
143-
run: node --experimental-strip-types browser-tests/runner.ts
144-
working-directory: products/jbrowse-web
145-
continue-on-error: true
146-
- name: Run auth browser tests with Puppeteer
147-
id: auth-browser-tests
148-
run: node --experimental-strip-types browser-tests/runner.ts --auth
149-
working-directory: products/jbrowse-web
150-
continue-on-error: true
151-
- name: Upload snapshot diffs to S3
152-
if:
153-
steps.browser-tests.outcome == 'failure' ||
154-
steps.auth-browser-tests.outcome == 'failure'
155-
run: |
156-
SNAPSHOTS_DIR="products/jbrowse-web/browser-tests/__snapshots__"
157-
S3_PATH="s3://jbrowse.org/demos/imagediff/${{ github.run_id }}"
158-
159-
if ls ${SNAPSHOTS_DIR}/*.diff*.png 1> /dev/null 2>&1; then
160-
echo "Uploading snapshot diffs to S3..."
161-
aws s3 cp ${SNAPSHOTS_DIR}/ ${S3_PATH}/ --recursive --exclude "*" --include "*.diff*.png"
162-
163-
echo ""
164-
echo "============================================"
165-
echo "SNAPSHOT DIFF IMAGES UPLOADED TO S3"
166-
echo "============================================"
167-
for file in ${SNAPSHOTS_DIR}/*.diff*.png; do
168-
filename=$(basename "$file")
169-
echo "https://jbrowse.org/demos/imagediff/${{ github.run_id }}/${filename}"
170-
done
171-
echo "============================================"
172-
else
173-
echo "No snapshot diff files found"
174-
fi
175-
- name: Fail if browser tests failed
176-
if:
177-
steps.browser-tests.outcome == 'failure' ||
178-
steps.auth-browser-tests.outcome == 'failure'
179-
run: exit 1
180-
181-
# Deploy storybooks
182-
- name: Build LGV storybook
183-
run: pnpm storybook:build
184-
working-directory: products/jbrowse-react-linear-genome-view
185-
186-
- name: Deploy LGV storybook
187-
if:
188-
github.ref == 'refs/heads/main' || startsWith(github.ref,
189-
'refs/tags/')
190-
run: |
191-
aws s3 sync --delete storybook-static s3://jbrowse.org/storybook/lgv/${{ github.ref_name }}
192-
aws cloudfront create-invalidation --distribution-id E13LGELJOT4GQO --paths "/storybook/lgv/${{ github.ref_name }}/*"
193-
working-directory: products/jbrowse-react-linear-genome-view
194-
195-
- name: Build React App storybook
196-
run: pnpm storybook:build
197-
working-directory: products/jbrowse-react-app
198-
199-
- name: Deploy React App storybook
200-
if:
201-
github.ref == 'refs/heads/main' || startsWith(github.ref,
202-
'refs/tags/')
203-
run: |
204-
aws s3 sync --delete storybook-static s3://jbrowse.org/storybook/app/${{ github.ref_name }}
205-
aws cloudfront create-invalidation --distribution-id E13LGELJOT4GQO --paths "/storybook/app/${{ github.ref_name }}/*"
206-
working-directory: products/jbrowse-react-app
207-
208-
- name: Build CGV storybook
209-
run: pnpm storybook:build
210-
working-directory: products/jbrowse-react-circular-genome-view
211-
212-
- name: Deploy CGV storybook
213-
if:
214-
github.ref == 'refs/heads/main' || startsWith(github.ref,
215-
'refs/tags/')
216-
run: |
217-
aws s3 sync --delete storybook-static s3://jbrowse.org/storybook/cgv/${{ github.ref_name }}
218-
aws cloudfront create-invalidation --distribution-id E13LGELJOT4GQO --paths "/storybook/cgv/${{ github.ref_name }}/*"
219-
working-directory: products/jbrowse-react-circular-genome-view
22034

22135
- name: Upload packed artifacts for component tests
22236
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
@@ -225,74 +39,9 @@ jobs:
22539
path: component_tests/*/packed/
22640
retention-days: 1
22741

228-
# Conditionally run the buildwebsite job
229-
buildwebsite:
230-
name: Build website
231-
needs: check_commit_message
232-
if: needs.check_commit_message.outputs.skip_jobs != 'true'
233-
runs-on: ubuntu-latest
234-
steps:
235-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
236-
with:
237-
persist-credentials: false
238-
- uses: pnpm/action-setup@v4
239-
with:
240-
version: 10
241-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
242-
with:
243-
node-version: '22'
244-
cache: 'pnpm'
245-
246-
- name: Install deps
247-
run: pnpm install --frozen-lockfile
248-
working-directory: website
249-
- name: Build website
250-
run: |
251-
cd website/
252-
pnpm build
253-
mkdir testing
254-
mv build testing/jb2
255-
- name: Check website links
256-
uses: untitaker/hyperlink@fb5bb9c5011a3d143a54b4b30aedc30ec5bc0f89 # 0.2.0
257-
with:
258-
args: website/testing/ --check-anchors
259-
260-
# Separate job for component_tests with no permissions.
261-
# These tests install npm packages without a yarn.lock, so untrusted
262-
# dependencies could potentially run malicious code. By isolating this
263-
# in a job with `permissions: {}`, we ensure that even if a rogue
264-
# dependency executes, it has no GitHub token access and cannot push
265-
# code, create issues/PRs, access secrets, or call GitHub APIs.
266-
component_tests:
267-
name: Test embedded components
268-
needs: [check_commit_message, main]
269-
if: needs.check_commit_message.outputs.skip_jobs != 'true'
270-
runs-on: ubuntu-latest
271-
permissions: {}
272-
steps:
273-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
274-
with:
275-
persist-credentials: false
276-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
277-
with:
278-
node-version: '22'
279-
- name: Download packed artifacts
280-
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
281-
with:
282-
name: packed-artifacts
283-
path: component_tests/
284-
- name: Test embedded components
285-
run: |
286-
for dir in component_tests/lgv-vite component_tests/cgv-vite component_tests/app-vite; do
287-
echo "Testing $dir"
288-
(cd $dir && yarn install && yarn e2e)
289-
done
290-
291-
# Test jbrowse-cli on Node 18 to verify backwards compatibility
29242
cli_node18:
29343
name: Test CLI on Node 18
294-
needs: [check_commit_message, main]
295-
if: needs.check_commit_message.outputs.skip_jobs != 'true'
44+
needs: main
29645
runs-on: ubuntu-latest
29746
permissions: {}
29847
steps:
@@ -311,4 +60,4 @@ jobs:
31160
run: |
31261
cd component_tests/cli-node18
31362
yarn install
314-
yarn test
63+
yarn testcli

component_tests/cli-node18/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@
99
"dependencies": {
1010
"@jbrowse/cli": "file:./packed/jbrowse-cli.tgz",
1111
"@jbrowse/text-indexing-core": "file:./packed/jbrowse-text-indexing-core.tgz"
12+
},
13+
"resolutions": {
14+
"@jbrowse/cli": "file:./packed/jbrowse-cli.tgz",
15+
"@jbrowse/text-indexing-core": "file:./packed/jbrowse-text-indexing-core.tgz"
1216
}
1317
}

packages/text-indexing-core/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
},
2121
"author": "JBrowse Team",
2222
"main": "src/index.ts",
23+
"types": "src/index.ts",
24+
"exports": {
25+
".": {
26+
"types": "./src/index.ts",
27+
"import": "./src/index.ts"
28+
}
29+
},
2330
"files": [
2431
"esm"
2532
],
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// used to output a version.js file to the src folder
2+
// this avoids bundlers having to know how to import ../../package.json or similar for downstream consumers
3+
const fs = require('fs')
4+
5+
console.log(
6+
`export const version = '${
7+
JSON.parse(fs.readFileSync('package.json')).version
8+
}'`,
9+
)

products/jbrowse-cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"prebuild": "pnpm clean",
3333
"build": "tsc && webpack -c webpack.config.mjs",
3434
"clean": "rimraf bundle",
35+
"prepublishOnly": "node output-version.js > src/version.ts",
3536
"prepack": "pnpm clean && pnpm build && pnpm generate-readme",
3637
"generate-readme": "./generate_readme.sh > README.md"
3738
},

products/jbrowse-cli/src/commands/text-index/config-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export async function loadConfigForIndexing(
8989
export function ensureTrixDir(outLocation: string): string {
9090
const trixDir = path.join(outLocation, 'trix')
9191
if (!fs.existsSync(trixDir)) {
92-
fs.mkdirSync(trixDir)
92+
fs.mkdirSync(trixDir, { recursive: true })
9393
}
9494
return trixDir
9595
}

products/jbrowse-cli/src/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env node
22

3-
import fs from 'fs'
4-
import path from 'path'
53
import { parseArgs } from 'util'
64

75
// Command imports
@@ -18,6 +16,7 @@ import { run as sortBedRun } from './commands/sort-bed.ts'
1816
import { run as sortGffRun } from './commands/sort-gff.ts'
1917
import { run as textIndexRun } from './commands/text-index/index.ts'
2018
import { run as upgradeRun } from './commands/upgrade.ts'
19+
import { version } from './version.ts'
2120

2221
const commands = {
2322
create: createRun,
@@ -62,10 +61,7 @@ export async function main(args: string[]) {
6261
}
6362

6463
if (flags.version && positionals.length === 0) {
65-
const packageJson = JSON.parse(
66-
fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8'),
67-
)
68-
console.log(`@jbrowse/cli version ${packageJson.version}`)
64+
console.log(`@jbrowse/cli version ${version}`)
6965
return
7066
}
7167

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const version = '4.0.4'

tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
"@jbrowse/core/*": ["packages/core/src/*"],
2727
"@jbrowse/web/*": ["products/jbrowse-web/*"],
2828
"@jbrowse/app-core": ["packages/app-core/src/index.ts"],
29+
"@jbrowse/text-indexing-core": [
30+
"packages/text-indexing-core/src/index.ts"
31+
],
2932
"@jbrowse/plugin-alignments": ["plugins/alignments/src/index.ts"],
3033
"@jbrowse/plugin-hic": ["plugins/hic/src/index.ts"],
3134
"@jbrowse/plugin-linear-genome-view": [

0 commit comments

Comments
 (0)