Skip to content

Commit 53fe384

Browse files
committed
testing out GH Actions instead of CircleCI
1 parent b487f93 commit 53fe384

File tree

4 files changed

+91
-63
lines changed

4 files changed

+91
-63
lines changed

.circleci/config.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3+
4+
name: CI
5+
6+
on:
7+
push:
8+
branches: ["main"]
9+
pull_request:
10+
branches: ["main"]
11+
12+
jobs:
13+
ci:
14+
runs-on: ubuntu-latest
15+
16+
# strategy:
17+
# matrix:
18+
# node-version: [20.x] # [14.x, 16.x, 18.x]
19+
# # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Install Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 20.x
29+
30+
- uses: pnpm/action-setup@v4
31+
name: Install pnpm
32+
with:
33+
version: 8
34+
run_install: false
35+
36+
- name: Get pnpm store directory
37+
shell: bash
38+
run: |
39+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
40+
41+
- uses: actions/cache@v4
42+
name: Setup pnpm cache
43+
with:
44+
path: ${{ env.STORE_PATH }}
45+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
46+
restore-keys: |
47+
${{ runner.os }}-pnpm-store-
48+
49+
- name: Install dependencies
50+
run: pnpm install
51+
52+
- name: Lint
53+
run: pnpm run lint --format junit -o reports/junit/js-lint-results.xml
54+
55+
- name: Test
56+
run: pnpm run test --ci --runInBand --reporters=default --reporters=jest-junit --coverage
57+
env:
58+
NODE_ENV: ci
59+
JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml"
60+
61+
- uses: actions/upload-artifact@v4
62+
with:
63+
name: reports
64+
path: reports/junit
65+
66+
- uses: actions/upload-artifact@v4
67+
with:
68+
name: coverage
69+
path: coverage
70+
71+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> The most popular [Google Sheets API](https://developers.google.com/sheets/api/guides/concepts) wrapper for javascript / typescript
44
55
[![NPM version](https://img.shields.io/npm/v/google-spreadsheet)](https://www.npmjs.com/package/google-spreadsheet)
6-
[![CircleCI](https://circleci.com/gh/theoephraim/node-google-spreadsheet.svg?style=shield)](https://circleci.com/gh/theoephraim/node-google-spreadsheet)
6+
[![CI status](https://github.com/theoephraim/node-google-spreadsheet/actions/workflows/ci.yml/badge.svg)](https://github.com/theoephraim/node-google-spreadsheet/actions/workflows/ci.yml)
77
[![Known Vulnerabilities](https://snyk.io/test/github/theoephraim/node-google-spreadsheet/badge.svg?targetFile=package.json)](https://snyk.io/test/github/theoephraim/node-google-spreadsheet?targetFile=package.json)
88
[![NPM](https://img.shields.io/npm/dw/google-spreadsheet)](https://www.npmtrends.com/google-spreadsheet)
99

docs/README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
_Welcome to the docs site for_
44

55
# google-spreadsheet
6+
67
> The most popular [Google Sheets API](https://developers.google.com/sheets/api/guides/concepts) wrapper for javascript / typescript
78
89
[![NPM version](https://img.shields.io/npm/v/google-spreadsheet)](https://www.npmjs.com/package/google-spreadsheet)
9-
[![CircleCI](https://circleci.com/gh/theoephraim/node-google-spreadsheet.svg?style=shield)](https://circleci.com/gh/theoephraim/node-google-spreadsheet)
10+
[![CI status](https://github.com/theoephraim/node-google-spreadsheet/actions/workflows/ci.yml/badge.svg)](https://github.com/theoephraim/node-google-spreadsheet/actions/workflows/ci.yml)
1011
[![Known Vulnerabilities](https://snyk.io/test/github/theoephraim/node-google-spreadsheet/badge.svg?targetFile=package.json)](https://snyk.io/test/github/theoephraim/node-google-spreadsheet?targetFile=package.json)
1112
[![NPM](https://img.shields.io/npm/dw/google-spreadsheet)](https://www.npmtrends.com/google-spreadsheet)
1213

@@ -20,37 +21,35 @@ _Welcome to the docs site for_
2021
**Docs site -**
2122
Full docs available at [https://theoephraim.github.io/node-google-spreadsheet](https://theoephraim.github.io/node-google-spreadsheet)
2223

23-
-------------
24+
---
2425

2526
> 🌈 **Installation** - `pnpm i google-spreadsheet`<br/>(or `npm i google-spreadsheet --save` or `yarn add google-spreadsheet`)
2627
2728
## Examples
29+
2830
_The following examples are meant to give you an idea of just some of the things you can do_
2931

30-
> **IMPORTANT NOTE** - To keep the examples concise, I'm calling await [at the top level](https://v8.dev/features/top-level-await) which is not allowed by default in most versions of node. If you need to call await in a script at the root level, you must instead wrap it in an async function like so:
32+
> **IMPORTANT NOTE** - To keep the examples concise, I'm calling await [at the top level](https://v8.dev/features/top-level-await) which is not allowed in some older versions of node. If you need to call await in a script at the root level and your environment does not support it, you must instead wrap it in an async function like so:
3133
3234
```javascript
33-
(async function() {
35+
(async function () {
3436
await someAsyncFunction();
35-
}());
37+
})();
3638
```
3739

38-
3940
### The Basics
41+
4042
```js
4143
import { GoogleSpreadsheet } from 'google-spreadsheet';
4244
import { JWT } from 'google-auth-library';
4345

44-
4546
// Initialize auth - see https://theoephraim.github.io/node-google-spreadsheet/#/guides/authentication
4647
const serviceAccountAuth = new JWT({
4748
// env var values here are copied from service account credentials generated by google
4849
// see "Authentication" section in docs for more info
4950
email: process.env.GOOGLE_SERVICE_ACCOUNT_EMAIL,
5051
key: process.env.GOOGLE_PRIVATE_KEY,
51-
scopes: [
52-
'https://www.googleapis.com/auth/spreadsheets',
53-
],
52+
scopes: ['https://www.googleapis.com/auth/spreadsheets'],
5453
});
5554

5655
const doc = new GoogleSpreadsheet('<the sheet ID from the url>', serviceAccountAuth);
@@ -67,14 +66,15 @@ console.log(sheet.rowCount);
6766
const newSheet = await doc.addSheet({ title: 'another sheet' });
6867
await newSheet.delete();
6968
```
69+
7070
More info:
71+
7172
- [GoogleSpreadsheet](https://theoephraim.github.io/node-google-spreadsheet/#/classes/google-spreadsheet)
7273
- [GoogleSpreadsheetWorksheet](https://theoephraim.github.io/node-google-spreadsheet/#/classes/google-spreadsheet-worksheet)
7374
- [Authentication](https://theoephraim.github.io/node-google-spreadsheet/#/guides/authentication)
7475

75-
76-
7776
### Working with rows
77+
7878
```js
7979
// if creating a new sheet, you can set the header row
8080
const sheet = await doc.addSheet({ headerValues: ['name', 'email'] });
@@ -91,7 +91,7 @@ const rows = await sheet.getRows(); // can pass in { limit, offset }
9191

9292
// read/write row values
9393
console.log(rows[0].get('name')); // 'Larry Page'
94-
rows[1].set('email') = 'sergey@abc.xyz'; // update a value
94+
rows[1].set('email', 'sergey@abc.xyz'); // update a value
9595
rows[2].assign({ name: 'Sundar Pichai', email: 'sundar@google.com' }); // set multiple values
9696
await rows[2].save(); // save updates on a row
9797
await rows[2].delete(); // delete a row
@@ -112,12 +112,12 @@ userRows[0].get('badColumn'); // <- will throw a type error
112112
```
113113

114114
More info:
115+
115116
- [GoogleSpreadsheetWorksheet > Working With Rows](https://theoephraim.github.io/node-google-spreadsheet/#/classes/google-spreadsheet-worksheet#working-with-rows)
116117
- [GoogleSpreadsheetRow](https://theoephraim.github.io/node-google-spreadsheet/#/classes/google-spreadsheet-row)
117118

118-
119-
120119
### Working with cells
120+
121121
```js
122122
await sheet.loadCells('A1:E10'); // loads range of cells into local cache - DOES NOT RETURN THE CELLS
123123
console.log(sheet.cellStats); // total cells, loaded, how many non-empty
@@ -134,11 +134,12 @@ a1.textFormat = { bold: true };
134134
c6.note = 'This is a note!';
135135
await sheet.saveUpdatedCells(); // save all updates in one call
136136
```
137+
137138
More info:
139+
138140
- [GoogleSpreadsheetWorksheet > Working With Cells](https://theoephraim.github.io/node-google-spreadsheet/#/classes/google-spreadsheet-worksheet#working-with-cells)
139141
- [GoogleSpreadsheetCell](https://theoephraim.github.io/node-google-spreadsheet/#/classes/google-spreadsheet-cell)
140142

141-
142143
### Managing docs and sharing
143144

144145
```js
@@ -165,6 +166,7 @@ await newDoc.delete();
165166
```
166167

167168
## Why?
169+
168170
> **This module provides an intuitive wrapper around Google's API to simplify common interactions**
169171
170172
While Google's v4 sheets API is much easier to use than v3 was, the official [googleapis npm module](https://www.npmjs.com/package/googleapis) is a giant autogenerated meta-tool that handles _every Google product_. The module and the API itself are awkward and the docs are pretty terrible, at least to get started.
@@ -173,7 +175,6 @@ While Google's v4 sheets API is much easier to use than v3 was, the official [go
173175
This module makes trade-offs for simplicity of the interface.
174176
Google's API provides a mechanism to make many requests in parallel, so if speed and efficiency are extremely important to your use case, you may want to use their API directly. There are also many lesser-used features of their API that are not implemented here yet.
175177

176-
177178
## Support & Contributions
178179

179180
This module was written and is actively maintained by [Theo Ephraim](https://theoephraim.com).
@@ -193,4 +194,5 @@ The docs site is generated using [docsify](https://docsify.js.org). To preview a
193194
The content lives in markdown files in the docs folder.
194195

195196
## License
197+
196198
This is free and unencumbered public domain software. For more info, see https://unlicense.org.

0 commit comments

Comments
 (0)