first steps to integrate deltachat-node to core repository, adjust CI:

adjust scripts to new location of deltachat-core-rust
adjust dc-node readme to repo change
mention old repository
migrate github actions, try out if they work
fix path to node docs in SSH github action
passing mailadm token to node tests
hopefully fixing the download paths for the artifacts
fixing download paths, this time for real
post upload link to details
fix scp command
forgot to remove platform_status dict
fixing paths in the github action
add github action to delete node preview builds when PR is closed
move environment variable to yaml
remove git trash
github action to release to npm
use different action which also works with branches for testing
we don't want to publish to NPM through the CI
see what lint issues windows has
This commit is contained in:
missytake
2022-05-02 19:40:16 +02:00
committed by Simon Laux
parent a786a1427d
commit e9511ebfc3
16 changed files with 202 additions and 123 deletions

View File

@@ -0,0 +1,32 @@
# documentation: https://github.com/deltachat/sysadmin/tree/master/download.delta.chat
name: Delete node PR previews
on:
pull_request:
types: [closed]
jobs:
delete:
runs-on: ubuntu-latest
steps:
- name: Get Pullrequest ID
id: getid
run: |
export PULLREQUEST_ID=$(jq .number < $GITHUB_EVENT_PATH)
echo ::set-output name=prid::$PULLREQUEST_ID
- name: Renaming
run: |
# create empty file to copy it over the outdated deliverable on download.delta.chat
echo "This preview build is outdated and has been removed." > empty
cp empty deltachat-node-${{ steps.getid.outputs.prid }}.tar.gz
- name: Replace builds with dummy files
uses: horochx/deploy-via-scp@v1.0.1
with:
user: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
host: "download.delta.chat"
port: 22
local: "deltachat-node-${{ steps.getid.outputs.prid }}.tar.gz"
remote: "/var/www/html/download/node/"

35
.github/workflows/node-docs.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Generate & upload node.js documentation
on:
push:
branches:
- master
- integrate-node-into-repo
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: npm install and generate documentation
run: |
cd node
npm i --ignore-scripts
npx typedoc
mv docs js
- name: Upload
uses: horochx/deploy-via-scp@v1.0.1
with:
user: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
host: "delta.chat"
port: 22
local: "node/js"
remote: "/var/www/html/"

143
.github/workflows/node-package.yml vendored Normal file
View File

@@ -0,0 +1,143 @@
name: 'Build node.js bindings from PR'
on:
pull_request:
jobs:
prebuild:
name: 'Prebuild'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: System info
run: |
rustc -vV
rustup -vV
cargo -vV
npm --version
node --version
- name: Cache node modules
uses: actions/cache@v2
with:
path: |
${{ env.APPDATA }}/npm-cache
~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
- name: Cache cargo index
uses: actions/cache@v2
with:
path: |
~/.cargo/registry/
~/.cargo/git
target
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}-2
- name: Install dependencies & build
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd node
npm install --verbose
- name: Build Prebuild
run: |
cd node
npm run prebuildify
tar -zcvf "${{ matrix.os }}.tar.gz" -C prebuilds .
- name: Upload Prebuild
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.os }}
path: node/${{ matrix.os }}.tar.gz
pack-module:
needs: prebuild
name: 'Package the node_module and upload as artifact for testing'
runs-on: ubuntu-18.04
steps:
- name: install tree
run: sudo apt install tree
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Get Pullrequest ID
id: prepare
run: |
node -e "console.log('::set-output name=prid::' + '${{ github.ref }}'.split('/')[2])"
- name: System info
run: |
rustc -vV
rustup -vV
cargo -vV
npm --version
node --version
- name: Download ubuntu prebuild
uses: actions/download-artifact@v1
with:
name: ubuntu-18.04
path: node/
- name: Download macos prebuild
uses: actions/download-artifact@v1
with:
name: macos-latest
path: node/
- name: Download windows prebuild
uses: actions/download-artifact@v1
with:
name: windows-latest
path: node/
- shell: bash
run: |
cd node
ls -lah
mkdir prebuilds
tar -xvzf ubuntu-18.04.tar.gz -C prebuilds
tar -xvzf macos-latest.tar.gz -C prebuilds
tar -xvzf windows-latest.tar.gz -C prebuilds
tree prebuilds
- name: install dependencies without running scripts
run: |
cd node
npm install --ignore-scripts
- name: build typescript part
run: |
cd node
npm run build:bindings:ts
- name: package
shell: bash
run: |
cd node
npm pack .
ls -lah
mv $(find deltachat-node-*) deltachat-node-${{ steps.prepare.outputs.prid }}.tar.gz
- name: Upload Prebuild
uses: actions/upload-artifact@v1
with:
name: deltachat-node.tgz
path: node/deltachat-node-${{ steps.prepare.outputs.prid }}.tar.gz
# Upload Step
- name: upload folder
id: upload
shell: bash
run: |
cd node
echo -e "${{ secrets.SSH_KEY }}" >__TEMP_INPUT_KEY_FILE
chmod 600 __TEMP_INPUT_KEY_FILE
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/"
continue-on-error: true
- name: "Post links to details"
if: steps.upload.outcome == 'success'
run: node ./node/scripts/postLinksToDetails.js
env:
PR_ID: ${{ steps.prepare.outputs.prid }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

65
.github/workflows/node-tests.yml vendored Normal file
View File

@@ -0,0 +1,65 @@
name: 'Run node.js tests'
on:
pull_request:
push:
branches:
- master
- staging
- trying
jobs:
build-and-test:
name: 'Build & Test'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: System info
run: |
rustc -vV
rustup -vV
cargo -vV
npm --version
node --version
- name: Cache node modules
uses: actions/cache@v1
with:
path: ${{ env.APPDATA }}/npm-cache # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
- name: Cache cargo index
uses: actions/cache@v2
with:
path: |
~/.cargo/registry/
~/.cargo/git
target
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}-2
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd node
npm install --ignore-scripts --verbose
- name: Build deltachat-core-rust & bindings
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd node
npm run build
- name: Test
run: |
cd node
npm run lint-fix
git diff
npm run test
env:
DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }}