Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create @stlite/desktop-cli #330

Merged
merged 3 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -774,3 +774,74 @@ 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

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
120 changes: 120 additions & 0 deletions packages/desktop-cli/.gitignore
Original file line number Diff line number Diff line change
@@ -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.*


1 change: 1 addition & 0 deletions packages/desktop-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# `@stlite/desktop-cli`
10 changes: 10 additions & 0 deletions packages/desktop-cli/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}