Skip to content

Commit c9beaa2

Browse files
missytakeSimon-Laux
authored andcommitted
finish integrating node bindings into core repository
don't ignore core sourcefiles, prevented npm installation on architectures with no prebuild don't run lint checks on windows github actions don't like double quotes apparently minimize node.js CI update ubuntu runner to 22.04 README: update link to node bindings source simplify link in readme node: fix crash with invalid account id (throw error when getContext failed) fix typo in readme remove node specific changelog change prebuild machine back to ubuntu 18.04 move package.json to root level to include rust source in npm package change path in m1 patch github action to upload to download.delta.chat/node/ on tag try build with ubuntu 20.04 Update node/README.md try building it with newer ubuntu because it wants glibc 2.33 fix path for prebuildify script throw error when instanciating a wrapper class on `null` (Context, Message, Chat, ChatList and so on) try fix selecting the right cache to fix the strange glibc bug also revert back ubuntu version to 18.04 also bump package.json version with release script fix paths since we moved around package.json github action: fix path document npm release - it's so much easier now! there are no PR checks to post to if this action is executed on a tag github action: fix artifact names fix paths? wtf do I know, it's 3AM and I'm drunk fix syntax error don't upload preview if action is run on tag is the tag ID an empty string or null? node-package github action is done so far also include scripts in package only publish docs on push to master branch actually bump package.json version in set_core_version script prettify package.json fix test - we don't really need to assert that remove unnecessary ls statement from github action
1 parent b238c7e commit c9beaa2

25 files changed

+243
-1974
lines changed

.github/workflows/node-docs.yml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- master
7-
- integrate-node-into-repo
87

98
jobs:
109
generate:

.github/workflows/node-package.yml

+52-25
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
name: 'Build node.js bindings from PR'
1+
name: 'node.js'
22
on:
33
pull_request:
4+
push:
5+
tags:
6+
- '*'
7+
48

59
jobs:
610
prebuild:
7-
name: 'Prebuild'
11+
name: 'Tests & Prebuild'
812
runs-on: ${{ matrix.os }}
913
strategy:
1014
matrix:
@@ -29,7 +33,7 @@ jobs:
2933
path: |
3034
${{ env.APPDATA }}/npm-cache
3135
~/.npm
32-
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
36+
key: ${{ matrix.os }}-node-${{ hashFiles('**/package.json') }}
3337

3438
- name: Cache cargo index
3539
uses: actions/cache@v2
@@ -38,14 +42,28 @@ jobs:
3842
~/.cargo/registry/
3943
~/.cargo/git
4044
target
41-
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}-2
45+
key: ${{ matrix.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}-2
4246

4347
- name: Install dependencies & build
4448
if: steps.cache.outputs.cache-hit != 'true'
4549
run: |
4650
cd node
4751
npm install --verbose
4852
53+
- name: Test
54+
if: runner.os != 'Windows'
55+
run: |
56+
cd node
57+
npm run test
58+
env:
59+
DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }}
60+
- name: Run tests on Windows, except lint
61+
if: runner.os == 'Windows'
62+
run: |
63+
cd node
64+
npm run test:mocha
65+
env:
66+
DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }}
4967
- name: Build Prebuild
5068
run: |
5169
cd node
@@ -60,7 +78,7 @@ jobs:
6078

