Makefile 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. .PHONY: test
  2. build: clean lint build_python build_electron
  3. publish: clean lint publish_electron publish_python publish_github_pages publish_cask publish_winget
  4. install:
  5. @[ -d node_modules ] || npm install
  6. clean:
  7. rm -rf ./dist
  8. rm -rf ./node_modules
  9. rm -rf ./package-lock.json
  10. reset: clean
  11. rm -rf ./third_party
  12. update: install
  13. @./tools/armnn sync schema
  14. @./tools/bigdl sync schema
  15. @./tools/caffe sync schema
  16. @./tools/cntk sync schema
  17. @./tools/coreml sync schema
  18. @./tools/mnn sync schema
  19. @./tools/onnx sync install schema metadata
  20. @./tools/paddle sync schema
  21. @./tools/pytorch sync install schema metadata
  22. @./tools/sklearn sync install metadata
  23. @./tools/tf sync install schema metadata
  24. @./tools/uff schema
  25. build_python: install
  26. python -m pip install --user wheel
  27. python ./setup.py build --version bdist_wheel
  28. build_electron: install
  29. CSC_IDENTITY_AUTO_DISCOVERY=false npx electron-builder --mac --publish never
  30. npx electron-builder --win --publish never
  31. npx electron-builder --linux appimage --publish never
  32. npx electron-builder --linux snap --publish never
  33. lint: install
  34. npx eslint source/*.js test/*.js setup/*.js tools/*.js
  35. test: install
  36. node ./test/models.js
  37. start: install
  38. npx electron .
  39. publish_python: build_python
  40. python -m pip install --user twine
  41. python -m twine upload --non-interactive --skip-existing --verbose dist/dist/*
  42. publish_electron: install
  43. npx electron-builder --mac --publish always
  44. npx electron-builder --win --publish always
  45. npx electron-builder --linux appimage --publish always
  46. npx electron-builder --linux snap --publish always
  47. publish_github_pages: build_python
  48. rm -rf ./dist/gh-pages
  49. git clone --depth=1 https://x-access-token:$(GITHUB_TOKEN)@github.com/$(GITHUB_USER)/netron.git --branch gh-pages ./dist/gh-pages 2>&1 > /dev/null
  50. rm -rf ./dist/gh-pages/*
  51. cp -R ./dist/lib/netron/* ./dist/gh-pages/
  52. rm -rf ./dist/gh-pages/*.py*
  53. git -C ./dist/gh-pages add --all
  54. git -C ./dist/gh-pages commit --amend --no-edit
  55. git -C ./dist/gh-pages push --force origin gh-pages
  56. publish_cask:
  57. curl -s -H "Authorization: token $(GITHUB_TOKEN)" https://api.github.com/repos/Homebrew/homebrew-cask/forks -d '' 2>&1 > /dev/null
  58. rm -rf ./dist/homebrew-cask
  59. sleep 4
  60. git clone --depth=2 https://x-access-token:$(GITHUB_TOKEN)@github.com/$(GITHUB_USER)/homebrew-cask.git ./dist/homebrew-cask
  61. node ./setup/cask.js ./package.json ./dist/homebrew-cask/Casks/netron.rb
  62. git -C ./dist/homebrew-cask add --all
  63. git -C ./dist/homebrew-cask commit -m "Update $$(node -pe "require('./package.json').productName") to $$(node -pe "require('./package.json').version")"
  64. git -C ./dist/homebrew-cask push
  65. curl -H "Authorization: token $(GITHUB_TOKEN)" https://api.github.com/repos/Homebrew/homebrew-cask/pulls -d "{\"title\":\"Update $$(node -pe "require('./package.json').name") to $$(node -pe "require('./package.json').version")\",\"base\":\"master\",\"head\":\"$(GITHUB_USER):master\",\"body\":\"\"}" 2>&1 > /dev/null
  66. rm -rf ./dist/homebrew-cask
  67. curl -s -H "Authorization: token $(GITHUB_TOKEN)" -X "DELETE" https://api.github.com/repos/$(GITHUB_USER)/homebrew-cask 2>&1 > /dev/null
  68. publish_winget:
  69. curl -s -H "Authorization: token $(GITHUB_TOKEN)" https://api.github.com/repos/microsoft/winget-pkgs/forks -d '' 2>&1 > /dev/null
  70. rm -rf ./dist/winget-pkgs
  71. sleep 4
  72. git clone --depth=2 https://x-access-token:$(GITHUB_TOKEN)@github.com/$(GITHUB_USER)/winget-pkgs.git ./dist/winget-pkgs
  73. node ./setup/winget.js ./package.json ./dist/winget-pkgs/manifests
  74. git -C ./dist/winget-pkgs add --all
  75. git -C ./dist/winget-pkgs commit -m "Update $$(node -pe "require('./package.json').name") to $$(node -pe "require('./package.json').version")"
  76. git -C ./dist/winget-pkgs push
  77. curl -H "Authorization: token $(GITHUB_TOKEN)" https://api.github.com/repos/microsoft/winget-pkgs/pulls -d "{\"title\":\"Update $$(node -pe "require('./package.json').productName") to $$(node -pe "require('./package.json').version")\",\"base\":\"master\",\"head\":\"$(GITHUB_USER):master\",\"body\":\"\"}" 2>&1 > /dev/null
  78. rm -rf ./dist/winget-pkgs
  79. curl -s -H "Authorization: token $(GITHUB_TOKEN)" -X "DELETE" https://api.github.com/repos/$(GITHUB_USER)/winget-pkgs 2>&1 > /dev/null
  80. version:
  81. node ./setup/version.js ./package.json
  82. git add ./package.json
  83. git commit -m "Update to $$(node -pe "require('./package.json').version")"
  84. git tag v$$(node -pe "require('./package.json').version")
  85. git push --force
  86. git push --tags
  87. git tag -d v$$(node -pe "require('./package.json').version")