diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 48c5525e..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: ci -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: 16 - - run: npm install - - run: npm run build - - run: npm run lint - - run: npm run depcheck - test-node: - needs: check - runs-on: ${{ matrix.os }} - name: test ${{ matrix.project }} node ${{ matrix.node }} - strategy: - matrix: - os: [windows-latest, ubuntu-latest, macos-latest] - node: [16] - project: - - ipfs-repo - - ipfs-repo-migrations - fail-fast: true - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - 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-repo -# - ipfs-repo-migrations - browser: - - chromium - - firefox - type: - - browser - - webworker - fail-fast: true - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - 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-repo -# - ipfs-repo-migrations -# type: -# - electron-main -# - electron-renderer -# fail-fast: true -# steps: -# - uses: actions/checkout@v2 -# - uses: actions/setup-node@v1 -# with: -# node-version: 16 -# - run: npm install -# - run: npm run build -# - uses: GabrielBB/xvfb-action@v1 -# with: -# run: npm run test -- --scope=${{ matrix.project }} -- -- -t ${{ matrix.type }} --bail diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..8ec77c44 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,179 @@ +name: Test +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 16 + - uses: actions/cache@v2 + env: + CACHE_NAME: cache-node-modules + with: + path: | + ~/.npm + ./node_modules + ./packages/*/node_modules + ./packages/*/dist + key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }} + - run: | + npm install + npm run build + npx lerna link + + check: + name: Check + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 16 + - uses: actions/cache@v2 + id: cache + env: + CACHE_NAME: cache-node-modules + with: + path: | + ~/.npm + ./node_modules + ./packages/*/node_modules + ./packages/*/dist + key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }} + - name: Install Dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: | + npm install + npm run build + - run: | + npm run lint + npm run dep-check -- -- -- -p + npm run dep-check -- -- -- -- --unused + + test-node: + needs: build + runs-on: ${{ matrix.os }} + name: Unit test ${{ matrix.project }} node ${{ matrix.node }} ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + node: [16] + project: + - ipfs-repo + - ipfs-repo-migrations + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: ${{ github.event.pull_request.commits }} + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + - uses: actions/cache@v2 + id: cache + env: + CACHE_NAME: cache-node-modules + with: + path: | + ~/.npm + ./node_modules + ./packages/*/node_modules + ./packages/*/dist + key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }} + - name: Install Dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: | + npm install + npm run build + - run: npm run test -- --since ${{ github.event.pull_request.base.sha }} --scope=${{ matrix.project }} -- -- --cov -t node + + test-browser: + needs: build + runs-on: ubuntu-latest + name: Unit test ${{ matrix.project }} ${{ matrix.browser }} ${{ matrix.type }} + strategy: + matrix: + project: + - ipfs-repo +# - ipfs-repo-migrations + browser: + - chromium + - firefox + type: + - browser + - webworker + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: ${{ github.event.pull_request.commits }} + - uses: actions/setup-node@v1 + with: + node-version: 16 + - uses: actions/cache@v2 + id: cache + env: + CACHE_NAME: cache-node-modules + with: + path: | + ~/.npm + ./node_modules + ./packages/*/node_modules + ./packages/*/dist + key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }} + - name: Install Dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: | + npm install + npm run build + - run: npm run test -- --since ${{ github.event.pull_request.base.sha }} --scope=${{ matrix.project }} -- -- -t ${{ matrix.type }} -- --browser ${{ matrix.browser }} + +# test-electron: +# needs: build +# runs-on: ubuntu-latest +# name: test ${{ matrix.project }} ${{ matrix.type }} +# strategy: +# matrix: +# project: +# - ipfs-repo +# - ipfs-repo-migrations +# type: +# - electron-main +# - electron-renderer +# steps: +# - uses: actions/checkout@v2 +# with: +# fetch-depth: ${{ github.event.pull_request.commits }} +# - uses: actions/setup-node@v1 +# with: +# node-version: 16 +# - uses: actions/cache@v2 +# id: cache +# env: +# CACHE_NAME: cache-node-modules +# with: +# path: | +# ~/.npm +# ./node_modules +# ./packages/*/node_modules +# ./packages/*/dist +# key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.sha }} +# - name: Install Dependencies +# if: steps.cache.outputs.cache-hit != 'true' +# run: | +# npm install +# npm run build +# - run: npm install +# - run: npm run build +# - uses: GabrielBB/xvfb-action@v1 +# with: +# run: npm run test -- --since ${{ github.event.pull_request.base.sha }} --scope=${{ matrix.project }} -- -- -t ${{ matrix.type }} --bail diff --git a/package.json b/package.json index ddf3d6bf..97c39781 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "build": "lerna run build", "clean": "lerna run clean", "lint": "lerna run lint", - "depcheck": "lerna run depcheck", + "dep-check": "lerna run dep-check", "release": "npm run update-contributors && lerna run build && lerna publish", "release:rc": "lerna run build && lerna publish --canary --preid rc --dist-tag next", "update-contributors": "aegir release --lint=false --test=false --bump=false --build=false --changelog=false --commit=false --tag=false --push=false --ghrelease=false --docs=false --publish=false" diff --git a/packages/ipfs-repo-migrations/package.json b/packages/ipfs-repo-migrations/package.json index ee9162e2..cd38ebfa 100644 --- a/packages/ipfs-repo-migrations/package.json +++ b/packages/ipfs-repo-migrations/package.json @@ -48,7 +48,7 @@ "release": "aegir release", "release-minor": "aegir release --type minor", "release-major": "aegir release --type major", - "depcheck": "aegir dep-check" + "dep-check": "aegir dep-check -i interface-blockstore -i assert -i events -i npm-run-all -i util" }, "dependencies": { "@ipld/dag-pb": "^2.0.0", @@ -60,7 +60,6 @@ "interface-datastore": "^6.0.2", "it-length": "^1.0.1", "multiformats": "^9.0.0", - "proper-lockfile": "^4.1.1", "protobufjs": "^6.10.2", "uint8arrays": "^3.0.0", "varint": "^6.0.0" @@ -79,11 +78,9 @@ "datastore-level": "^7.0.1", "datastore-s3": "^8.0.0", "events": "^3.2.0", - "it-all": "^1.0.2", "just-safe-set": "^2.1.0", "level-5": "npm:level@^5.0.0", "level-6": "npm:level@^6.0.0", - "ncp": "^2.0.0", "npm-run-all": "^4.1.5", "rimraf": "^3.0.0", "sinon": "^11.1.1", diff --git a/packages/ipfs-repo/package.json b/packages/ipfs-repo/package.json index c64a1858..9298874c 100644 --- a/packages/ipfs-repo/package.json +++ b/packages/ipfs-repo/package.json @@ -71,7 +71,7 @@ "release-major": "aegir release --type major --target node", "pretest": "aegir build --esm-tests", "test": "aegir test", - "dep-check": "aegir dep-check -i rimraf" + "dep-check": "aegir dep-check -i rimraf -i interface-blockstore -i assert -i events -i npm-run-all -i util" }, "repository": { "type": "git", @@ -97,12 +97,9 @@ "events": "^3.3.0", "ipfs-utils": "^8.1.3", "it-all": "^1.0.2", - "it-drain": "^1.0.1", - "it-first": "^1.0.2", "just-range": "^2.1.0", "rimraf": "^3.0.0", "sinon": "^11.1.1", - "url": "^0.11.0", "util": "^0.12.3" }, "dependencies": { @@ -112,11 +109,12 @@ "datastore-core": "^6.0.7", "debug": "^4.1.0", "err-code": "^3.0.1", - "eslint-plugin-ava": "^12.0.0", "interface-blockstore": "^2.0.2", "interface-datastore": "^6.0.2", "ipfs-repo-migrations": "^11.0.0", + "it-drain": "^1.0.1", "it-filter": "^1.0.2", + "it-first": "^1.0.2", "it-map": "^1.0.5", "it-merge": "^1.0.2", "it-parallel-batch": "^1.0.9",