6179
pack-module:
6280
needs: prebuild
63-
name: 'Package the node_module and upload as artifact for testing'
81+
name: 'Package deltachat-node and upload to download.delta.chat'
6482
runs-on: ubuntu-18.04
6583
steps:
6684
- name: install tree
@@ -70,10 +88,19 @@ jobs:
7088
- uses: actions/setup-node@v2
7189
with:
7290
node-version: '16'
91+
- name: get tag
92+
id: tag
93+
uses: dawidd6/action-get-tag@v1
94+
continue-on-error: true
7395
- name: Get Pullrequest ID
7496
id: prepare
7597
run: |
76-
node -e "console.log('::set-output name=prid::' + '${{ github.ref }}'.split('/')[2])"
98+
tag=${{ steps.tag.outputs.tag }}
99+
if [ -z "$tag" ]; then
100+
node -e "console.log('::set-output name=prid::' + '${{ github.ref }}'.split('/')[2])"
101+
else
102+
echo "No preview will be uploaded this time, but the $tag release"
103+
fi
77104
- name: System info
78105
run: |
79106
rustc -vV
@@ -85,59 +112,59 @@ jobs:
85112
uses: actions/download-artifact@v1
86113
with:
87114
name: ubuntu-18.04
88-
path: node/
89115
- name: Download macos prebuild
90116
uses: actions/download-artifact@v1
91117
with:
92118
name: macos-latest
93-
path: node/
94119
- name: Download windows prebuild
95120
uses: actions/download-artifact@v1
96121
with:
97122
name: windows-latest
98-
path: node/
99123
- shell: bash
100124
run: |
101-
cd node
102-
ls -lah
103125
mkdir prebuilds
104-
tar -xvzf ubuntu-18.04.tar.gz -C prebuilds
105-
tar -xvzf macos-latest.tar.gz -C prebuilds
106-
tar -xvzf windows-latest.tar.gz -C prebuilds
126+
tar -xvzf ubuntu-18.04/ubuntu-18.04.tar.gz -C prebuilds
127+
tar -xvzf macos-latest/macos-latest.tar.gz -C prebuilds
128+
tar -xvzf windows-latest/windows-latest.tar.gz -C prebuilds
107129
tree prebuilds
108130
- name: install dependencies without running scripts
109131
run: |
110-
cd node
111132
npm install --ignore-scripts
112133
- name: build typescript part
113134
run: |
114-
cd node
115135
npm run build:bindings:ts
116136
- name: package
117137
shell: bash
118138
run: |
119-
cd node
120139
npm pack .
121140
ls -lah
122141
mv $(find deltachat-node-*) deltachat-node-${{ steps.prepare.outputs.prid }}.tar.gz
123142
- name: Upload Prebuild
124143
uses: actions/upload-artifact@v1
125144
with:
126145
name: deltachat-node.tgz
127-
path: node/deltachat-node-${{ steps.prepare.outputs.prid }}.tar.gz
128-
# Upload Step
129-
- name: upload folder
130-
id: upload
146+
path: deltachat-node-${{ steps.prepare.outputs.prid }}.tar.gz
147+
# Upload to download.delta.chat/node/preview/
148+
- name: Upload deltachat-node preview to download.delta.chat/node/preview/
149+
id: upload-preview
131150
shell: bash
132151
run: |
133-
cd node
134152
echo -e "${{ secrets.SSH_KEY }}" >__TEMP_INPUT_KEY_FILE
135153
chmod 600 __TEMP_INPUT_KEY_FILE
136-
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE -P "22" -r deltachat-node-${{ steps.prepare.outputs.prid }}.tar.gz "${{ secrets.USERNAME }}"@"download.delta.chat":"/var/www/html/download/node/"
154+
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE -P "22" -r deltachat-node-${{ steps.prepare.outputs.prid }}.tar.gz "${{ secrets.USERNAME }}"@"download.delta.chat":"/var/www/html/download/node/preview/"
137155
continue-on-error: true
138156
- name: "Post links to details"
139-
if: steps.upload.outcome == 'success'
157+
if: steps.upload-preview.outcome == 'success'
140158
run: node ./node/scripts/postLinksToDetails.js
141159
env:
142-
PR_ID: ${{ steps.prepare.outputs.prid }}
160+
URL: preview/deltachat-node-${{ steps.prepare.outputs.prid }}
143161
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
162+
# Upload to download.delta.chat/node/
163+
- name: Upload deltachat-node build to download.delta.chat/node/
164+
if: ${{ steps.tag.outputs.tag }}
165+
id: upload
166+
shell: bash
167+
run: |
168+
echo -e "${{ secrets.SSH_KEY }}" >__TEMP_INPUT_KEY_FILE
169+
chmod 600 __TEMP_INPUT_KEY_FILE
170+
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE -P "22" -r deltachat-node-${{ steps.prepare.outputs.prid }}.tar.gz "${{ secrets.USERNAME }}"@"download.delta.chat":"/var/www/html/download/node/"

.github/workflows/node-tests.yml

-65
This file was deleted.

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ python/all-testaccounts.txt
3535
tmp/
3636

3737
# from deltachat-node
38-
node/node_modules/
38+
node_modules/
3939
node/build/
4040
node/dist/
4141
node/prebuilds/

.npmignore

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.circleci/
2+
.gitmodules
3+
node/.nyc_output/
4+
.travis.yml
5+
appveyor.yml
6+
node/build/
7+
node/README.md
8+
rustfmt.toml
9+
spec.md
10+
test-data/
11+
build2/
12+
node_modules
13+
.git
14+
.idea/
15+
.pytest_cache
16+
CMakeLists.txt
17+
README.md
18+
contrib/
19+
node/ci_scripts/
20+
coverage/
21+
node/.circleci
22+
node/appveyor.yml
23+
ci/
24+
ci_scripts/
25+
python/
26+
target
27+
proptest-regressions
28+
deltachat-ffi/Doxyfile
29+
scripts
30+
webxdc.md
31+
standards.md
32+
draft/
33+
node/examples/
34+
# deltachat-core-rust/assets # don't exclude assets, otherwise it won't build
35+
node/images/
36+
node/test/
37+
node/windows.md
38+
node/*.tar.gz
39+
node/old_docs.md
40+
.vscode/
41+
.github/
42+
node/.prettierrc.yml

node/.npmrc .npmrc

File renamed without changes.

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
- deprecate unused `marker1before` argument of `dc_get_chat_msgs`
1212
and remove `DC_MSG_ID_MARKER1` constant #3274
1313

14+
### Added
15+
- Now the node-bindings are also part of this repository 🎉
16+
17+
### Fixes
18+
- node: throw error when getting context with an invalid account id
19+
- node: throw error when instanciating a wrapper class on `null` (Context, Message, Chat, ChatList and so on)
20+
21+
### Removed
22+
- node: remove unmaintained coverage scripts
23+
1424

1525
## 1.80.0
1626

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ $ cargo test -- --ignored
128128
Language bindings are available for:
129129

130130
- **C** \[[📂 source](./deltachat-ffi) | [📚 docs](https://c.delta.chat)\]
131-
- **Node.js** \[[📂 source](https://github.com/deltachat/deltachat-node) | [📦 npm](https://www.npmjs.com/package/deltachat-node) | [📚 docs](https://js.delta.chat)\]
131+
- **Node.js** \[[📂 source](./node) | [📦 npm](https://www.npmjs.com/package/deltachat-node) | [📚 docs](https://js.delta.chat)\]
132132
- **Python** \[[📂 source](./python) | [📦 pypi](https://pypi.org/project/deltachat) | [📚 docs](https://py.delta.chat)\]
133133
- **Go** \[[📂 source](https://github.com/deltachat/go-deltachat/)\]
134134
- **Free Pascal** \[[📂 source](https://github.com/deltachat/deltachat-fp/)\]

node/.npmignore

-40
This file was deleted.

0 commit comments

Comments
 (0)