Skip to content

Commit 395852b

Browse files
authored
chore: switch to gh actions (#175)
Test on gh actions, publish RC on change to master.
1 parent 5203595 commit 395852b

File tree

5 files changed

+136
-103
lines changed

5 files changed

+136
-103
lines changed

.github/workflows/release.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: deploy
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
publish-rc:
9+
runs-on: ubuntu-latest
10+
env:
11+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
12+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
steps:
14+
- uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
- name: Setup node
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: 16
21+
- name: configure Git User
22+
run: |
23+
git config --global user.email "[email protected]"
24+
git config --global user.name "@$GITHUB_ACTOR"
25+
- name: Authenticate with Registry
26+
run: |
27+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
28+
npm whoami
29+
env:
30+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
31+
- name: release
32+
run: npm run release:rc -- --yes
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yml

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: ci
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
7+
jobs:
8+
check:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v2
13+
with:
14+
node-version: 16
15+
- run: npm install
16+
- run: npm run build
17+
- run: npm run lint
18+
- run: npm run depcheck -- -- -- -p
19+
- run: npm run depcheck -- -- -- -- --unused
20+
test-node:
21+
needs: check
22+
runs-on: ${{ matrix.os }}
23+
name: test ${{ matrix.project }} node ${{ matrix.node }} ${{ matrix.os }}
24+
strategy:
25+
matrix:
26+
os: [windows-latest, ubuntu-latest, macos-latest]
27+
node: [16]
28+
project:
29+
- ipfs-unixfs
30+
- ipfs-unixfs-exporter
31+
- ipfs-unixfs-importer
32+
fail-fast: true
33+
steps:
34+
- uses: actions/checkout@v2
35+
- uses: actions/setup-node@v2
36+
with:
37+
node-version: ${{ matrix.node }}
38+
- run: npm install
39+
- run: npm run build
40+
- run: npm run test -- --scope=${{ matrix.project }} -- -- --cov -t node
41+
test-browser:
42+
needs: check
43+
runs-on: ubuntu-latest
44+
name: test ${{ matrix.project }} ${{ matrix.browser }} ${{ matrix.type }}
45+
strategy:
46+
matrix:
47+
project:
48+
- ipfs-unixfs
49+
- ipfs-unixfs-exporter
50+
- ipfs-unixfs-importer
51+
browser:
52+
- chromium
53+
- firefox
54+
type:
55+
- browser
56+
- webworker
57+
fail-fast: true
58+
steps:
59+
- uses: actions/checkout@v2
60+
- uses: actions/setup-node@v2
61+
with:
62+
node-version: 16
63+
- run: npm install
64+
- run: npm run build
65+
- run: npm run test -- --scope=${{ matrix.project }} -- -- -t ${{ matrix.type }} -- --browser ${{ matrix.browser }}
66+
test-electron:
67+
needs: check
68+
runs-on: ubuntu-latest
69+
name: test ${{ matrix.project }} ${{ matrix.type }}
70+
strategy:
71+
matrix:
72+
project:
73+
- ipfs-unixfs
74+
- ipfs-unixfs-exporter
75+
- ipfs-unixfs-importer
76+
type:
77+
- electron-main
78+
- electron-renderer
79+
fail-fast: true
80+
steps:
81+
- uses: actions/checkout@v2
82+
- uses: actions/setup-node@v2
83+
with:
84+
node-version: 16
85+
- run: npm install
86+
- run: npm run build
87+
- run: npx lerna link # use publishConfig.directory
88+
- uses: GabrielBB/xvfb-action@v1
89+
with:
90+
run: npm run test -- --scope=${{ matrix.project }} -- -- -t ${{ matrix.type }} --bail -f ./dist/cjs/node-test/*.spec.js

.travis.yml

-102
This file was deleted.

packages/ipfs-unixfs-importer/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
"nyc": "^15.0.0",
5050
"readable-stream": "^3.6.0",
5151
"rimraf": "^3.0.2",
52-
"util": "^0.12.3"
52+
"util": "^0.12.3",
53+
"wherearewe": "^1.0.0"
5354
},
5455
"dependencies": {
5556
"@ipld/dag-pb": "^2.0.2",

packages/ipfs-unixfs-importer/test/chunker-rabin.spec.js

+9
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,21 @@ import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
77
import { concat as uint8ArrayConcat } from 'uint8arrays/concat'
88
import asAsyncIterable from './helpers/as-async-iterable.js'
99
import defaultOptions from '../src/options.js'
10+
import { isElectronRenderer } from 'wherearewe'
1011

1112
const rawFile = new Uint8Array(Math.pow(2, 20)).fill(1)
1213

1314
describe('chunker: rabin', function () {
1415
this.timeout(30000)
1516

17+
if (isElectronRenderer) {
18+
it('Does not work on the electron renderer thread - https://github.com/hugomrdias/rabin-wasm/issues/127', function () {
19+
this.skip()
20+
})
21+
22+
return
23+
}
24+
1625
it('chunks non flat buffers', async () => {
1726
const b1 = new Uint8Array(2 * 256)
1827
const b2 = new Uint8Array(1 * 256)

0 commit comments

Comments
 (0)