Skip to content

Commit

Permalink
chore: switch to gh actions (#175)
Browse files Browse the repository at this point in the history
Test on gh actions, publish RC on change to master.
  • Loading branch information
achingbrain authored Sep 14, 2021
1 parent 5203595 commit 395852b
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 103 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: deploy
on:
push:
branches:
- master

jobs:
publish-rc:
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 16
- name: configure Git User
run: |
git config --global user.email "[email protected]"
git config --global user.name "@$GITHUB_ACTOR"
- name: Authenticate with Registry
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
npm whoami
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: release
run: npm run release:rc -- --yes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
90 changes: 90 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: ci
on:
pull_request:
branches:
- master

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: npm run build
- run: npm run lint
- run: npm run depcheck -- -- -- -p
- run: npm run depcheck -- -- -- -- --unused
test-node:
needs: check
runs-on: ${{ matrix.os }}
name: test ${{ matrix.project }} node ${{ matrix.node }} ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
node: [16]
project:
- ipfs-unixfs
- ipfs-unixfs-exporter
- ipfs-unixfs-importer
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- run: npm install
- run: npm run build
- run: npm run test -- --scope=${{ matrix.project }} -- -- --cov -t node
test-browser:
needs: check
runs-on: ubuntu-latest
name: test ${{ matrix.project }} ${{ matrix.browser }} ${{ matrix.type }}
strategy:
matrix:
project:
- ipfs-unixfs
- ipfs-unixfs-exporter
- ipfs-unixfs-importer
browser:
- chromium
- firefox
type:
- browser
- webworker
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: npm run build
- run: npm run test -- --scope=${{ matrix.project }} -- -- -t ${{ matrix.type }} -- --browser ${{ matrix.browser }}
test-electron:
needs: check
runs-on: ubuntu-latest
name: test ${{ matrix.project }} ${{ matrix.type }}
strategy:
matrix:
project:
- ipfs-unixfs
- ipfs-unixfs-exporter
- ipfs-unixfs-importer
type:
- electron-main
- electron-renderer
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: npm run build
- run: npx lerna link # use publishConfig.directory
- uses: GabrielBB/xvfb-action@v1
with:
run: npm run test -- --scope=${{ matrix.project }} -- -- -t ${{ matrix.type }} --bail -f ./dist/cjs/node-test/*.spec.js
102 changes: 0 additions & 102 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion packages/ipfs-unixfs-importer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"nyc": "^15.0.0",
"readable-stream": "^3.6.0",
"rimraf": "^3.0.2",
"util": "^0.12.3"
"util": "^0.12.3",
"wherearewe": "^1.0.0"
},
"dependencies": {
"@ipld/dag-pb": "^2.0.2",
Expand Down
9 changes: 9 additions & 0 deletions packages/ipfs-unixfs-importer/test/chunker-rabin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,21 @@ import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { concat as uint8ArrayConcat } from 'uint8arrays/concat'
import asAsyncIterable from './helpers/as-async-iterable.js'
import defaultOptions from '../src/options.js'
import { isElectronRenderer } from 'wherearewe'

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

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

if (isElectronRenderer) {
it('Does not work on the electron renderer thread - https://github.com/hugomrdias/rabin-wasm/issues/127', function () {
this.skip()
})

return
}

it('chunks non flat buffers', async () => {
const b1 = new Uint8Array(2 * 256)
const b2 = new Uint8Array(1 * 256)
Expand Down

0 comments on commit 395852b

Please sign in to comment.