mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 22:06:29 +03:00
Improve node publish ci (#3344)
* don't start workflow on py-*tag * move node.js tests to separate action * node.js CI: move PR ID and tags to environment variables * node.js CI: small bracket mistake * delete prebuilds.tar.gz before packaging * use node/README.md as npm README
This commit is contained in:
37
.github/workflows/node-package.yml
vendored
37
.github/workflows/node-package.yml
vendored
@@ -4,11 +4,12 @@ on:
|
|||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- '*'
|
- '*'
|
||||||
|
- '!py-*'
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prebuild:
|
prebuild:
|
||||||
name: 'Tests & Prebuild'
|
name: 'prebuild'
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -50,20 +51,6 @@ jobs:
|
|||||||
cd node
|
cd node
|
||||||
npm install --verbose
|
npm install --verbose
|
||||||
|
|
||||||
- name: Test
|
|
||||||
if: runner.os != 'Windows'
|
|
||||||
run: |
|
|
||||||
cd node
|
|
||||||
npm run test
|
|
||||||
env:
|
|
||||||
DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }}
|
|
||||||
- name: Run tests on Windows, except lint
|
|
||||||
if: runner.os == 'Windows'
|
|
||||||
run: |
|
|
||||||
cd node
|
|
||||||
npm run test:mocha
|
|
||||||
env:
|
|
||||||
DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }}
|
|
||||||
- name: Build Prebuild
|
- name: Build Prebuild
|
||||||
run: |
|
run: |
|
||||||
cd node
|
cd node
|
||||||
@@ -97,7 +84,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
tag=${{ steps.tag.outputs.tag }}
|
tag=${{ steps.tag.outputs.tag }}
|
||||||
if [ -z "$tag" ]; then
|
if [ -z "$tag" ]; then
|
||||||
node -e "console.log('::set-output name=prid::' + '${{ github.ref }}'.split('/')[2])"
|
node -e "console.log('DELTACHAT_NODE_TAR_GZ=deltachat-node-' + '${{ github.ref }}'.split('/')[2] + '.tar.gz')" >> $GITHUB_ENV
|
||||||
else
|
else
|
||||||
echo "No preview will be uploaded this time, but the $tag release"
|
echo "No preview will be uploaded this time, but the $tag release"
|
||||||
fi
|
fi
|
||||||
@@ -108,6 +95,7 @@ jobs:
|
|||||||
cargo -vV
|
cargo -vV
|
||||||
npm --version
|
npm --version
|
||||||
node --version
|
node --version
|
||||||
|
echo $DELTACHAT_NODE_TAR_GZ
|
||||||
- name: Download ubuntu prebuild
|
- name: Download ubuntu prebuild
|
||||||
uses: actions/download-artifact@v1
|
uses: actions/download-artifact@v1
|
||||||
with:
|
with:
|
||||||
@@ -127,6 +115,7 @@ jobs:
|
|||||||
tar -xvzf macos-latest/macos-latest.tar.gz -C node/prebuilds
|
tar -xvzf macos-latest/macos-latest.tar.gz -C node/prebuilds
|
||||||
tar -xvzf windows-latest/windows-latest.tar.gz -C node/prebuilds
|
tar -xvzf windows-latest/windows-latest.tar.gz -C node/prebuilds
|
||||||
tree node/prebuilds
|
tree node/prebuilds
|
||||||
|
rm -rf ubuntu-18.04 macos-latest windows-latest
|
||||||
- name: install dependencies without running scripts
|
- name: install dependencies without running scripts
|
||||||
run: |
|
run: |
|
||||||
npm install --ignore-scripts
|
npm install --ignore-scripts
|
||||||
@@ -136,14 +125,15 @@ jobs:
|
|||||||
- name: package
|
- name: package
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
mv node/README.md README.md
|
||||||
npm pack .
|
npm pack .
|
||||||
ls -lah
|
ls -lah
|
||||||
mv $(find deltachat-node-*) deltachat-node-${{ steps.prepare.outputs.prid }}.tar.gz
|
mv $(find deltachat-node-*) $DELTACHAT_NODE_TAR_GZ
|
||||||
- name: Upload Prebuild
|
- name: Upload Prebuild
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: deltachat-node.tgz
|
name: deltachat-node.tgz
|
||||||
path: deltachat-node-${{ steps.prepare.outputs.prid }}.tar.gz
|
path: ${{ env.DELTACHAT_NODE_TAR_GZ }}
|
||||||
# Upload to download.delta.chat/node/preview/
|
# Upload to download.delta.chat/node/preview/
|
||||||
- name: Upload deltachat-node preview to download.delta.chat/node/preview/
|
- name: Upload deltachat-node preview to download.delta.chat/node/preview/
|
||||||
id: upload-preview
|
id: upload-preview
|
||||||
@@ -151,17 +141,17 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo -e "${{ secrets.SSH_KEY }}" >__TEMP_INPUT_KEY_FILE
|
echo -e "${{ secrets.SSH_KEY }}" >__TEMP_INPUT_KEY_FILE
|
||||||
chmod 600 __TEMP_INPUT_KEY_FILE
|
chmod 600 __TEMP_INPUT_KEY_FILE
|
||||||
if [[ -z "${{ steps.prepare.outputs.prid }}" ]]
|
if [[ -z "$DELTACHAT_NODE_TAR_GZ" ]]
|
||||||
then
|
then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
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/"
|
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE -P "22" -r $DELTACHAT_NODE_TAR_GZ "${{ secrets.USERNAME }}"@"download.delta.chat":"/var/www/html/download/node/preview/"
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: "Post links to details"
|
- name: "Post links to details"
|
||||||
if: steps.upload-preview.outcome == 'success'
|
if: steps.upload-preview.outcome == 'success'
|
||||||
run: node ./node/scripts/postLinksToDetails.js
|
run: node ./node/scripts/postLinksToDetails.js
|
||||||
env:
|
env:
|
||||||
URL: preview/deltachat-node-${{ steps.prepare.outputs.prid }}
|
URL: preview/${{ env.DELTACHAT_NODE_TAR_GZ }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
# Upload to download.delta.chat/node/
|
# Upload to download.delta.chat/node/
|
||||||
- name: Upload deltachat-node build to download.delta.chat/node/
|
- name: Upload deltachat-node build to download.delta.chat/node/
|
||||||
@@ -171,5 +161,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo -e "${{ secrets.SSH_KEY }}" >__TEMP_INPUT_KEY_FILE
|
echo -e "${{ secrets.SSH_KEY }}" >__TEMP_INPUT_KEY_FILE
|
||||||
chmod 600 __TEMP_INPUT_KEY_FILE
|
chmod 600 __TEMP_INPUT_KEY_FILE
|
||||||
mv deltachat-node-${{ steps.prepare.outputs.prid }}.tar.gz deltachat-node-${{ steps.tag.outputs.tag }}.tar.gz
|
$DELTACHAT_NODE_TAG_TAR_GZ=deltachat-node-${{ steps.tag.outputs.tag }}.tar.gz
|
||||||
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE -P "22" -r deltachat-node-${{ steps.tag.outputs.tag }}.tar.gz "${{ secrets.USERNAME }}"@"download.delta.chat":"/var/www/html/download/node/"
|
mv $DELTACHAT_NODE_TAR_GZ $DELTACHAT_NODE_TAG_TAR_GZ
|
||||||
|
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE -P "22" -r $DELTACHAT_NODE_TAG_TAR_GZ "${{ secrets.USERNAME }}"@"download.delta.chat":"/var/www/html/download/node/"
|
||||||
|
|||||||
63
.github/workflows/node-tests.yml
vendored
Normal file
63
.github/workflows/node-tests.yml
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
name: 'node.js'
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prebuild:
|
||||||
|
name: 'tests'
|
||||||
|
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: ${{ matrix.os }}-node-${{ hashFiles('**/package.json') }}
|
||||||
|
|
||||||
|
- name: Cache cargo index
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry/
|
||||||
|
~/.cargo/git
|
||||||
|
target
|
||||||
|
key: ${{ matrix.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: Test
|
||||||
|
if: runner.os != 'Windows'
|
||||||
|
run: |
|
||||||
|
cd node
|
||||||
|
npm run test
|
||||||
|
env:
|
||||||
|
DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }}
|
||||||
|
- name: Run tests on Windows, except lint
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
run: |
|
||||||
|
cd node
|
||||||
|
npm run test:mocha
|
||||||
|
env:
|
||||||
|
DCC_NEW_TMP_EMAIL: ${{ secrets.DCC_NEW_TMP_EMAIL }}
|
||||||
@@ -17,7 +17,7 @@ const STATUS_DATA = {
|
|||||||
state: 'success',
|
state: 'success',
|
||||||
description: '⏩ Click on "Details" to download →',
|
description: '⏩ Click on "Details" to download →',
|
||||||
context: 'Download the node-bindings.tar.gz',
|
context: 'Download the node-bindings.tar.gz',
|
||||||
target_url: base_url + file_url + '.tar.gz',
|
target_url: base_url + file_url,
|
||||||
}
|
}
|
||||||
|
|
||||||
const http = require('https')
|
const http = require('https')
|
||||||
|
|||||||
Reference in New Issue
Block a user