Skip to content

Commit

Permalink
chore: setup CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Gozala committed Mar 9, 2022
1 parent 286e838 commit 0ffb39b
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 1 deletion.
88 changes: 88 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: CI

on:
push:
branches:
- main
paths:
- "src/**"
pull_request:
branches:
- main
paths:
- "src**"
- ".github/workflows/ci.yml"
workflow_dispatch:

jobs:
check:
name: Typecheck
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 16
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup node ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
uses: bahmutov/npm-install@v1

- name: Typecheck
uses: gozala/typescript-error-reporter-action@v1.0.8
with:
project: ./tsconfig.json
test-node:
name: Test Node
runs-on: ${{ matrix.os }}

strategy:
matrix:
node-version:
- 16
os:
- ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
uses: bahmutov/npm-install@v1

- name: Test
run: yarn test:node
test-web:
name: Test Web
runs-on: ubuntu-latest

strategy:
matrix:
node-version:
- 16

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16

- name: Install dependencies
uses: bahmutov/npm-install@v1

- name: Test
run: yarn test:web
43 changes: 43 additions & 0 deletions .github/workflows/convergence.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Convergence

on:
# disable until we actually get these passing
# push:
# branches:
# - main
# paths:
# - "src/**"
# pull_request:
# branches:
# - main
# paths:
# - "src**"
# - ".github/workflows/ci.yml"
workflow_dispatch:

jobs:
test:
name: Test
runs-on: ${{ matrix.os }}

strategy:
matrix:
node-version:
- 16
os:
- ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
uses: bahmutov/npm-install@v1

- name: Test
run: yarn test:convergence
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
push:
branches:
- main
workflow_dispatch:

name: release
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v2
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
# The logic below handles the npm publication:
- uses: actions/checkout@v2
# these if statements ensure that a publication only occurs when
# a new release is created:
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-node@v2
with:
node-version: "16"
registry-url: https://registry.npmjs.org/
if: ${{ steps.release.outputs.release_created }}
- name: Install
uses: bahmutov/npm-install@v1
if: ${{ steps.release.outputs.release_created }}
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release.outputs.release_created }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"test:node": "c8 --check-coverage --branches 100 --functions 100 --lines 100 mocha test/*.spec.js",
"t": "mocha test/*.spec.js",
"coverage": "c8 --reporter=html mocha test/test-*.js && npm_config_yes=true npx st -d coverage -p 8080",
"typecheck": "tsc --build"
"typecheck": "tsc --build",
"test:convergence": "mocha test/convergence.js"
},
"dependencies": {
"@ipld/dag-pb": "^2.1.15",
Expand Down

0 comments on commit 0ffb39b

Please sign in to comment.