Skip to content

Commit

Permalink
Feature Add Nightlight Build And Rollcack (#2525)
Browse files Browse the repository at this point in the history
* Update build-on-create-release.yml

* Update build-on-create-release.yml

* Feature: Add New Workflow

Implemented new workflow with nightly build

* Update build-on-create-release.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Fix: SM2.0 machine not online bug

Rewrite the Klipper adapter to ignore the connection status. Klipper will only start after the device is connected and will be closed directly after the connection is disconnected.

* Update build-on-pull-request.yml

* Fix: PR workflow bug

cannot build and collect package bug

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Fix artifact name Bug

Linux artifact name is different between win and mac,change them to the same

* Update build-on-create-release.yml

* Update build-on-pull-request.yml

* Fix: Klipper onStop error

fix sever maybe null error

* Fix: Klipper onStop error

fix sever maybe null error

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Fix: Add Log to fin why ws stop

Add Log to fin why ws stop

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Update build-on-pull-request.yml

* Fix: Add Log to fin why ws stop

Add Log to fin why ws stop

* Fix: Fix adaptor bug

Adaptor is octo protol not klipper,fix wrong socketserver to listen .

* Fix: Change userinfo load

* Feature: Add not-online status

* Feature: Add avatarBox z-index

* Fix: Fix lunarTPP auth bug

Fix lunarTPP auth bug

* Fix: Rollback and fix bug

Rollback material test feature
Fix nightlight build bug

* Fix: Rollback and fix bug

Rollback error code

---------

Co-authored-by: snapmaker <[email protected]>
Co-authored-by: wanghu <[email protected]>
  • Loading branch information
3 people authored Nov 12, 2024
1 parent 60de8e9 commit 3888852
Show file tree
Hide file tree
Showing 21 changed files with 468 additions and 1,103 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-on-create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:

- name: Checkout submodules
run: git submodule update --init --recursive

- name: Set up Python
uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:

- run: |
PRODUCT_NAME="Snapmaker Luban"
PACKAGE_NAME="snapmaker-luban"
PACKAGE_NAME="Snapmaker-luban"
PACKAGE_VERSION=`node -e "console.log(require('./src/package.json').version)"`
RELEASE=${PACKAGE_NAME}-${PACKAGE_VERSION}
Expand Down
272 changes: 272 additions & 0 deletions .github/workflows/build-on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
name: Build on PR

on:
workflow_dispatch:
pull_request:
type: closed
branches:
- main
- release/*
jobs:
build-windows:
name: Build Windows Packages
runs-on: windows-2022
steps:
- name: Prepare VC++ Runtime
run: choco install -y vcredist2017

- name: Checkout Code
uses: actions/checkout@v4
with:
token: ${{ secrets.SACP_TOKEN }}
submodules: 'true'

- name: Checkout submodules
run: git submodule update --init --recursive

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16

- name: Init Props
run: |
$PRODUCT_NAME="Snapmaker Luban"
$PACKAGE_NAME="Snapmaker-luban"
$PACKAGE_VERSION= node -e "console.log(require('./src/package.json').version)"
$RELEASE="$PACKAGE_NAME-$PACKAGE_VERSION"
echo "SM_RELEASE=$RELEASE" >> $env:GITHUB_ENV
- name: install
run: |
npm install -g npm@^9
npm install
- name: build
run: npm run build

# ----------------------------------------------------------------
# Build Windows x64
# ----------------------------------------------------------------
- name: Build Windows x64 Binaries
run: |
npm run build:win-x64
dir ${{ github.workspace }}
dir ${{ github.workspace }}/output
- name: Upload artifacts Windows x64
uses: actions/upload-artifact@v4
with:
name: ${{ env.SM_RELEASE }}-win-x64.exe
path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-win-x64.exe

- name: Deploy Windows release
uses: WebFreak001/[email protected]
with:
upload_url: https://uploads.github.com/repos/Snapmaker/Luban/releases/180614211/assets{?name,label}
release_id: 180614211
asset_path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-win-x64.exe
asset_name: ${{ env.SM_RELEASE }}-win-x64.exe
asset_content_type: application/octet-stream
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
ignore_hash: true

build-macos:
name: Build macOS Packages

# macos-11.7
runs-on: macos-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
token: ${{ secrets.SACP_TOKEN }}
submodules: 'true'

- name: Checkout submodules
run: git submodule update --init --recursive

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16

- name: Init Props
run: |
PRODUCT_NAME="Snapmaker Luban"
PACKAGE_NAME="Snapmaker-luban"
PACKAGE_VERSION=`node -e "console.log(require('./src/package.json').version)"`
RELEASE=${PACKAGE_NAME}-${PACKAGE_VERSION}
echo "SM_RELEASE=$RELEASE" >> $GITHUB_ENV
# install setuptools to reintroduce distutils missing in Python 3.12
# https://github.com/nodejs/node-gyp/issues/2869
- run: pip install setuptools
- run: npm install -g npm@^9
- run: npm install

- run: npm run build

# ----------------------------------------------------------------
# Build macOS x64 & arm64
# ----------------------------------------------------------------
- name: Build macOS Binaries
run: npm run build:mac
env:
CSC_LINK: ${{ secrets.CSC_LINK_MACOS }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD_MACOS }}
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}

- name: Upload artifacts mac-arm64-dmp
uses: actions/upload-artifact@v4
with:
name: ${{ env.SM_RELEASE }}-mac-arm64.dmg
path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-mac-arm64.dmg
- name: Deploy mac-arm64-dmg release
uses: WebFreak001/[email protected]
with:
upload_url: https://uploads.github.com/repos/Snapmaker/Luban/releases/180614211/assets{?name,label}
release_id: 180614211
asset_path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-mac-arm64.dmg
asset_name: ${{ env.SM_RELEASE }}-mac-arm64.dmg
asset_content_type: application/octet-stream
max_releases: 1
ignore_hash: true
- name: Upload artifacts mac-arm64-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.SM_RELEASE }}-mac-arm64.zip
path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-mac-arm64.zip

- name: Deploy mac-arm64-dmg release
uses: WebFreak001/[email protected]
with:
upload_url: https://uploads.github.com/repos/Snapmaker/Luban/releases/180614211/assets{?name,label}
release_id: 180614211
asset_path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-mac-arm64.zip
asset_name: ${{ env.SM_RELEASE }}-mac-arm64.zip
asset_content_type: application/octet-stream
max_releases: 1
ignore_hash: true


build-linux:
name: Build Linux Packages

# Ubuntu 20.04: ubuntu-latest or ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
token: ${{ secrets.SACP_TOKEN }}
submodules: 'true'

- name: Checkout submodules
run: git submodule update --init --recursive

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16

- run: npm install -g npm@^9
- run: npm install

- run: npm run build

# ----------------------------------------------------------------
# Build Linux x64
# ----------------------------------------------------------------
- name: Build Linux x64 Binaries
run: npm run build:linux-x64

- run: |
PRODUCT_NAME="Snapmaker Luban"
PACKAGE_NAME="Snapmaker-luban"
PACKAGE_VERSION=`node -e "console.log(require('./src/package.json').version)"`
RELEASE=${PACKAGE_NAME}-${PACKAGE_VERSION}
echo "SM_RELEASE=$RELEASE" >> $GITHUB_ENV
ln -sf ./output/linux-unpacked "${RELEASE}-linux-x64"
tar zcfh "./output/${RELEASE}-linux-x64.tar.gz" "${RELEASE}-linux-x64"
rm -f "${RELEASE}-linux-x64"
- name: Upload artifacts linux-amd64
uses: actions/upload-artifact@v4
with:
name: ${{ env.SM_RELEASE }}-linux-amd64.deb
path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-linux-amd64.deb

- name: Deploy Linux-deb release
uses: WebFreak001/[email protected]
with:
upload_url: https://uploads.github.com/repos/Snapmaker/Luban/releases/180614211/assets{?name,label}
release_id: 180614211
asset_path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-linux-amd64.deb
asset_name: ${{ env.SM_RELEASE }}-linux-amd64.deb
asset_content_type: application/octet-stream
max_releases: 1
ignore_hash: true

- name: Upload artifacts linux-amd64
uses: actions/upload-artifact@v4
with:
name: ${{ env.SM_RELEASE }}-linux.x86_64.rpm
path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-linux.x86_64.rpm

- name: Deploy Linux-rpm release
uses: WebFreak001/[email protected]
with:
upload_url: https://uploads.github.com/repos/Snapmaker/Luban/releases/180614211/assets{?name,label}
release_id: 180614211
asset_path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-linux.x86_64.rpm
asset_name: ${{ env.SM_RELEASE }}-linux.x86_64.rpm
asset_content_type: application/octet-stream
max_releases: 1
ignore_hash: true

- name: Upload artifacts linux-x64
uses: actions/upload-artifact@v4
with:
name: ${{ env.SM_RELEASE }}-linux-x64.tar.gz
path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-linux-x64.tar.gz

- name: Deploy Linux-tar release
uses: WebFreak001/[email protected]
with:
upload_url: https://uploads.github.com/repos/Snapmaker/Luban/releases/180614211/assets{?name,label}
release_id: 180614211
asset_path: ${{ github.workspace }}/output/${{ env.SM_RELEASE }}-linux-x64.tar.gz
asset_name: ${{ env.SM_RELEASE }}-linux-x64.tar.gz
asset_content_type: application/octet-stream
max_releases: 1
ignore_hash: true
4 changes: 2 additions & 2 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ nsis:
allowToChangeInstallationDirectory: true

linux:
artifactName: snapmaker-luban-${version}-linux-${arch}.${ext}
artifactName: Snapmaker-luban-${version}-linux-${arch}.${ext}
category: Utility
maintainer: parachute <[email protected]>
target:
Expand All @@ -88,7 +88,7 @@ deb:

rpm:
# snapmaker-luban-X.Y.Z-linux.x86_64.rpm
artifactName: snapmaker-luban-${version}-linux.${arch}.${ext}
artifactName: Snapmaker-luban-${version}-linux.${arch}.${ext}

#
# Hooks
Expand Down
7 changes: 1 addition & 6 deletions src/app/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,9 @@ const getCaseResourcesList = (() => {
// user info
//
const getUserInfo = (() => {
// cache CaseResources data for once load
let data;
return async (token) => {
const getData = defaultAPIFactory(() => request.get('/api/common/accounts/current').query({ token }));
if (!data) {
data = getData();
}
return data;
return getData();
};
})();

Expand Down
8 changes: 3 additions & 5 deletions src/app/toolpaths/ToolPathGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,9 @@ class ToolPathGroup {
if (!withoutSelection) {
this.selectedToolPathArray.forEach((id) => {
const selectedToolpath = this._getToolPath(id);
if (selectedToolpath) {
this.toolPathObjects.remove(selectedToolpath.object);
selectedToolpath.object = selectedToolpath.object.clone();
this.toolPathObjects.add(selectedToolpath.object);
}
this.toolPathObjects.remove(selectedToolpath.object);
selectedToolpath.object = selectedToolpath.object.clone();
this.toolPathObjects.add(selectedToolpath.object);
});
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/app/ui/components/SvgIcon/SvgIcon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import styles from './styles.styl';

// FIXME: This is just a temporary solution. The correct approach would be to move this component into the xxx dependency library.
import MainToolbarAbPosition from './Icons/MainToolbarAbPosition';
import MaterialTest from './Icons/MaterialTestIcon';

Icons.MainToolbarAbPosition = MainToolbarAbPosition;

Icons.MaterialTest = MaterialTest;


class SvgIcon extends PureComponent {
static propTypes = {
Expand Down
Loading

0 comments on commit 3888852

Please sign in to comment.