Skip to content

Test build artifacts. #205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: ci

on:
- push
- pull_request

jobs:

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

- 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@v2

- 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@v2

- 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@v2

- 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@v2

- 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
21 changes: 14 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@
"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",
"debug": "NODE_ENV=debug npm test -- -- -- -st --fail-fast",
"dev": "npm run lint-config-and-fix && npm run lint-and-fix && npm run cover -- -- -st --fail-fast",
"install-hooks": "husky install",
"lint": "xo",
Expand All @@ -59,7 +57,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": "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 @@ -68,7 +72,8 @@
"@babel/register": "7.16.0",
"@commitlint/cli": "15.0.0",
"@js-library/commitlint-config": "0.0.4",
"ava": "3.15.0",
"@node-loader/import-maps": "^1.0.3",
"ava": "^4.0.0-rc.1",
"babel-plugin-transform-remove-console": "6.9.4",
"babel-plugin-unassert": "3.2.0",
"babel-preset-power-assert": "3.0.0",
Expand All @@ -93,8 +98,10 @@
"test/src/**/*"
],
"require": [
"regenerator-runtime/runtime",
"@babel/register"
"regenerator-runtime/runtime"
],
"nodeArguments": [
"--experimental-loader=@node-loader/import-maps"
],
"timeout": "1m"
},
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"
}
}
2 changes: 1 addition & 1 deletion test/src/asyncIterator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava';

import {fromString} from '../../src/index.js';
import {fromString} from '#module';

/**
* @test {Tape#[Symbol.asyncIterator]}
Expand Down
2 changes: 1 addition & 1 deletion test/src/fromReadStream.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs';
import test from 'ava';

import {fromReadStream, toString} from '../../src/index.js';
import {fromReadStream, toString} from '#module';

test('unread token', async (t) => {
const filepath = 'test/data/hello-world.txt';
Expand Down
2 changes: 1 addition & 1 deletion test/src/ignore.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava';

import {fromString, ignore, toString} from '../../src/index.js';
import {fromString, ignore, toString} from '#module';

/**
* @test {ignore}
Expand Down
2 changes: 1 addition & 1 deletion test/src/iterator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava';

import {fromString} from '../../src/index.js';
import {fromString} from '#module';

/**
* Checks that trying to access the synchronous iterator of a tape throws.
Expand Down
2 changes: 1 addition & 1 deletion test/src/map.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava';

import {fromString, toString, map} from '../../src/index.js';
import {fromString, toString, map} from '#module';

/**
* @test {map}
Expand Down
2 changes: 1 addition & 1 deletion test/src/promise.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava';

import {fromString} from '../../src/index.js';
import {fromString} from '#module';

/**
* @test {fromString}
Expand Down
2 changes: 1 addition & 1 deletion test/src/skip.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava';

import {fromString, skip} from '../../src/index.js';
import {fromString, skip} from '#module';

/**
* @test {fromString}
Expand Down
2 changes: 1 addition & 1 deletion test/src/split.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava';

import {fromString, split, toString} from '../../src/index.js';
import {fromString, split, toString} from '#module';

/**
* @test {split}
Expand Down
2 changes: 1 addition & 1 deletion test/src/string.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava';

import {fromString, toString} from '../../src/index.js';
import {fromString, toString} from '#module';

/**
* @test {fromString}
Expand Down
7 changes: 1 addition & 6 deletions test/src/toAsyncCallable.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import test from 'ava';

import {
fromString,
toAsyncCallable,
fromCallable,
toString,
} from '../../src/index.js';
import {fromString, toAsyncCallable, fromCallable, toString} from '#module';

/**
* @test {toAsyncCallable}
Expand Down
7 changes: 1 addition & 6 deletions test/src/unread.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import test from 'ava';

import {
fromString,
toAsyncCallable,
fromCallable,
toString,
} from '../../src/index.js';
import {fromString, toAsyncCallable, fromCallable, toString} from '#module';

/**
* @test {Tape#unread}
Expand Down
Loading