Skip to content
Open
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
144 changes: 0 additions & 144 deletions .circleci/config.yml

This file was deleted.

7 changes: 5 additions & 2 deletions .circleci/scripts/deploy-docs.sh β†’ .github/scripts/deploy-docs.sh
100644 β†’ 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ red(){
>&2 printf "\e[31m$1\e[39m\n"
}

export PROJECT_NAME="${PROJECT_NAME:-$CIRCLE_PROJECT_REPONAME}"
export PROJECT_NAME="${PROJECT_NAME:-$GITHUB_REPOSITORY}"
if [[ -z "$PROJECT_NAME" ]]; then
red "PROJECT_NAME not set and could not be derived from CIRCLE_PROJECT_REPONAME"
red "PROJECT_NAME not set and could not be derived from GITHUB_REPOSITORY"
exit 1
fi

# Strip the org prefix if GITHUB_REPOSITORY was used (e.g. "org/repo" -> "repo")
PROJECT_NAME="${PROJECT_NAME##*/}"
green "PROJECT_NAME: $PROJECT_NAME"

export BUILD_DIR="${BUILD_DIR:-website}"
Expand Down
File renamed without changes.
105 changes: 105 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: CI

on:
push:
branches:
- '**'
tags:
- '**'
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
test:
name: Test (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [18, 20, 22]
steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: package-lock.json

- name: Install dependencies
run: npm ci --legacy-peer-deps

- name: Run tests
run: npm test

- name: Upload coverage to Coveralls
if: success() && matrix.node-version == 20
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage/lcov.info
continue-on-error: true

deploy-docs:
name: Deploy Docs
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master' || github.ref == 'refs/tags/stg'
environment: Documentation
steps:
- uses: actions/checkout@v4

- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}

- name: Deploy docs
run: bash ./.github/scripts/deploy-docs.sh
env:
PROJECT_NAME: ${{ github.event.repository.name }}

deploy-package:
name: Publish to npm
runs-on: ubuntu-latest
needs: test
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref_name, '.')
environment: npm-publish
steps:
- uses: actions/checkout@v4

- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: package-lock.json
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci --legacy-peer-deps

- name: Publish to npm
run: |
if [[ "${{ github.ref_name }}" = *-* ]]; then
npm publish --tag=prerelease
else
npm publish
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# claycli
A CLI For Clay!

[![CircleCI](https://circleci.com/gh/clay/claycli.svg?style=svg)](https://circleci.com/gh/clay/claycli) [![Coverage Status](https://coveralls.io/repos/github/clay/claycli/badge.svg?branch=master)](https://coveralls.io/github/clay/claycli?branch=master)
[![CI](https://github.com/clay/claycli/actions/workflows/ci.yml/badge.svg)](https://github.com/clay/claycli/actions/workflows/ci.yml) [![Coverage Status](https://coveralls.io/repos/github/clay/claycli/badge.svg?branch=master)](https://coveralls.io/github/clay/claycli?branch=master)

# Installation

Expand Down
8 changes: 6 additions & 2 deletions lib/cmd/import.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ describe('import', () => {

it('returns error if bad JSON', () => {
return lib(']{"a"\:}', url).toPromise(Promise).then((res) => {
expect(res).toEqual({ type: 'error', message: 'JSON syntax error: Unexpected token ] in JSON at position 0', details: ']{"a":}' });
expect(res).toMatchObject({
type: 'error',
details: ']{"a":}',
message: expect.stringMatching(/^JSON syntax error:/),
});
});
});

Expand Down Expand Up @@ -246,7 +250,7 @@ describe('import', () => {

it('returns error if bad json', () => {
return fn(JSON.stringify({ a: 'hi' }) + 'a', url).toPromise(Promise).catch((e) => {
expect(e.message).toBe('JSON parser error: Unexpected token a in JSON at position 10');
expect(e.message).toMatch(/^JSON parser error:/);
});
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"lint": "eslint lib cli index.js",
"test": "npm run lint && jest",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"release": "./.circleci/scripts/release.sh",
"release": "./.github/scripts/release.sh",
"watch": "jest --watch"
},
"jest": {
Expand Down
Loading