Skip to content

Commit

Permalink
🤖 test: Allow to test build with AVA.
Browse files Browse the repository at this point in the history
These changes were automatically generated by an uncommited transform.
  • Loading branch information
a-flying-potato authored and make-github-pseudonymous-again committed Sep 10, 2022
1 parent 6cf02cd commit 73e3690
Show file tree
Hide file tree
Showing 13 changed files with 141 additions and 21 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: ci

on:
- push
- pull_request

jobs:

build:
name: Continuous integration (build)
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Install 📦
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts
useRollingCache: true

- name: Build 🏗️
run: yarn build

- name: Archive build 💽
uses: actions/upload-artifact@v2
with:
name: dist
path: dist
retention-days: 1

test:
needs: ["build"]
name: Continuous integration (tests)
runs-on: ubuntu-latest
strategy:
matrix:
bundle: ["modern", "module", "cjs"]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Install 📦
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts
useRollingCache: true

- name: Load build 💽
uses: actions/download-artifact@v2
with:
name: dist
path: dist

- name: Test 🔬
run: yarn test:${{ matrix.bundle }}
12 changes: 6 additions & 6 deletions .github/workflows/ci:test.yml → .github/workflows/ci:cover.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: ci:test
name: ci:cover
on:
- push
- pull_request
jobs:
test:
name: Continuous integration (tests)
cover:
name: Continuous integration (code coverage)
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Install 🔧
- name: Install 📦
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts
useRollingCache: true

- name: Test 🔬
run: yarn ci:test
- name: Test and record coverage 🔬
run: yarn cover

- name: Publish coverage report 📃
uses: codecov/codecov-action@v2
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/ci:lint-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: ci:lint-config
on:
- push
- pull_request
jobs:
cover:
name: Continuous integration (config linting)
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Install 📦
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts
useRollingCache: true

- name: Lint config 👕
run: yarn lint-config
12 changes: 6 additions & 6 deletions .github/workflows/ci:build.yml → .github/workflows/ci:lint.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: ci:build
name: ci:lint
on:
- push
- pull_request
jobs:
test:
name: Continuous integration (build)
cover:
name: Continuous integration (code linting)
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Install 🔧
- name: Install 📦
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts
useRollingCache: true

- name: Build 🏗️
run: yarn ci:build
- name: Lint 👕
run: yarn lint
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ U.find( a ) === U.find( b ) ; // true

