Skip to content

Commit 4b8810c

Browse files
🤖 config(ci): Allow to test build with AVA.
These changes were automatically generated by a transform whose code can be found at: - https://github.com/make-github-pseudonymous-again/rejuvenate/blob/b27ce6d333a4c46ff5161eaddfbe16895bbabf0f/src/transforms/ava:test-build.js Please contact the author of the transform if you believe there was an error.
1 parent 8ab7421 commit 4b8810c

File tree

11 files changed

+106
-26
lines changed

11 files changed

+106
-26
lines changed

.github/workflows/ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: ci
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
9+
build:
10+
name: Continuous integration (build)
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout 🛎️
14+
uses: actions/checkout@v4
15+
16+
- name: Install 📦
17+
uses: bahmutov/npm-install@v1
18+
with:
19+
install-command: yarn --frozen-lockfile --ignore-scripts
20+
useRollingCache: true
21+
22+
- name: Build 🏗️
23+
run: yarn build
24+
25+
- name: Archive build 💽
26+
uses: actions/upload-artifact@v3
27+
with:
28+
name: dist
29+
path: dist
30+
retention-days: 1
31+
32+
test:
33+
needs: ["build"]
34+
name: Continuous integration (tests)
35+
runs-on: ubuntu-latest
36+
strategy:
37+
matrix:
38+
bundle: ["modern", "module", "cjs"]
39+
steps:
40+
- name: Checkout 🛎️
41+
uses: actions/checkout@v4
42+
43+
- name: Install 📦
44+
uses: bahmutov/npm-install@v1
45+
with:
46+
install-command: yarn --frozen-lockfile --ignore-scripts
47+
useRollingCache: true
48+
49+
- name: Load build 💽
50+
uses: actions/download-artifact@v3
51+
with:
52+
name: dist
53+
path: dist
54+
55+
- name: Test 🔬
56+
run: yarn test:${{ matrix.bundle }}

.github/workflows/ci:build.yml

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ let heap = new FibonacciHeap( increasing ) ;
1616

1717
[![License](https://img.shields.io/github/license/heap-data-structure/fibonacci-heap.svg)](https://raw.githubusercontent.com/heap-data-structure/fibonacci-heap/main/LICENSE)
1818
[![Version](https://img.shields.io/npm/v/@heap-data-structure/fibonacci-heap.svg)](https://www.npmjs.org/package/@heap-data-structure/fibonacci-heap)
19-
[![Tests](https://img.shields.io/github/workflow/status/heap-data-structure/fibonacci-heap/ci:cover?event=push&label=tests)](https://github.com/heap-data-structure/fibonacci-heap/actions/workflows/ci:cover.yml?query=branch:main)
19+
[![Tests](https://img.shields.io/github/workflow/status/heap-data-structure/fibonacci-heap/ci?event=push&label=tests)](https://github.com/heap-data-structure/fibonacci-heap/actions/workflows/ci.yml?query=branch:main)
2020
[![Dependencies](https://img.shields.io/librariesio/github/heap-data-structure/fibonacci-heap.svg)](https://github.com/heap-data-structure/fibonacci-heap/network/dependencies)
2121
[![GitHub issues](https://img.shields.io/github/issues/heap-data-structure/fibonacci-heap.svg)](https://github.com/heap-data-structure/fibonacci-heap/issues)
2222
[![Downloads](https://img.shields.io/npm/dm/@heap-data-structure/fibonacci-heap.svg)](https://www.npmjs.org/package/@heap-data-structure/fibonacci-heap)

package.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
"build": "NODE_ENV=production microbundle",
4545
"build-docs": "esdoc",
4646
"build-gh-pages": "npm run build-docs",
47-
"ci:build": "npm run build",
48-
"ci:test": "npm run lint-config && npm run lint && npm run cover",
4947
"commit-msg": "commitlint --edit",
5048
"cover": "NODE_ENV=cover c8 --all --src src --reporter lcov --reporter text-summary --reporter text npm test",
5149
"debug": "NODE_ENV=debug npm run test -- -st --fail-fast",
@@ -61,7 +59,13 @@
6159
"prepare": "npm run build",
6260
"prepublishOnly": "pinst --disable",
6361
"release": "np --message ':hatching_chick: release: Bumping to v%s.'",
64-
"test": "ava"
62+
"test": "npm run test:src",
63+
"test-cmd": "NODE_LOADER_CONFIG=test/loader/config.js ava",
64+
"test:cjs": "IMPORT_MAP_PATH=test/import-maps/dist/index.json npm run test-cmd",
65+
"test:dist": "npm run test:modern && npm run test:module && npm run test:cjs",
66+
"test:modern": "IMPORT_MAP_PATH=test/import-maps/dist/index.modern.json npm run test-cmd",
67+
"test:module": "IMPORT_MAP_PATH=test/import-maps/dist/index.module.json npm run test-cmd",
68+
"test:src": "IMPORT_MAP_PATH=test/import-maps/src/index.json npm run test-cmd"
6569
},
6670
"dependencies": {
6771
"@data-structure-algebra/circularly-linked-list": "^3.0.0"
@@ -73,6 +77,8 @@
7377
"@heap-data-structure/specification": "16.0.1",
7478
"@js-library/commitlint-config": "0.0.4",
7579
"@node-loader/babel": "2.0.1",
80+
"@node-loader/core": "2.0.0",
81+
"@node-loader/import-maps": "1.1.0",
7682
"ava": "6.1.2",
7783
"babel-plugin-transform-remove-console": "6.9.4",
7884
"babel-plugin-unassert": "3.2.0",
@@ -98,7 +104,7 @@
98104
"test/src/**/*"
99105
],
100106
"nodeArguments": [
101-
"--experimental-loader=@node-loader/babel"
107+
"--experimental-loader=@node-loader/core"
102108
],
103109
"require": [
104110
"regenerator-runtime/runtime.js"

test/import-maps/dist/index.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"imports": {
3+
"#module": "./dist/index.cjs"
4+
}
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"imports": {
3+
"#module": "./dist/index.modern.js"
4+
}
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"imports": {
3+
"#module": "./dist/index.module.js"
4+
}
5+
}

test/import-maps/src/index.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"imports": {
3+
"#module": "./src/index.js"
4+
}
5+
}

test/loader/config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import * as babelLoader from '@node-loader/babel';
2+
import * as importMapLoader from '@node-loader/import-maps';
3+
4+
const config = {
5+
loaders: [importMapLoader, babelLoader],
6+
};
7+
8+
export default config;

test/src/FibonacciHeap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// eslint-disable-next-line ava/use-test
22
import ava from 'ava';
33
import * as spec from '@heap-data-structure/specification';
4-
import {FibonacciHeap} from '../../src/index.js';
4+
import {FibonacciHeap} from '#module';
55

66
const heaps = [['FibonacciHeap', (compare) => new FibonacciHeap(compare)]];
77

0 commit comments

Comments
 (0)