Skip to content

Commit 150fcbe

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/31b7e48f29789fa2e2ad9e16013ff277c3bbca57/src/transforms/ava:test-build.js Please contact the author of the transform if you believe there was an error.
1 parent ca247e4 commit 150fcbe

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 @@ mincut([[0,1],[1,2],[1,3],[2,3],[0,4],[0,5],[4,5]]); // 0--1
1616

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

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
"@heap-data-structure/pairing-heap": "^4.0.0",
@@ -79,6 +83,8 @@
7983
"@iterable-iterator/sorted": "1.0.0",
8084
"@js-library/commitlint-config": "0.0.4",
8185
"@node-loader/babel": "2.0.1",
86+
"@node-loader/core": "2.0.0",
87+
"@node-loader/import-maps": "1.1.0",
8288
"@total-order/lex": "1.0.0",
8389
"ava": "6.1.1",
8490
"babel-plugin-transform-remove-console": "6.9.4",
@@ -104,7 +110,7 @@
104110
"test/src/**/*"
105111
],
106112
"nodeArguments": [
107-
"--experimental-loader=@node-loader/babel"
113+
"--experimental-loader=@node-loader/core"
108114
],
109115
"require": [
110116
"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/mincut.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {map} from '@iterable-iterator/map';
33
import {sorted} from '@iterable-iterator/sorted';
44
import {increasing} from '@total-order/primitive';
55
import {fixedlexicographical} from '@total-order/lex';
6-
import {mincut} from '../../src/index.js';
6+
import {mincut} from '#module';
77

88
function order(edge) {
99
return sorted(increasing, edge);

0 commit comments

Comments
 (0)