From cfabf9aca66a7b8374817c8d8757f336db8e2a73 Mon Sep 17 00:00:00 2001 From: "Yuichiro Tachibana (Tsuchiya)" Date: Thu, 6 Oct 2022 11:48:58 +0900 Subject: [PATCH 1/3] Create @stlite/desktop-cli --- packages/desktop-cli/.gitignore | 120 ++++++++++++++++++++++++++++++ packages/desktop-cli/README.md | 1 + packages/desktop-cli/package.json | 10 +++ 3 files changed, 131 insertions(+) create mode 100644 packages/desktop-cli/.gitignore create mode 100644 packages/desktop-cli/README.md create mode 100644 packages/desktop-cli/package.json diff --git a/packages/desktop-cli/.gitignore b/packages/desktop-cli/.gitignore new file mode 100644 index 000000000..0ea91aa69 --- /dev/null +++ b/packages/desktop-cli/.gitignore @@ -0,0 +1,120 @@ +### https://raw.github.com/github/gitignore/218a941be92679ce67d0484547e3e142b2f5f6f0/Node.gitignore + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + + diff --git a/packages/desktop-cli/README.md b/packages/desktop-cli/README.md new file mode 100644 index 000000000..a965d70de --- /dev/null +++ b/packages/desktop-cli/README.md @@ -0,0 +1 @@ +# `@stlite/desktop-cli` diff --git a/packages/desktop-cli/package.json b/packages/desktop-cli/package.json new file mode 100644 index 000000000..a1c797270 --- /dev/null +++ b/packages/desktop-cli/package.json @@ -0,0 +1,10 @@ +{ + "name": "@stlite/desktop-cli", + "version": "0.11.0", + "license": "Apache-2.0", + "dependencies": { + "@stlite/desktop": "0.11.0", + "node-fetch": "2", + "pyodide": "^0.21.0" + } +} From 412d2a3db86096d014350273e2e247a008f00c46 Mon Sep 17 00:00:00 2001 From: "Yuichiro Tachibana (Tsuchiya)" Date: Thu, 6 Oct 2022 16:54:54 +0900 Subject: [PATCH 2/3] Create build-desktop-cli CI job --- .github/workflows/main.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f83e7dd7d..f9b26b19c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -774,3 +774,39 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') with: files: packages/desktop/stlite-desktop-v*.tgz + + build-desktop-cli: + if: ${{ ! failure() }} # This job should run even if the depending jobs are skipped, but not when those jobs failed: https://qiita.com/abetomo/items/d9ede7dbeeb24f723fc5#%E8%A8%AD%E5%AE%9A%E4%BE%8B4 + needs: [test-desktop] + + env: + python-version: "3.10.2" + node-version: "16.x" + # To avoid an error like "FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory". + # See https://github.com/actions/virtual-environments/issues/70#issuecomment-653886422 + # The Linux VM has 7GB RAM (https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources), + # so we set the max memory size as 6.5 GiB like https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes + NODE_OPTIONS: "--max-old-space-size=6656" + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Package + working-directory: packages/desktop-cli + run: yarn pack + + - name: Upload the built tar ball as an artifact + uses: actions/upload-artifact@v2 + if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} + with: + path: packages/desktop-cli/stlite-desktop-cli-v*.tgz + name: stlite-desktop-cli-${{ github.sha }}.tgz + + - name: Upload the built tar ball as an artifact (when pushed with a version tag) + uses: actions/upload-artifact@v2 + if: startsWith(github.ref, 'refs/tags/v') + with: + path: packages/desktop-cli/stlite-desktop-cli-v*.tgz + name: stlite-desktop-cli-${{ github.ref_name }}.tgz From 997ee07d798ac27b1edc53fd055bdd2ebeec227e Mon Sep 17 00:00:00 2001 From: "Yuichiro Tachibana (Tsuchiya)" Date: Thu, 6 Oct 2022 20:09:18 +0900 Subject: [PATCH 3/3] Add publish-desktop-cli CI job --- .github/workflows/main.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f9b26b19c..e70a1497a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -810,3 +810,38 @@ jobs: with: path: packages/desktop-cli/stlite-desktop-cli-v*.tgz name: stlite-desktop-cli-${{ github.ref_name }}.tgz + + publish-desktop-cli: + if: ${{ !failure() && startsWith(github.ref, 'refs/tags/v') }} # `!failure()` is necessary to avoid skipping this job after successful build: https://github.com/actions/runner/issues/491 + needs: [build-desktop-cli] + + permissions: + contents: write # Necessary for creating releases: https://github.com/softprops/action-gh-release#permissions + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: 'yarn' + registry-url: 'https://registry.npmjs.org' + scope: '@stlite' + + - uses: actions/download-artifact@v3 + id: download-desktop-cli + with: + name: stlite-desktop-cli-${{ github.ref_name }}.tgz + path: packages/desktop-cli + + - run: yarn publish stlite-desktop-cli-v*.tgz --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + working-directory: packages/desktop-cli + + - name: Create a new release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/v') + with: + files: packages/desktop-cli/stlite-desktop-cli-v*.tgz