Skip to content

Commit

Permalink
try building
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Dec 2, 2024
1 parent 3329768 commit d0ca06f
Show file tree
Hide file tree
Showing 4 changed files with 359 additions and 340 deletions.
78 changes: 49 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,62 @@ name: build
on:
push:
# enable next line to limit branches to run
branches: [ "master" ]
branches: ["master"]
pull_request:
# enable next line to limit branches to run
# branches: [ "master" ]

jobs:
build:
if: false
strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 20.x]
os: [windows-2022, ubuntu-22.04]
node-version: [20.x, latest]
os: [windows-2022, ubuntu-22.04, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

# not needed currently, but leaving here for future use
# - uses: actions/setup-python@v4
# with:
# python-version: '2.7.18'

- name: boost
if: startsWith(matrix.os,'ubuntu')
run: sudo apt-get update && sudo apt-get install -yq libboost-dev

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Build
run: |
npm install
npm run build
- name: Package
run: |
npm run dist
- uses: actions/checkout@v4
with:
submodules: recursive

# not needed currently, but leaving here for future use
# - uses: actions/setup-python@v4
# with:
# python-version: '2.7.18'

- name: boost
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get update && sudo apt-get install -yq libboost-dev

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Build
run: |
npm install
npm run build
- name: Package
run: |
npx @electron/packager . deepnest --out dist
- name: Upload
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.os }}
path: dist/
retention-days: 1

- name: Run app
if: startsWith(matrix.os, 'ubuntu')
run: |
appName=$(ls dist | head -1)
chmod +x ./dist/$appName/deepnest
./dist/$appName/deepnest
- name: Upload results
uses: actions/upload-artifact@v4
with:
name: nesting-results-${{ matrix.os }}
path: ~/Downloads/nesting-*
retention-days: 1
16 changes: 9 additions & 7 deletions main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ const { ensureDirSync } = require("fs-extra");
// [FuseV1Options.RunAsNode]: undefined,
// });

const inputDir = path.resolve(__dirname, "input");
const outputDir = path.resolve(__dirname, "test-results", "output");
const robotFile = path.resolve(__dirname, "robot.js");
const inputDir = path.resolve(app.getAppPath(), "input");
const outputDir = path.resolve(
app.getPath("downloads"),
`nesting-${new Date().toISOString()}`
);
ensureDirSync(outputDir);
const downloadFile = path.resolve(outputDir, "result.svg");
const dataFile = path.resolve(outputDir, "data.json");

const exec = async () => {
const files = (await readdir(inputDir))
Expand All @@ -33,14 +38,11 @@ const exec = async () => {

app.on("main-window", async ({ mainWindow }) => {
const data = await mainWindow.webContents.executeJavaScript(
(await readFile(path.resolve(__dirname, "robot.js"))).toString(),
(await readFile(robotFile)).toString(),
true
);

await writeFile(
path.resolve(outputDir, "data.json"),
JSON.stringify(data, null, 2)
);
await writeFile(dataFile, JSON.stringify(data, null, 2));

app.quit();

Expand Down
Loading

0 comments on commit d0ca06f

Please sign in to comment.