[![License](https://img.shields.io/github/license/union-find/contiguous.svg)](https://raw.githubusercontent.com/union-find/contiguous/main/LICENSE)
[![Version](https://img.shields.io/npm/v/@union-find/contiguous.svg)](https://www.npmjs.org/package/@union-find/contiguous)
[![Tests](https://img.shields.io/github/workflow/status/union-find/contiguous/ci:test?event=push&label=tests)](https://github.com/union-find/contiguous/actions/workflows/ci:test.yml?query=branch:main)
[![Tests](https://img.shields.io/github/workflow/status/union-find/contiguous/ci?event=push&label=tests)](https://github.com/union-find/contiguous/actions/workflows/ci.yml?query=branch:main)
[![Dependencies](https://img.shields.io/librariesio/github/union-find/contiguous.svg)](https://github.com/union-find/contiguous/network/dependencies)
[![GitHub issues](https://img.shields.io/github/issues/union-find/contiguous.svg)](https://github.com/union-find/contiguous/issues)
[![Downloads](https://img.shields.io/npm/dm/@union-find/contiguous.svg)](https://www.npmjs.org/package/@union-find/contiguous)
Expand Down
20 changes: 13 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
"build": "NODE_ENV=production microbundle",
"build-docs": "esdoc",
"build-gh-pages": "npm run build-docs",
"ci:build": "npm run build",
"ci:test": "npm run lint-config && npm run lint && npm run cover",
"commit-msg": "commitlint --edit",
"cover": "NODE_ENV=cover c8 --all --src src --reporter lcov --reporter text-summary --reporter text npm test",
"debug": "NODE_ENV=debug npm run test -- -st --fail-fast",
Expand All @@ -67,7 +65,13 @@
"prepare": "npm run build",
"prepublishOnly": "pinst --disable",
"release": "np --message ':hatching_chick: release: Bumping to v%s.'",
"test": "ava"
"test": "npm run test:src",
"test-cmd": "NODE_LOADER_CONFIG=test/loader/config.js ava",
"test:cjs": "IMPORT_MAP_PATH=test/import-maps/dist/index.json npm run test-cmd",
"test:dist": "npm run test:modern && npm run test:module && npm run test:cjs",
"test:modern": "IMPORT_MAP_PATH=test/import-maps/dist/index.modern.json npm run test-cmd",
"test:module": "IMPORT_MAP_PATH=test/import-maps/dist/index.module.json npm run test-cmd",
"test:src": "IMPORT_MAP_PATH=test/import-maps/src/index.json npm run test-cmd"
},
"dependencies": {},
"devDependencies": {
Expand All @@ -77,6 +81,8 @@
"@commitlint/cli": "17.1.2",
"@js-library/commitlint-config": "0.0.4",
"@node-loader/babel": "2.0.1",
"@node-loader/core": "2.0.0",
"@node-loader/import-maps": "1.1.0",
"ava": "4.3.3",
"babel-plugin-transform-remove-console": "6.9.4",
"babel-plugin-unassert": "3.2.0",
Expand All @@ -100,14 +106,14 @@
"files": [
"test/src/**/*"
],
"nodeArguments": [
"--experimental-loader=@node-loader/babel"
],
"require": [
"regenerator-runtime/runtime"
],
"timeout": "1m",
"concurrency": 8
"concurrency": 8,
"nodeArguments": [
"--experimental-loader=@node-loader/core"
]
},
"babel": {
"sourceMaps": true,
Expand Down
5 changes: 5 additions & 0 deletions test/import-maps/dist/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"#module": "./dist/index.cjs"
}
}
5 changes: 5 additions & 0 deletions test/import-maps/dist/index.modern.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"#module": "./dist/index.modern.js"
}
}
5 changes: 5 additions & 0 deletions test/import-maps/dist/index.module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"#module": "./dist/index.module.js"
}
}
5 changes: 5 additions & 0 deletions test/import-maps/src/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"#module": "./src/index.js"
}
}
8 changes: 8 additions & 0 deletions test/loader/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as importMapLoader from '@node-loader/import-maps';
import * as babelLoader from '@node-loader/babel';

const config = {
loaders: [importMapLoader, babelLoader],
};

export default config;
2 changes: 1 addition & 1 deletion test/src/disjointset.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ForestAmortizedTwoPasses,
ForestAmortizedSplitting,
ForestAmortizedHalving,
} from '../../src/index.js';
} from '#module';

function macro(t, Universe) {
/* eslint-disable no-multi-assign */
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,16 @@
resolved "https://registry.yarnpkg.com/@node-loader/babel/-/babel-2.0.1.tgz#a04d7535b5ade12e3987de04fc5ffe204f26c64c"
integrity sha512-lulESaNn+jyn4lCbfcFWFcRYchsL0jY8q/mf5XRKOiX2uTpkXE3fGAlZ4+wyP/hIAMSlDPuHIUkRSTkJZ6SQyA==

"@node-loader/core@2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@node-loader/core/-/core-2.0.0.tgz#7f5a3a91fe137c8e71c0813f3bbaa0ee136a1308"
integrity sha512-7wV4qj2/tROXGgoYWmNvObUXbXqSv1yUD31K79Jt1q7NDuqrLz4WjjW+wVoCNgVcl8+YSj9BvLX8KsB/SrSzuw==

"@node-loader/import-maps@1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@node-loader/import-maps/-/import-maps-1.1.0.tgz#4785fdce3bc973c5b53a4549248ab42b370ecda9"
integrity sha512-RPB+7vBVhk9xF/eiSGSxEnL6hGQ0a1ua9hvl/MxXDmu7F+Nv+gMwA7AJ0S5TmcgulHAp9/IxobGoFiOxkX7xWQ==

"@nodelib/fs.scandir@2.1.5":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
Expand Down

0 comments on commit 73e3690

Please sign in to comment.