Skip to content

Commit 955fa2a

Browse files
authored
feat: Add and split npm actions, refactor test dir (#10)
2 parents 5cb5898 + d41d336 commit 955fa2a

File tree

12 files changed

+96
-40
lines changed

12 files changed

+96
-40
lines changed

.editorconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[*]
2+
charset = utf-8
3+
end_of_line = lf
4+
indent_size = 2
5+
indent_style = space
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true

.github/workflows/dockerhub.yml renamed to .github/workflows/dockerhub-build-publish.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
name: Build and publish Docker image
22

33
on:
4-
push:
5-
tags:
6-
- '*.*.*'
4+
release:
5+
types: [published]
76

87
jobs:
98
docker-build-and-publish:
109
environment:
1110
name: dockerhub
11+
12+
runs-on: ubuntu-latest
13+
1214
permissions:
1315
contents: read
14-
runs-on: ubuntu-latest
16+
1517
steps:
1618
- name: Docker meta
1719
id: meta
@@ -25,7 +27,7 @@ jobs:
2527
type=semver,pattern={{version}}
2628
type=semver,pattern={{major}}.{{minor}}
2729
type=semver,pattern={{major}}
28-
- name: Checkout
30+
- name: Checkout code
2931
uses: actions/checkout@v5
3032

3133
- name: Login to Docker Hub
@@ -46,4 +48,4 @@ jobs:
4648
context: .
4749
platforms: linux/amd64,linux/arm64
4850
push: true
49-
tags: ${{ steps.meta.outputs.tags }}
51+
tags: ${{ steps.meta.outputs.tags }}

.github/workflows/npm-build.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build on Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
npm-build:
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
contents: read
15+
16+
strategy:
17+
matrix:
18+
node-version: [24.x]
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v5
23+
24+
- name: Setup Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: 'npm'
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Run tests
34+
run: npm test

.github/workflows/npm-publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish Package to npmjs
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
npm-publish:
7+
environment:
8+
name: npm-bmssp
9+
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
node-version: [24.x]
15+
16+
permissions:
17+
contents: read
18+
id-token: write
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v5
23+
24+
- name: Setup Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: 'npm'
29+
registry-url: 'https://registry.npmjs.org'
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Publish package
35+
run: npm publish --provenance --access public
36+
env:
37+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/npmjs.yml

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

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,4 @@ vite.config.ts.timestamp-*
145145
*.swp
146146
*~
147147
.DS_Store
148-
Thumbs.db
148+
Thumbs.db

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ RUN npm install
1010
VOLUME ["src/", "tests/"]
1111

1212
# Default command (can be overridden)
13-
CMD ["node", "tests/main.js"]
13+
CMD ["node", "tests/main.js"]

docs/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ <h1>Tsinghua SSSP - BMSSP JS</h1>
7272
Implementation of the Single Source Shortest Path (SSSP) algorithm - Bounded Multiple Source Shortest Paths (BMSSP), originally published by Tsinghua University's research.
7373
</p>
7474
<p>
75-
Read the original paper:
75+
Read the original paper:
7676
<a href="https://dl.acm.org/doi/10.1145/3717823.3718179" target="_blank">
7777
Tsinghua SSSP Paper
7878
</a>
@@ -93,4 +93,4 @@ <h1>Tsinghua SSSP - BMSSP JS</h1>
9393
<a class="btn" href="https://github.com/sirivasv/tsinghua-sssp" target="_blank">View on GitHub</a>
9494
</div>
9595
</body>
96-
</html></svg>
96+
</html></svg>

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bmssp",
3-
"version": "0.5.0",
3+
"version": "0.6.0",
44
"description": "Javascript package implementation of the bmssp algorithm.",
55
"keywords": [
66
"shortest-paths",
@@ -24,6 +24,6 @@
2424
"doc": "docs"
2525
},
2626
"scripts": {
27-
"test": "node tests/main.js"
27+
"test": "node test/main.js"
2828
}
2929
}

0 commit comments

Comments
 (0)