File tree Expand file tree Collapse file tree 8 files changed +86
-7
lines changed Expand file tree Collapse file tree 8 files changed +86
-7
lines changed Original file line number Diff line number Diff line change 1+ name : Build and publish Docker image
2+
3+ on :
4+ push :
5+ tags :
6+ - ' *.*.*'
7+
8+ jobs :
9+ docker-build-and-publish :
10+ environment :
11+ name : dockerhub
12+ permissions :
13+ contents : read
14+ runs-on : ubuntu-latest
15+ steps :
16+ - name : Docker meta
17+ id : meta
18+ uses : docker/metadata-action@v5
19+ with :
20+ # list of Docker images to use as base name for tags
21+ images : |
22+ name/bmssp-js
23+ # generate Docker tags based on the following events/attributes
24+ tags : |
25+ type=semver,pattern={{version}}
26+ type=semver,pattern={{major}}.{{minor}}
27+ type=semver,pattern={{major}}
28+ - name : Checkout
29+ uses : actions/checkout@v4
30+
31+ - name : Login to Docker Hub
32+ uses : docker/login-action@v3
33+ with :
34+ username : ${{ secrets.DOCKERHUB_USERNAME }}
35+ password : ${{ secrets.DOCKERHUB_TOKEN }}
36+
37+ - name : Set up QEMU
38+ uses : docker/setup-qemu-action@v3
39+
40+ - name : Set up Docker Buildx
41+ uses : docker/setup-buildx-action@v3
42+
43+ - name : Build and push
44+ uses : docker/build-push-action@v6
45+ with :
46+ context : .
47+ platforms : linux/amd64,linux/arm64
48+ push : true
49+ tags : ${{ steps.meta.outputs.tags }}
Original file line number Diff line number Diff line change 55jobs :
66 build-and-publish :
77 environment :
8- name : npmjs-publish
8+ name : npm-bmssp
99 runs-on : ubuntu-latest
1010 permissions :
1111 contents : read
1717 with :
1818 node-version : ' 24.x'
1919 registry-url : ' https://registry.npmjs.org'
20+ - run : npm test
2021 - run : npm ci
2122 - run : npm publish --provenance --access public
2223 env :
Original file line number Diff line number Diff line change 1+ FROM node:24-alpine
2+
3+ WORKDIR /app
4+
5+ # Copy package files and install dependencies
6+ COPY package*.json ./
7+ RUN npm install
8+
9+ # Mount src/ directory as a volume
10+ VOLUME ["src/" , "tests/" ]
11+
12+ # Default command (can be overridden)
13+ CMD ["node" , "tests/main.js" ]
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11{
22 "name" : " bmssp" ,
3- "version" : " 0.4 .0" ,
3+ "version" : " 0.5 .0" ,
44 "description" : " Javascript package implementation of the bmssp algorithm." ,
55 "keywords" : [
66 " shortest-paths" ,
1818 },
1919 "license" : " MPL-2.0" ,
2020 "author" : " Saul Ivan Rivas Vega" ,
21- "type" : " commonjs " ,
21+ "type" : " module " ,
2222 "main" : " index.js" ,
2323 "directories" : {
2424 "doc" : " docs"
2525 },
2626 "scripts" : {
27- "test" : " echo \" Error: no test specified \" && exit 1 "
27+ "test" : " node tests/main.js "
2828 }
2929}
Original file line number Diff line number Diff line change 1+ function printMessage ( message ) {
2+ console . log ( message ) ;
3+ }
4+
5+ export { printMessage } ;
Original file line number Diff line number Diff line change 1+ import { printMessage } from "../src/bmssp.mjs" ;
2+
3+ function testFunction ( ) {
4+ try {
5+ const result = printMessage ( "Hello, World!" ) ;
6+ console . log ( 'Test passed:' , result ) ;
7+ } catch ( error ) {
8+ console . error ( 'Test failed:' , error . message ) ;
9+ }
10+ }
11+
12+ testFunction ( ) ;
You can’t perform that action at this time.
0 commit comments